From ead76331eecd230b25b7999062d317ee5c85faef Mon Sep 17 00:00:00 2001 From: eileen Date: Tue, 19 Jan 2021 13:44:42 +1300 Subject: [PATCH] Cleanup a couple of unnecessary references --- CRM/Activity/Import/Parser/Activity.php | 16 ++++++++-------- CRM/Import/Parser.php | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CRM/Activity/Import/Parser/Activity.php b/CRM/Activity/Import/Parser/Activity.php index 822b2d3435..96e2e7f9d8 100644 --- a/CRM/Activity/Import/Parser/Activity.php +++ b/CRM/Activity/Import/Parser/Activity.php @@ -129,8 +129,7 @@ class CRM_Activity_Import_Parser_Activity extends CRM_Activity_Import_Parser { * the result of this processing */ public function summary(&$values) { - $erroneousField = NULL; - $this->setActiveFieldValues($values, $erroneousField); + $this->setActiveFieldValues($values); try { $this->validateActivityTypeIDAndLabel($values); @@ -142,7 +141,7 @@ class CRM_Activity_Import_Parser_Activity extends CRM_Activity_Import_Parser { return $this->addError($values, [$e->getMessage()]); } - $params = &$this->getActiveFieldParams(); + $params = $this->getActiveFieldParams(); $errorMessage = NULL; @@ -153,7 +152,7 @@ class CRM_Activity_Import_Parser_Activity extends CRM_Activity_Import_Parser { $params['source_contact_id'] = $session->get('userID'); } foreach ($params as $key => $val) { - if ($key == 'activity_date_time') { + if ($key === 'activity_date_time') { if ($val) { $dateValue = CRM_Utils_Date::formatDate($val, $dateType); if ($dateValue) { @@ -197,6 +196,7 @@ class CRM_Activity_Import_Parser_Activity extends CRM_Activity_Import_Parser { * * @return bool * the result of this processing + * @throws \CRM_Core_Exception */ public function import($onDuplicate, &$values) { // First make sure this is a valid line @@ -205,7 +205,7 @@ class CRM_Activity_Import_Parser_Activity extends CRM_Activity_Import_Parser { if ($response != CRM_Import_Parser::VALID) { return $response; } - $params = &$this->getActiveFieldParams(); + $params = $this->getActiveFieldParams(); $activityLabel = array_search('activity_label', $this->_mapperKeys); if ($activityLabel) { $params = array_merge($params, ['activity_label' => $values[$activityLabel]]); @@ -221,7 +221,7 @@ class CRM_Activity_Import_Parser_Activity extends CRM_Activity_Import_Parser { foreach ($params as $key => $val) { if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($key)) { - if ($key == 'activity_date_time' && $val) { + if ($key === 'activity_date_time' && $val) { $params[$key] = CRM_Utils_Date::formatDate($val, $dateType); } elseif (!empty($customFields[$customFieldID]) && $customFields[$customFieldID]['data_type'] == 'Date') { @@ -231,10 +231,10 @@ class CRM_Activity_Import_Parser_Activity extends CRM_Activity_Import_Parser { $params[$key] = CRM_Utils_String::strtoboolstr($val); } } - elseif ($key == 'activity_date_time') { + elseif ($key === 'activity_date_time') { $params[$key] = CRM_Utils_Date::formatDate($val, $dateType); } - elseif ($key == 'activity_subject') { + elseif ($key === 'activity_subject') { $params['subject'] = $val; } } diff --git a/CRM/Import/Parser.php b/CRM/Import/Parser.php index 5a5c7cbfa7..f49c095acb 100644 --- a/CRM/Import/Parser.php +++ b/CRM/Import/Parser.php @@ -265,7 +265,7 @@ abstract class CRM_Import_Parser { * * @return int */ - public function setActiveFieldValues($elements, &$erroneousField) { + public function setActiveFieldValues($elements, &$erroneousField = NULL) { $maxCount = count($elements) < $this->_activeFieldCount ? count($elements) : $this->_activeFieldCount; for ($i = 0; $i < $maxCount; $i++) { $this->_activeFields[$i]->setValue($elements[$i]); -- 2.25.1