From 2e7e11e8e3d61e40800167826ba2344b0666c457 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Wed, 10 Aug 2022 13:07:37 +1200 Subject: [PATCH] Finally remove apiv2 DeprecatedUtils --- CRM/Contribute/Import/Parser/Contribution.php | 1 - CRM/Event/Import/Parser/Participant.php | 2 - CRM/Import/Parser.php | 1 - CRM/Utils/DeprecatedUtils.php | 76 ------------------- tests/phpunit/api/v3/UtilsTest.php | 2 - 5 files changed, 82 deletions(-) delete mode 100644 CRM/Utils/DeprecatedUtils.php diff --git a/CRM/Contribute/Import/Parser/Contribution.php b/CRM/Contribute/Import/Parser/Contribution.php index 5e2b3cd23b..ca4fdb8aef 100644 --- a/CRM/Contribute/Import/Parser/Contribution.php +++ b/CRM/Contribute/Import/Parser/Contribution.php @@ -615,7 +615,6 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Import_Parser { * @throws \CRM_Core_Exception */ private function deprecatedFormatParams($params, &$values, $create = FALSE) { - require_once 'CRM/Utils/DeprecatedUtils.php'; // copy all the contribution fields as is require_once 'api/v3/utils.php'; diff --git a/CRM/Event/Import/Parser/Participant.php b/CRM/Event/Import/Parser/Participant.php index de5f53ef52..b043879668 100644 --- a/CRM/Event/Import/Parser/Participant.php +++ b/CRM/Event/Import/Parser/Participant.php @@ -15,8 +15,6 @@ * @copyright CiviCRM LLC https://civicrm.org/licensing */ -require_once 'CRM/Utils/DeprecatedUtils.php'; - /** * class to parse membership csv files */ diff --git a/CRM/Import/Parser.php b/CRM/Import/Parser.php index 086cb4e628..4c7b106c76 100644 --- a/CRM/Import/Parser.php +++ b/CRM/Import/Parser.php @@ -852,7 +852,6 @@ abstract class CRM_Import_Parser implements UserJobInterface { //retrieve contact id using contact dedupe rule $formatValues['contact_type'] = $formatValues['contact_type'] ?? $this->getContactType(); $formatValues['version'] = 3; - require_once 'CRM/Utils/DeprecatedUtils.php'; $params = $formatValues; static $cIndieFields = NULL; static $defaultLocationId = NULL; diff --git a/CRM/Utils/DeprecatedUtils.php b/CRM/Utils/DeprecatedUtils.php deleted file mode 100644 index 94fba59c2a..0000000000 --- a/CRM/Utils/DeprecatedUtils.php +++ /dev/null @@ -1,76 +0,0 @@ - - */ -function _civicrm_api3_deprecated_duplicate_formatted_contact($params) { - $id = $params['id'] ?? NULL; - $externalId = $params['external_identifier'] ?? NULL; - if ($id || $externalId) { - $contact = new CRM_Contact_DAO_Contact(); - - $contact->id = $id; - $contact->external_identifier = $externalId; - - if ($contact->find(TRUE)) { - if ($params['contact_type'] != $contact->contact_type) { - return ['is_error' => 1, 'error_message' => 'Mismatched contact IDs OR Mismatched contact Types']; - } - return [ - 'is_error' => 1, - 'error_message' => [ - 'code' => CRM_Core_Error::DUPLICATE_CONTACT, - 'params' => [$contact->id], - 'level' => 'Fatal', - 'message' => "Found matching contacts: $contact->id", - ], - ]; - } - } - else { - $ids = CRM_Contact_BAO_Contact::getDuplicateContacts($params, $params['contact_type'], 'Unsupervised'); - - if (!empty($ids)) { - return [ - 'is_error' => 1, - 'error_message' => [ - 'code' => CRM_Core_Error::DUPLICATE_CONTACT, - 'params' => $ids, - 'level' => 'Fatal', - 'message' => 'Found matching contacts: ' . implode(',', $ids), - ], - ]; - } - } - return ['is_error' => 0]; -} diff --git a/tests/phpunit/api/v3/UtilsTest.php b/tests/phpunit/api/v3/UtilsTest.php index 85c24654ff..42c57793ba 100644 --- a/tests/phpunit/api/v3/UtilsTest.php +++ b/tests/phpunit/api/v3/UtilsTest.php @@ -9,8 +9,6 @@ +--------------------------------------------------------------------+ */ -require_once 'CRM/Utils/DeprecatedUtils.php'; - /** * Test class for API utils * -- 2.25.1