From 3f4d714a9a254808f20d22e65bd02fc97f522def Mon Sep 17 00:00:00 2001 From: eileen Date: Tue, 19 Jan 2021 14:17:50 +1300 Subject: [PATCH] Move engagement level validation into the validate section --- CRM/Activity/Import/Parser/Activity.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/CRM/Activity/Import/Parser/Activity.php b/CRM/Activity/Import/Parser/Activity.php index 58fb50443b..7699d2ad01 100644 --- a/CRM/Activity/Import/Parser/Activity.php +++ b/CRM/Activity/Import/Parser/Activity.php @@ -148,6 +148,12 @@ class CRM_Activity_Import_Parser_Activity extends CRM_Activity_Import_Parser { && !$this->isValidDate($this->getFieldValue($values, 'activity_date_time'))) { throw new CRM_Core_Exception(ts('Invalid Activity Date')); } + + if ($this->getFieldValue($values, 'activity_engagement_level') + && !CRM_Utils_Rule::positiveInteger($this->getFieldValue($values, 'activity_engagement_level'))) { + throw new CRM_Core_Exception(ts('Activity Engagement Index')); + } + } catch (CRM_Core_Exception $e) { return $this->addError($values, [$e->getMessage()]); @@ -157,13 +163,6 @@ class CRM_Activity_Import_Parser_Activity extends CRM_Activity_Import_Parser { $errorMessage = NULL; - foreach ($params as $key => $val) { - if ($key == 'activity_engagement_level' && $val && - !CRM_Utils_Rule::positiveInteger($val) - ) { - CRM_Contact_Import_Parser_Contact::addToErrorMsg('Activity Engagement Index', $errorMessage); - } - } // Date-Format part ends. // Checking error in custom data. -- 2.25.1