From 3b97797a67b24bec82e7d05809d0d030cae78b2c Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Tue, 9 Aug 2022 13:36:08 +1200 Subject: [PATCH] Fold call to weird deprecated function back into calling code --- CRM/Contribute/Import/Parser/Contribution.php | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/CRM/Contribute/Import/Parser/Contribution.php b/CRM/Contribute/Import/Parser/Contribution.php index 9c4a4bbd24..5e2b3cd23b 100644 --- a/CRM/Contribute/Import/Parser/Contribution.php +++ b/CRM/Contribute/Import/Parser/Contribution.php @@ -668,11 +668,25 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Import_Parser { // get the contact id from duplicate contact rule, if more than one contact is returned // we should return error, since current interface allows only one-one mapping - $emailParams = [ + $ids = CRM_Contact_BAO_Contact::getDuplicateContacts([ 'email' => $email, 'contact_type' => $params['contact_type'], - ]; - $checkDedupe = _civicrm_api3_deprecated_duplicate_formatted_contact($emailParams); + ], $params['contact_type'], 'Unsupervised'); + + if (!empty($ids)) { + $checkDedupe = [ + 'is_error' => 1, + 'error_message' => [ + 'code' => CRM_Core_Error::DUPLICATE_CONTACT, + 'params' => $ids, + 'level' => 'Fatal', + 'message' => 'Found matching contacts: ' . implode(',', $ids), + ], + ]; + } + else { + $checkDedupe = ['is_error' => 0]; + } if (!$checkDedupe['is_error']) { return civicrm_api3_create_error("Invalid email address(doesn't exist) $email. Row was skipped"); } -- 2.25.1