Imported contributions get matched to soft-deleted contacts when External ID is used to match to contact
Overview
When importing contributions using External ID as the match-to-contact method, contributions can get matched to soft-deleted contacts, which means no error message appears but the contributions do not appear on the expected record.
Reproduction steps
- Soft-delete a contact (put in the trash but no not delete permanently)
- Create a .csv for contributions import using that soft-deleted record's information, including External ID
- Import the contributions file
- Confirm that the contribution has been added to the soft-deleted contact
Current behaviour
Successful import of a contribution to a contact record that is in the trash
Expected behaviour
Behavior should match what happens when you import a contribution using email or Contact ID to match to contact and the contact is soft-deleted: Error line in the import, with an informative error message (E.g., Email address as matching method gives "No matching Contact found for ([EMAIL ADDRESS])"; Contact ID as matching method gives "Invalid Contact ID: contact_id 204 is a soft-deleted contact." Either one of these would be fine!)
Environment information
- Browser: Chrome OS Version 86.0.4240.198 (Official Build) (64-bit)
- CiviCRM: 5.31.0
- PHP: not sure
- CMS: WordPress 5.5.3
- Database: not sure
- Web Server: not sure
Comments
I am working on getting more environment info but I replicated the issue in two demos (dmaster and wpmaster) so I am not sure that's needed.