From 880585a2d0148f14d7f567525ab14ecd5f6c5f63 Mon Sep 17 00:00:00 2001 From: eileen Date: Tue, 22 Dec 2020 09:16:03 +1300 Subject: [PATCH] [REF] Move another deprecated function to the class that uses it --- CRM/Event/Import/Parser/Participant.php | 24 ++++++++++++++++++++++-- CRM/Utils/DeprecatedUtils.php | 22 ---------------------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/CRM/Event/Import/Parser/Participant.php b/CRM/Event/Import/Parser/Participant.php index 5ed2fecfbc..3bb21269c1 100644 --- a/CRM/Event/Import/Parser/Participant.php +++ b/CRM/Event/Import/Parser/Participant.php @@ -386,7 +386,7 @@ class CRM_Event_Import_Parser_Participant extends CRM_Event_Import_Parser { foreach ($matchedIDs as $contactId) { $formatted['contact_id'] = $contactId; $formatted['version'] = 3; - $newParticipant = _civicrm_api3_deprecated_create_participant_formatted($formatted, $onDuplicate); + $newParticipant = $this->deprecated_create_participant_formatted($formatted, $onDuplicate); } } } @@ -435,7 +435,7 @@ class CRM_Event_Import_Parser_Participant extends CRM_Event_Import_Parser { } } - $newParticipant = _civicrm_api3_deprecated_create_participant_formatted($formatted, $onDuplicate); + $newParticipant = $this->deprecated_create_participant_formatted($formatted, $onDuplicate); } if (is_array($newParticipant) && civicrm_error($newParticipant)) { @@ -625,4 +625,24 @@ class CRM_Event_Import_Parser_Participant extends CRM_Event_Import_Parser { return NULL; } + /** + * @deprecated - this is part of the import parser not the API & needs to be moved on out + * + * @param array $params + * @param $onDuplicate + * + * @return array|bool + * + */ + protected function deprecated_create_participant_formatted($params, $onDuplicate) { + if ($onDuplicate != CRM_Import_Parser::DUPLICATE_NOCHECK) { + CRM_Core_Error::reset(); + $error = _civicrm_api3_deprecated_participant_check_params($params, TRUE); + if (civicrm_error($error)) { + return $error; + } + } + return civicrm_api3_participant_create($params); + } + } diff --git a/CRM/Utils/DeprecatedUtils.php b/CRM/Utils/DeprecatedUtils.php index 1fe35cc8da..ae4efc5b2b 100644 --- a/CRM/Utils/DeprecatedUtils.php +++ b/CRM/Utils/DeprecatedUtils.php @@ -488,28 +488,6 @@ function _civicrm_api3_deprecated_duplicate_formatted_contact($params) { return civicrm_api3_create_success(TRUE); } -/** - * @deprecated - this is part of the import parser not the API & needs to be moved on out - * - * @param array $params - * @param $onDuplicate - * - * @return array|bool - * - */ -function _civicrm_api3_deprecated_create_participant_formatted($params, $onDuplicate) { - require_once 'CRM/Event/Import/Parser.php'; - if ($onDuplicate != CRM_Import_Parser::DUPLICATE_NOCHECK) { - CRM_Core_Error::reset(); - $error = _civicrm_api3_deprecated_participant_check_params($params, TRUE); - if (civicrm_error($error)) { - return $error; - } - } - require_once "api/v3/Participant.php"; - return civicrm_api3_participant_create($params); -} - /** * * @param array $params -- 2.25.1