From f1259c60764e8a510e56b41c8bed9ac2cba038aa Mon Sep 17 00:00:00 2001 From: colemanw Date: Mon, 28 Aug 2023 12:12:29 -0400 Subject: [PATCH] CRM - Cleanup verbose array conditionals --- CRM/Contact/Form/Search/Builder.php | 6 +++--- CRM/Event/BAO/Event.php | 4 +--- CRM/Price/BAO/PriceField.php | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/CRM/Contact/Form/Search/Builder.php b/CRM/Contact/Form/Search/Builder.php index 2996b1f8d7..c65dc87d0c 100644 --- a/CRM/Contact/Form/Search/Builder.php +++ b/CRM/Contact/Form/Search/Builder.php @@ -917,12 +917,12 @@ class CRM_Contact_Form_Search_Builder extends CRM_Contact_Form_Search { $jsSet = TRUE; - if (CRM_Utils_Array::value($i, CRM_Utils_Array::value($x, $mappingOperator))) { - $defaults["operator[$x][$i]"] = $mappingOperator[$x][$i] ?? NULL; + if (!empty($mappingOperator[$x][$i])) { + $defaults["operator[$x][$i]"] = $mappingOperator[$x][$i]; } if (isset($mappingValue[$x][$i])) { - $defaults["value[$x][$i]"] = $mappingValue[$x][$i] ?? NULL; + $defaults["value[$x][$i]"] = $mappingValue[$x][$i]; } } } diff --git a/CRM/Event/BAO/Event.php b/CRM/Event/BAO/Event.php index 8c7fea3c88..96e746a736 100644 --- a/CRM/Event/BAO/Event.php +++ b/CRM/Event/BAO/Event.php @@ -1378,9 +1378,7 @@ WHERE civicrm_event.is_active = 1 while ($grp->fetch()) { $grpTitles[] = $grp->title; } - if (!empty($grpTitles) && - CRM_Utils_Array::value('title', CRM_Utils_Array::value('group', $fields)) - ) { + if (!empty($grpTitles) && !empty($fields['group']['title'])) { $values[$fields['group']['title']] = implode(', ', $grpTitles); } unset($fields['group']); diff --git a/CRM/Price/BAO/PriceField.php b/CRM/Price/BAO/PriceField.php index ba1b636649..0fb1c2e609 100644 --- a/CRM/Price/BAO/PriceField.php +++ b/CRM/Price/BAO/PriceField.php @@ -103,7 +103,7 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { for ($index = 1; $index <= $maxIndex; $index++) { if (array_key_exists('option_amount', $params) && array_key_exists($index, $params['option_amount']) && - (CRM_Utils_Array::value($index, CRM_Utils_Array::value('option_label', $params)) || !empty($params['is_quick_config'])) && + (!empty($params['option_label'][$index]) || !empty($params['is_quick_config'])) && !CRM_Utils_System::isNull($params['option_amount'][$index]) ) { $options = [ @@ -128,7 +128,7 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { $options['is_default'] = !empty($defaultArray[$params['membership_type_id'][$index]]) ? $defaultArray[$params['membership_type_id'][$index]] : 0; } - if (CRM_Utils_Array::value($index, CRM_Utils_Array::value('option_financial_type_id', $params))) { + if (!empty($params['option_financial_type_id'][$index])) { $options['financial_type_id'] = $params['option_financial_type_id'][$index]; } elseif (!empty($params['financial_type_id'])) { -- 2.25.1