REF - Replace CRM_Utils_Array::value with ??
authorcolemanw <coleman@civicrm.org>
Tue, 4 Jul 2023 21:21:32 +0000 (17:21 -0400)
committercolemanw <coleman@civicrm.org>
Tue, 4 Jul 2023 21:23:40 +0000 (17:23 -0400)
23 files changed:
CRM/Campaign/Page/DashBoard.php
CRM/Campaign/Page/SurveyType.php
CRM/Case/BAO/Case.php
CRM/Case/XMLProcessor/Report.php
CRM/Contact/BAO/Query.php
CRM/Contact/Form/Task/SMSCommon.php
CRM/Core/BAO/Navigation.php
CRM/Core/Form.php
CRM/Event/Form/Participant.php
CRM/Event/Page/EventInfo.php
CRM/Financial/BAO/EntityFinancialAccount.php
CRM/Financial/Form/FinancialAccount.php
CRM/Financial/Form/FinancialTypeAccount.php
CRM/Logging/Schema.php
CRM/PCP/Page/PCPInfo.php
CRM/Pledge/Form/Pledge.php
CRM/Profile/Form.php
CRM/Report/Form.php
CRM/Report/Form/Contribute/Detail.php
CRM/Report/Form/Instance.php
CRM/UF/Form/Field.php
CRM/Utils/Date.php
CRM/Utils/Pager.php

index 566f1dc5b4845186af8237f5a40b56ca2b310264..12973f87f755bf2a77801770282931b9e36bbca7 100644 (file)
@@ -335,7 +335,7 @@ class CRM_Campaign_Page_DashBoard extends CRM_Core_Page {
           $sid
         );
 
-        if (CRM_Utils_Array::value('activity_type', $surveysData[$sid]) != 'Petition') {
+        if (($surveysData[$sid]['activity_type'] ?? NULL) != 'Petition') {
           $surveysData[$sid]['voterLinks'] = CRM_Campaign_BAO_Survey::buildPermissionLinks($sid,
             TRUE,
             ts('more')
index e85650d6c7b0ccd2ab881f72a1ffb42abe2c1c48..d1e972df52a73b6f2a68f07a843fad44c968a73b 100644 (file)
@@ -131,7 +131,7 @@ class CRM_Campaign_Page_SurveyType extends CRM_Core_Page_Basic {
     $optionValues = CRM_Core_OptionValue::getRows($groupParams, $this->links(), 'component_id,weight');
 
     foreach ($optionValues as $key => $optionValue) {
-      if (CRM_Utils_Array::value('component_id', $optionValue) != $campaingCompId) {
+      if (($optionValue['component_id'] ?? NULL) != $campaingCompId) {
         unset($optionValues[$key]);
       }
     }
index 90f6030d50d8716aa6ebe01208dc5b2fbe64f733..96139650258e5123958ce11e49f6faa0127ed626 100644 (file)
@@ -1404,7 +1404,7 @@ HERESQL;
 
       $displayName = $info['display_name'] ?? NULL;
 
-      [$result[CRM_Utils_Array::value('contact_id', $info)], $subject, $message, $html] = CRM_Core_BAO_MessageTemplate::sendTemplate(
+      [$result[$info['contact_id'] ?? NULL], $subject, $message, $html] = CRM_Core_BAO_MessageTemplate::sendTemplate(
         [
           'groupName' => 'msg_tpl_workflow_case',
           'workflow' => 'case_activity',
@@ -1435,7 +1435,7 @@ HERESQL;
         $recordedActivityParams['target_contact_id'][] = $info['contact_id'];
       }
       else {
-        unset($result[CRM_Utils_Array::value('contact_id', $info)]);
+        unset($result[$info['contact_id'] ?? NULL]);
       }
     }
 
index 2668a61db8a5392dabaedba207c47646c290d5a0..05b29fb5344a7883e4a85c248367486aeb8c2f0f 100644 (file)
@@ -856,7 +856,7 @@ LIMIT  1
           );
         }
         if (!array_key_exists(CRM_Utils_Array::value('display_name', $client), $report->_redactionStringRules)) {
-          $report->_redactionStringRules[CRM_Utils_Array::value('display_name', $client)] = $report->_redactionStringRules[CRM_Utils_Array::value('sort_name', $client)];
+          $report->_redactionStringRules[$client['display_name'] ?? NULL] = $report->_redactionStringRules[$client['sort_name'] ?? NULL];
         }
         $client['sort_name'] = $report->redact(CRM_Utils_Array::value('sort_name', $client), TRUE, $report->_redactionStringRules);
         if (!empty($client['email']) &&
index 6ebc10a0eaf029c94eca9874cf07db8b9f75976c..0b0fa9138c3db36a6841f16079b3d201063d9814 100644 (file)
@@ -6556,7 +6556,7 @@ AND   displayRelType.is_active = 1
     }
     $pseudoConstant = $realField['pseudoconstant'];
     if (empty($pseudoConstant['optionGroupName']) &&
-      CRM_Utils_Array::value('labelColumn', $pseudoConstant) !== 'name') {
+      ($pseudoConstant['labelColumn'] ?? NULL) !== 'name') {
       // We are increasing our pseudoconstant handling - but still very cautiously,
       // hence the check for labelColumn === name
       return FALSE;
@@ -6990,8 +6990,8 @@ AND   displayRelType.is_active = 1
    */
   protected function isPseudoFieldAnFK($fieldSpec) {
     if (empty($fieldSpec['FKClassName'])
-      || CRM_Utils_Array::value('keyColumn', $fieldSpec['pseudoconstant']) !== 'id'
-      || CRM_Utils_Array::value('labelColumn', $fieldSpec['pseudoconstant']) !== 'name') {
+      || ($fieldSpec['pseudoconstant']['keyColumn'] ?? NULL) !== 'id'
+      || ($fieldSpec['pseudoconstant']['labelColumn'] ?? NULL) !== 'name') {
       return FALSE;
     }
     return TRUE;
index 95cd3b627adbdc74a642edde4d571fada04e05cc..a86c490221266f4f3269b3f79d8f7ead0263adbe 100644 (file)
@@ -191,7 +191,7 @@ class CRM_Contact_Form_Task_SMSCommon {
           unset($form->_contactDetails[$contactId]);
           continue;
         }
-        elseif ($contactDetails['phone_type_id'] != CRM_Utils_Array::value('Mobile', $phoneTypes)) {
+        elseif ($contactDetails['phone_type_id'] != ($phoneTypes['Mobile'] ?? NULL)) {
           //if phone is not primary check if non-primary phone is "Mobile"
           $filter = ['do_not_sms' => 0];
           $contactPhones = CRM_Core_BAO_Phone::allPhones($contactId, FALSE, 'Mobile', $filter);
index 2910a23b8cb226eccb7b0e626ea76a93312b3ca6..470280d4ace53dcdd79db317bdfd6d74b07ed888 100644 (file)
@@ -82,7 +82,7 @@ class CRM_Core_BAO_Navigation extends CRM_Core_DAO_Navigation {
     }
 
     if (!isset($params['id']) ||
-      (CRM_Utils_Array::value('parent_id', $params) != CRM_Utils_Array::value('current_parent_id', $params))
+      (($params['parent_id'] ?? NULL) != ($params['current_parent_id'] ?? NULL))
     ) {
       /* re/calculate the weight, if the Parent ID changed OR create new menu */
 
index d99b2282969c158d20982013b0a391be169413a9..94626883d4fe2f7c68c890dfc26b7e0c2b0b41d4 100644 (file)
@@ -1677,7 +1677,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
       [, $id] = explode('_', $name);
       $label = $props['label'] ?? CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', 'label', $id);
       $gid = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', 'option_group_id', $id);
-      if (CRM_Utils_Array::value('context', $props) != 'search') {
+      if (($props['context'] ?? NULL) != 'search') {
         $props['data-option-edit-path'] = array_key_exists('option_url', $props) ? $props['option_url'] : 'civicrm/admin/options/' . CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', $gid);
       }
     }
@@ -1694,7 +1694,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
         }
       }
       $label = $props['label'] ?? $fieldSpec['html']['label'] ?? $fieldSpec['title'];
-      if (CRM_Utils_Array::value('context', $props) != 'search') {
+      if (($props['context'] ?? NULL) != 'search') {
         $props['data-option-edit-path'] = array_key_exists('option_url', $props) ? $props['option_url'] : CRM_Core_PseudoConstant::getOptionEditUrl($fieldSpec);
       }
     }
index 42ba2ab1bb228cd2647ff4829fd02680f4bc5d2b..20baaa48c7604abb66c467fe1b95002c0541b8b0 100644 (file)
@@ -1339,7 +1339,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment
     $updateStatusMsg = NULL;
     //send mail when participant status changed, CRM-4326
     if ($this->_id && $this->_statusId &&
-      $this->_statusId != CRM_Utils_Array::value('status_id', $params) && !empty($params['is_notify'])
+      $this->_statusId != ($params['status_id'] ?? NULL) && !empty($params['is_notify'])
     ) {
 
       $updateStatusMsg = CRM_Event_BAO_Participant::updateStatusMessage($this->_id,
index c279ea153b8ea6e76d73235d03cd837c5e8bd00c..bb0b940b7c879151798876b8d01f688b6d2d3d09 100644 (file)
@@ -114,7 +114,7 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page {
           foreach ($priceSetFields as $fid => $fieldValues) {
             if (!is_array($fieldValues['options']) ||
               empty($fieldValues['options']) ||
-              (CRM_Utils_Array::value('visibility_id', $fieldValues) != array_search('public', $visibility) && $adminFieldVisible == FALSE)
+              (($fieldValues['visibility_id'] ?? NULL) != array_search('public', $visibility) && $adminFieldVisible == FALSE)
             ) {
               continue;
             }
@@ -132,7 +132,7 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page {
             }
 
             foreach ($fieldValues['options'] as $optionId => $optionVal) {
-              if (CRM_Utils_Array::value('visibility_id', $optionVal) != array_search('public', $visibility) &&
+              if (($optionVal['visibility_id'] ?? NULL) != array_search('public', $visibility) &&
                 $adminFieldVisible == FALSE
               ) {
                 continue;
index f7ba3dd7cde40f7ee33f9935931270e2fc8f76ce..80363d184460893df39e2d087698eac860633af7 100644 (file)
@@ -265,7 +265,7 @@ class CRM_Financial_BAO_EntityFinancialAccount extends CRM_Financial_DAO_EntityF
   public static function validateRelationship($financialTypeAccount) {
     $financialAccountLinks = CRM_Financial_BAO_FinancialAccount::getfinancialAccountRelations();
     $financialAccountType = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialAccount', $financialTypeAccount->financial_account_id, 'financial_account_type_id');
-    if (CRM_Utils_Array::value($financialTypeAccount->account_relationship, $financialAccountLinks) != $financialAccountType) {
+    if (($financialAccountLinks[$financialTypeAccount->account_relationship] ?? NULL) != $financialAccountType) {
       $accountRelationships = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship');
       throw new CRM_Core_Exception(ts("This financial account cannot have '%1' relationship.", [1 => $accountRelationships[$financialTypeAccount->account_relationship]]));
     }
index c90572a3264435c6d4b46ad9827f5360e52095cb..37e78f90f6b4513af67f9c8a6553d3a2f9b9283c 100644 (file)
@@ -146,7 +146,7 @@ class CRM_Financial_Form_FinancialAccount extends CRM_Contribute_Form {
         $errorMsg['tax_rate'] = ts('Please enter value for tax rate');
       }
     }
-    if ((CRM_Utils_Array::value('tax_rate', $values) != NULL)) {
+    if ((($values['tax_rate'] ?? NULL) != NULL)) {
       if ($values['tax_rate'] < 0 || $values['tax_rate'] >= 100) {
         $errorMsg['tax_rate'] = ts('Tax Rate Should be between 0 - 100');
       }
index 07c739474fafbd29b666d85b4c488449f9dfed15..b28b57360ea52e64ff1021f32083313b0ee7dc9f 100644 (file)
@@ -212,7 +212,7 @@ class CRM_Financial_Form_FinancialTypeAccount extends CRM_Core_Form {
     $errorFlag = FALSE;
     if ($self->_action == CRM_Core_Action::DELETE) {
       $relationValues = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship');
-      if (CRM_Utils_Array::value('financial_account_id', $values) != 'select') {
+      if (($values['financial_account_id'] ?? NULL) != 'select') {
         if ($relationValues[$values['account_relationship']] == 'Premiums Inventory Account is' || $relationValues[$values['account_relationship']] == 'Cost of Sales Account is') {
           $premiumsProduct = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_PremiumsProduct', $values['financial_type_id'], 'product_id', 'financial_type_id');
           $product = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Product', $values['financial_type_id'], 'name', 'financial_type_id');
index f1f5847cc4a2095e80dfb059f84dfc5f874ee0f2..8094be15c3ef7cd8d4b3c7a00140d5ae7f102c27 100644 (file)
@@ -722,7 +722,7 @@ WHERE  table_schema IN ('{$this->db}', '{$civiDB}')";
       if (!empty($specDiff) && $col !== 'id' && !in_array($col, $diff['ADD'])) {
         if (empty($colSpecs['EXTRA']) || (!empty($colSpecs['EXTRA']) && $colSpecs['EXTRA'] !== 'auto_increment')) {
           // ignore 'id' column for any spec changes, to avoid any auto-increment mysql errors
-          if ($civiTableSpecs[$col]['DATA_TYPE'] != CRM_Utils_Array::value('DATA_TYPE', $logTableSpecs[$col])
+          if ($civiTableSpecs[$col]['DATA_TYPE'] != ($logTableSpecs[$col]['DATA_TYPE'] ?? NULL)
             // We won't alter the log if the length is decreased in case some of the existing data won't fit.
             || CRM_Utils_Array::value('LENGTH', $civiTableSpecs[$col]) > CRM_Utils_Array::value('LENGTH', $logTableSpecs[$col])
           ) {
@@ -730,12 +730,12 @@ WHERE  table_schema IN ('{$this->db}', '{$civiDB}')";
             $diff['MODIFY'][] = $col;
           }
           elseif ($civiTableSpecs[$col]['DATA_TYPE'] === 'enum' &&
-            CRM_Utils_Array::value('ENUM_VALUES', $civiTableSpecs[$col]) != CRM_Utils_Array::value('ENUM_VALUES', $logTableSpecs[$col])
+            ($civiTableSpecs[$col]['ENUM_VALUES'] ?? NULL) != ($logTableSpecs[$col]['ENUM_VALUES'] ?? NULL)
           ) {
             // column is enum and the permitted values have changed
             $diff['MODIFY'][] = $col;
           }
-          elseif ($civiTableSpecs[$col]['IS_NULLABLE'] != CRM_Utils_Array::value('IS_NULLABLE', $logTableSpecs[$col]) &&
+          elseif ($civiTableSpecs[$col]['IS_NULLABLE'] != ($logTableSpecs[$col]['IS_NULLABLE'] ?? NULL) &&
             $logTableSpecs[$col]['IS_NULLABLE'] === 'NO'
           ) {
             // if is-null property is different, and log table's column is NOT-NULL, surely consider the column
index 53711f255e04dd2be0b08f5e70a92957c2632953..b5b39aadb2ed9eb96be26b651a82bc555d73ecbe 100644 (file)
@@ -164,7 +164,7 @@ class CRM_PCP_Page_PCPInfo extends CRM_Core_Page {
         'pageComponent' => $this->_component,
       ];
 
-      if (!$pcpBlock->is_tellfriend_enabled || CRM_Utils_Array::value('status_id', $pcpInfo) != $approvedId) {
+      if (!$pcpBlock->is_tellfriend_enabled || ($pcpInfo['status_id'] ?? NULL) != $approvedId) {
         unset($link['all'][CRM_Core_Action::DETACH]);
       }
 
index 5572b70c4cfae03d96ee4b5f1c1f2525cc7a8344..eebec8fca5dcb6b13f33eeb77f14fbd91078d724 100644 (file)
@@ -310,7 +310,7 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form {
       $this->assign('eachPaymentAmount', $eachPaymentAmount);
     }
 
-    if (CRM_Utils_Array::value('status_id', $this->_values) !=
+    if (($this->_values['status_id'] ?? NULL) !=
       CRM_Core_PseudoConstant::getKey('CRM_Pledge_BAO_Pledge', 'status_id', 'Cancelled')
     ) {
 
index 040587ba0c58418afaebc260875678e34f1bea82..13e86eef239b29ba46f34ba9724a1c1ede96c148 100644 (file)
@@ -639,7 +639,7 @@ class CRM_Profile_Form extends CRM_Core_Form {
         if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($name)) {
           $htmlType = $field['html_type'];
           if ((!isset($this->_defaults[$name]) || $htmlType == 'File') &&
-            (CRM_Utils_Array::value('field_type', $field) != 'Activity')
+            (($field['field_type'] ?? NULL) != 'Activity')
           ) {
             CRM_Core_BAO_CustomField::setProfileDefaults($customFieldID,
               $name,
index 22c92527f300afd0bb25551a492289a9d595f884..cbb5d165312a10e85d70f991fd500695711a6a7a 100644 (file)
@@ -3462,7 +3462,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
         foreach ($table['filters'] as $fieldName => $field) {
           if ((CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE ||
               CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_TIME) &&
-            CRM_Utils_Array::value('operatorType', $field) !=
+            ($field['operatorType'] ?? NULL) !=
             CRM_Report_Form::OP_MONTH
           ) {
             $from = $this->_params["{$fieldName}_from"] ?? NULL;
index f7a0dbfaeca9fa86f77d68c088f176767cbca26d..65a4dc05a6f8e0eeffec759cdf4a26309e2388f4 100644 (file)
@@ -479,7 +479,7 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form {
 
     // Stats for soft credits
     if ($this->_softFrom &&
-      CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) !=
+      ($this->_params['contribution_or_soft_value'] ?? NULL) !=
       'contributions_only'
     ) {
       $totalAmount = $average = [];
index dfb87568a0fbc41b543cdeeb4a2c82e46143063f..ecd39427156b44c8c8cff1e6bcbfc89005f11ae8 100644 (file)
@@ -256,7 +256,7 @@ class CRM_Report_Form_Instance {
 
       // CRM-17310 private reports option.
       $defaults['add_to_my_reports'] = 0;
-      if (CRM_Utils_Array::value('owner_id', $defaults) != NULL) {
+      if (($defaults['owner_id'] ?? NULL) != NULL) {
         $defaults['add_to_my_reports'] = 1;
       }
 
index 4bfb3ff7a59f80d6da29b0198d967a5d6e3cbdbe..dffad119a0dd788939d43ce56087bb981fa3ea73 100644 (file)
@@ -647,7 +647,7 @@ class CRM_UF_Form_Field extends CRM_Core_Form {
       $params = ['id' => $customField->custom_group_id];
       $customGroup = [];
       CRM_Core_BAO_CustomGroup::retrieve($params, $customGroup);
-      if (($fieldType != CRM_Utils_Array::value('extends', $customGroup)) || empty($customGroup['extends_entity_column_value'])) {
+      if (($fieldType != ($customGroup['extends'] ?? NULL)) || empty($customGroup['extends_entity_column_value'])) {
         return $errors;
       }
 
index fff3068e8bbe7f80e872c752506b8c730a2811e9..0159874e7ddc41d10998d4caff4a6adaff2203cd 100644 (file)
@@ -83,10 +83,10 @@ class CRM_Utils_Date {
     $date['d'] = sprintf('%02d', $date['d']);
 
     $time = '';
-    if (CRM_Utils_Array::value('H', $date) != NULL ||
-      CRM_Utils_Array::value('h', $date) != NULL ||
-      CRM_Utils_Array::value('i', $date) != NULL ||
-      CRM_Utils_Array::value('s', $date) != NULL
+    if (!empty($date['H']) ||
+      !empty($date['h']) ||
+      !empty($date['i']) ||
+      !empty($date['s'])
     ) {
       // we have time too..
       if (!empty($date['h'])) {
index d0c7a1d557122ebe939fcf51c8771f4f3663d6d2..8f7a2bdf4a65c81d4f9bb1811618932a94d4ac91 100644 (file)
@@ -182,7 +182,7 @@ class CRM_Utils_Pager extends Pager_Sliding {
     // else if a value is set that has higher priority and finally the GET var
     $currentPage = $defaultPageId;
     if (!empty($_POST)) {
-      if (isset($_POST[CRM_Utils_Array::value('buttonTop', $params)]) && isset($_POST[self::PAGE_ID])) {
+      if (isset($_POST[$params['buttonTop']]) && isset($_POST[self::PAGE_ID])) {
         $currentPage = max((int ) @$_POST[self::PAGE_ID], 1);
       }
       elseif (isset($_POST[$params['buttonBottom']]) && isset($_POST[self::PAGE_ID_BOTTOM])) {