From 4722138d18a49c2837f370b111a127d63fdf985c Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Wed, 1 Jun 2022 14:40:02 +1200 Subject: [PATCH] Move function to the only class that still calls it --- CRM/Contact/Import/Parser/Contact.php | 18 ------------------ CRM/Event/Import/Parser/Participant.php | 22 ++++++++++++++++++++-- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/CRM/Contact/Import/Parser/Contact.php b/CRM/Contact/Import/Parser/Contact.php index 59d5957e0f..ed3c7f5233 100644 --- a/CRM/Contact/Import/Parser/Contact.php +++ b/CRM/Contact/Import/Parser/Contact.php @@ -652,24 +652,6 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Import_Parser { return $this->_newRelatedContacts; } - /** - * Ckeck a value present or not in a array. - * - * @param $value - * @param $valueArray - * - * @return bool - */ - public static function in_value($value, $valueArray) { - foreach ($valueArray as $key => $v) { - //fix for CRM-1514 - if (strtolower(trim($v, ".")) == strtolower(trim($value, "."))) { - return TRUE; - } - } - return FALSE; - } - /** * Build error-message containing error-fields * diff --git a/CRM/Event/Import/Parser/Participant.php b/CRM/Event/Import/Parser/Participant.php index 391d6a49c9..476f0b8ccd 100644 --- a/CRM/Event/Import/Parser/Participant.php +++ b/CRM/Event/Import/Parser/Participant.php @@ -223,7 +223,7 @@ class CRM_Event_Import_Parser_Participant extends CRM_Import_Parser { } else { foreach ($val as $role) { - if (!CRM_Contact_Import_Parser_Contact::in_value(trim($role), $roleIDs)) { + if (!$this->in_value(trim($role), $roleIDs)) { CRM_Contact_Import_Parser_Contact::addToErrorMsg('Participant Role', $errorMessage); break; } @@ -238,7 +238,7 @@ class CRM_Event_Import_Parser_Participant extends CRM_Import_Parser { break; } } - elseif (!CRM_Contact_Import_Parser_Contact::in_value($val, $statusIDs)) { + elseif (!$this->in_value($val, $statusIDs)) { CRM_Contact_Import_Parser_Contact::addToErrorMsg('Participant Status', $errorMessage); break; } @@ -1019,4 +1019,22 @@ class CRM_Event_Import_Parser_Participant extends CRM_Import_Parser { fclose($fd); } + /** + * Check a value present or not in a array. + * + * @param $value + * @param $valueArray + * + * @return bool + */ + protected function in_value($value, $valueArray) { + foreach ($valueArray as $key => $v) { + //fix for CRM-1514 + if (strtolower(trim($v, ".")) == strtolower(trim($value, "."))) { + return TRUE; + } + } + return FALSE; + } + } -- 2.25.1