From e6586a9f1374adfb3721cd65e94543f415757d72 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 1 May 2023 11:28:04 +1200 Subject: [PATCH] Further notice fixes on Constituent report --- CRM/Report/Form.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php index d7ead6275a..25616c6042 100644 --- a/CRM/Report/Form.php +++ b/CRM/Report/Form.php @@ -1358,6 +1358,8 @@ class CRM_Report_Form extends CRM_Core_Form { /** * Add filters to report. + * + * @throws \CRM_Core_Exception */ public function addFilters() { $filters = $filterGroups = []; @@ -1381,6 +1383,9 @@ class CRM_Report_Form extends CRM_Core_Form { } foreach ($attributes as $fieldName => $field) { + if (empty($field['operatorType'])) { + $field['operatorType'] = ''; + } $filterGroups[$groupingKey]['tables'][$table][$fieldName] = $field; // Filters is deprecated in favour of filterGroups. $filters[$table][$fieldName] = $field; @@ -1388,10 +1393,10 @@ class CRM_Report_Form extends CRM_Core_Form { // @ todo being able to specific options for a field (e.g a date field) in the field spec as an array rather than an override // would be useful $operations = $this->getOperationPair( - CRM_Utils_Array::value('operatorType', $field), + $field['operatorType'], $fieldName); - switch (CRM_Utils_Array::value('operatorType', $field)) { + switch ($field['operatorType']) { case CRM_Report_Form::OP_MONTH: if (!array_key_exists('options', $field) || !is_array($field['options']) || empty($field['options']) @@ -1407,7 +1412,7 @@ class CRM_Report_Form extends CRM_Core_Form { case CRM_Report_Form::OP_MULTISELECT_SEPARATOR: // assume a multi-select field if (!empty($field['options']) || - $fieldName == 'state_province_id' || $fieldName == 'county_id' + $fieldName === 'state_province_id' || $fieldName === 'county_id' ) { $element = $this->addElement('select', "{$fieldName}_op", ts('Operator:'), $operations, array('onchange' => "return showHideMaxMinVal( '$fieldName', this.value );") @@ -1416,8 +1421,8 @@ class CRM_Report_Form extends CRM_Core_Form { if (count($operations) <= 1) { $element->freeze(); } - if ($fieldName == 'state_province_id' || - $fieldName == 'county_id' + if ($fieldName === 'state_province_id' || + $fieldName === 'county_id' ) { $this->addChainSelect($fieldName . '_value', [ 'multiple' => TRUE, -- 2.25.1