From 9e7052b3f6e95443c8396c0d61b943efaa8cff3c Mon Sep 17 00:00:00 2001 From: Bradley Taylor Date: Fri, 8 Dec 2023 14:15:55 +0000 Subject: [PATCH] [REF][PHP8.2] Survey details report - dynamic properties --- CRM/Report/Form/Campaign/SurveyDetails.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/CRM/Report/Form/Campaign/SurveyDetails.php b/CRM/Report/Form/Campaign/SurveyDetails.php index 9191acc4ef..39044107fa 100644 --- a/CRM/Report/Form/Campaign/SurveyDetails.php +++ b/CRM/Report/Form/Campaign/SurveyDetails.php @@ -16,9 +16,10 @@ */ class CRM_Report_Form_Campaign_SurveyDetails extends CRM_Report_Form { - protected $_emailField = FALSE; - - protected $_phoneField = FALSE; + /** + * @var array + */ + protected $surveyResponseFields = []; protected $_locationBasedPhoneField = FALSE; @@ -236,7 +237,7 @@ class CRM_Report_Form_Campaign_SurveyDetails extends CRM_Report_Form { ) { $fieldsName = CRM_Utils_Array::value(1, explode('_', $tableName)); - if ($fieldsName) { + if ($fieldsName && property_exists($this, "_$fieldsName" . 'Field')) { $this->{"_$fieldsName" . 'Field'} = TRUE; } @@ -282,7 +283,7 @@ class CRM_Report_Form_Campaign_SurveyDetails extends CRM_Report_Form { $this->joinEmailFromContact(); if ($this->_locationBasedPhoneField) { - foreach ($this->_surveyResponseFields as $key => $value) { + foreach ($this->surveyResponseFields as $key => $value) { if (substr($key, 0, 5) == 'phone' && !empty($value['location_type_id']) ) { $fName = str_replace('-', '_', $key); @@ -676,7 +677,7 @@ INNER JOIN civicrm_custom_group cg ON ( cg.id = cf.custom_group_id ) $responseFields = []; foreach ($surveyIds as $surveyId) { $responseFields += CRM_Campaign_BAO_Survey::getSurveyResponseFields($surveyId); - $this->_surveyResponseFields = $responseFields; + $this->surveyResponseFields = $responseFields; } foreach ($responseFields as $key => $value) { if (substr($key, 0, 5) == 'phone' && !empty($value['location_type_id'])) { -- 2.25.1