From: Eileen McNaughton Date: Thu, 19 May 2022 20:36:12 +0000 (+1200) Subject: [Ref] [Import] Cleanup function return X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=16a495a62cdbf3642e485db66550c2de8e2efb2a;p=civicrm-core.git [Ref] [Import] Cleanup function return --- diff --git a/CRM/Contact/Import/Parser/Contact.php b/CRM/Contact/Import/Parser/Contact.php index 9f8015e0f8..eef4bf77af 100644 --- a/CRM/Contact/Import/Parser/Contact.php +++ b/CRM/Contact/Import/Parser/Contact.php @@ -1982,10 +1982,11 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Import_Parser { * @param bool $dupeCheck * @param null|int $dedupeRuleGroupID * + * @return ?array * @throws \CRM_Core_Exception */ public function deprecated_contact_check_params( - &$params, + $params, $dupeCheck = TRUE, $dedupeRuleGroupID = NULL) { @@ -2004,12 +2005,17 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Import_Parser { // $dupes = civicrm_api3('Contact', 'duplicatecheck', (array('match' => $params, 'dedupe_rule_id' => $dedupeRuleGroupID))); // $ids = $dupes['count'] ? implode(',', array_keys($dupes['values'])) : NULL; $ids = CRM_Contact_BAO_Contact::getDuplicateContacts($params, $params['contact_type'], 'Unsupervised', [], CRM_Utils_Array::value('check_permissions', $params), $dedupeRuleGroupID); + if ($ids != NULL) { - $error = CRM_Core_Error::createError("Found matching contacts: " . implode(',', $ids), - CRM_Core_Error::DUPLICATE_CONTACT, - 'Fatal', $ids - ); - return civicrm_api3_create_error($error->pop()); + return [ + 'is_error' => 1, + 'error_message' => [ + 'code' => CRM_Core_Error::DUPLICATE_CONTACT, + 'params' => $ids, + 'level' => 'Fatal', + 'message' => 'Found matching contacts: ' . implode(',', $ids), + ], + ]; } }