(REF) Replace CRM_Utils_Array in context of is_numeric()
authorcolemanw <coleman@civicrm.org>
Sat, 22 Jul 2023 03:03:47 +0000 (20:03 -0700)
committerTim Otten <totten@civicrm.org>
Sat, 22 Jul 2023 03:33:38 +0000 (20:33 -0700)
CRM/Contact/BAO/ProximityQuery.php
CRM/Contact/Form/Contact.php
CRM/Contact/Selector.php
CRM/Core/BAO/Mapping.php
CRM/Event/BAO/Event.php
CRM/Member/Form/MembershipRenewal.php
CRM/Price/Form/Field.php
CRM/Profile/Selector/Listings.php
CRM/Report/Form/Mailing/Detail.php
api/v3/Generic.php
ext/legacycustomsearches/CRM/Contact/Form/Search/Custom/Proximity.php

index be583c0d2187ea494c118b3c559bbae2eb8d479e..0350d5a83ae726becd31b7b6f9b42d7502ca3d7a 100644 (file)
@@ -301,8 +301,8 @@ ACOS(
     }
 
     if (
-      !is_numeric(CRM_Utils_Array::value('geo_code_1', $proximityAddress)) ||
-      !is_numeric(CRM_Utils_Array::value('geo_code_2', $proximityAddress))
+      !is_numeric($proximityAddress['geo_code_1'] ?? '') ||
+      !is_numeric($proximityAddress['geo_code_2'] ?? '')
     ) {
       // we are setting the where clause to 0 here, so we wont return anything
       $qill .= ': ' . ts('We could not geocode the destination address.');
index 2b98c60f60a8be62781c468138c0c0118be4228c..a8411864e19484b9d7ac7beca5b293bdf648f11d 100644 (file)
@@ -890,7 +890,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
       CRM_Contact_BAO_Contact::processImageParams($params);
     }
 
-    if (is_numeric(CRM_Utils_Array::value('current_employer_id', $params)) && !empty($params['current_employer'])) {
+    if (is_numeric($params['current_employer_id'] ?? '') && !empty($params['current_employer'])) {
       $params['current_employer'] = $params['current_employer_id'];
     }
 
index e57cbbcb133e118559613f840deeb106301a05dd..8ad89811a2c4d667dfea960fee43b479b875a328 100644 (file)
@@ -809,7 +809,7 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se
             $result->contact_id
           );
         }
-        elseif ((is_numeric(CRM_Utils_Array::value('geo_code_1', $row))) ||
+        elseif ((is_numeric($row['geo_code_1'] ?? '')) ||
           (!empty($row['city']) && !empty($row['state_province']))
         ) {
           $row['action'] = CRM_Core_Action::formLink(
@@ -942,7 +942,7 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se
         $mask = CRM_Core_Action::mask(array_merge([CRM_Core_Permission::VIEW], $basicPermissions));
       }
 
-      if ((!is_numeric(CRM_Utils_Array::value('geo_code_1', $row))) &&
+      if ((!is_numeric($row['geo_code_1'] ?? '')) &&
         (empty($row['city']) || empty($row['state_province']))
       ) {
         $mask = $mask & 4095;
index 217767cd8ea6314b8518a2dab0b8169c0f613a05..583fa8de597da77a5a0cf3f854460cc79b7e6c5a 100644 (file)
@@ -483,14 +483,14 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping implements \Civi\Core\Ho
           $saveMappingFields['name'] = $v['4'] ?? NULL;
         }
 
-        if (is_numeric(CRM_Utils_Array::value('3', $v))) {
+        if (is_numeric($v['3'] ?? '')) {
           $locationTypeId = $v['3'] ?? NULL;
         }
-        elseif (is_numeric(CRM_Utils_Array::value('5', $v))) {
+        elseif (is_numeric($v['5'] ?? '')) {
           $locationTypeId = $v['5'] ?? NULL;
         }
 
-        if (is_numeric(CRM_Utils_Array::value('4', $v))) {
+        if (is_numeric($v['4'] ?? '')) {
           if ($saveMappingFields['name'] === 'im') {
             $saveMappingFields['im_provider_id'] = $v[4];
           }
@@ -498,7 +498,7 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping implements \Civi\Core\Ho
             $saveMappingFields['phone_type_id'] = $v['4'] ?? NULL;
           }
         }
-        elseif (is_numeric(CRM_Utils_Array::value('6', $v))) {
+        elseif (is_numeric($v['6'] ?? '')) {
           $saveMappingFields['phone_type_id'] = $v['6'] ?? NULL;
         }
 
index 3875bc5e04e3154bf425d5dfda1221cb869c2000..13c18b2f4acc323d664465a4a097a907418376f6 100644 (file)
@@ -470,7 +470,7 @@ $event_summary_limit
               $ids = [];
               $params = ['entity_id' => $dao->id, 'entity_table' => 'civicrm_event'];
               $values['location'] = CRM_Core_BAO_Location::getValues($params, TRUE);
-              if (is_numeric(CRM_Utils_Array::value('geo_code_1', $values['location']['address'][1])) ||
+              if (is_numeric($values['location']['address'][1]['geo_code_1'] ?? '') ||
                 (
                   !empty($values['location']['address'][1]['city']) &&
                   !empty($values['location']['address'][1]['state_province_id'])
index 2452991e3dc7079697c5ad4f9e5b7a72ba0c71c1..de109e6b7313056c0a89f9a46bb9eb4359eecadf 100644 (file)
@@ -567,7 +567,7 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form {
 
     // chk for renewal for multiple terms CRM-8750
     $numRenewTerms = 1;
-    if (is_numeric(CRM_Utils_Array::value('num_terms', $this->_params))) {
+    if (is_numeric($this->_params['num_terms'] ?? '')) {
       $numRenewTerms = $this->_params['num_terms'];
     }
 
index c9d05a25e3cce0f63a1711e00ac4d257f61b5b99..ad39c0decef562d6c9921bde070d69b846113da6 100644 (file)
@@ -427,7 +427,7 @@ class CRM_Price_Form_Field extends CRM_Core_Form {
       }
     }
 
-    if ((is_numeric(CRM_Utils_Array::value('count', $fields)) &&
+    if ((is_numeric($fields['count'] ?? '') &&
         empty($fields['count'])
       ) &&
       (($fields['html_type'] ?? NULL) == 'Text')
index 8a14a5bf4d4179dc72ac8706ea0d8987dd2315cd..dbec1ab1ac2edc478298ee0e554a879db656a122 100644 (file)
@@ -428,7 +428,7 @@ class CRM_Profile_Selector_Listings extends CRM_Core_Selector_Base implements CR
         $field = $vars[$key];
         $fieldArray = explode('-', $field['name']);
         $fieldType = $fieldArray['2'] ?? NULL;
-        if (is_numeric(CRM_Utils_Array::value('1', $fieldArray))) {
+        if (is_numeric($fieldArray['1'] ?? '')) {
           if (!in_array($fieldType, $multipleFields)) {
             $locationType = new CRM_Core_DAO_LocationType();
             $locationType->id = $fieldArray[1];
index 8426bd990707957880f3b4f321629ff1b5b7d67f..52df57c7a7d0a9f39746fdac5191743d4c8e65fc 100644 (file)
@@ -345,7 +345,7 @@ class CRM_Report_Form_Mailing_Detail extends CRM_Report_Form {
     }
 
     if (array_key_exists('reply_id', $this->_params['fields']) ||
-      is_numeric(CRM_Utils_Array::value('is_replied_value', $this->_params))
+      is_numeric($this->_params['is_replied_value'] ?? '')
     ) {
       if (($this->_params['is_replied_value'] ?? NULL) == 1) {
         $joinType = 'INNER';
@@ -363,7 +363,7 @@ class CRM_Report_Form_Mailing_Detail extends CRM_Report_Form {
     }
 
     if (array_key_exists('unsubscribe_id', $this->_params['fields']) ||
-      is_numeric(CRM_Utils_Array::value('is_unsubscribed_value', $this->_params))
+      is_numeric($this->_params['is_unsubscribed_value'] ?? '')
     ) {
       if (($this->_params['is_unsubscribed_value'] ?? NULL) == 1
       ) {
@@ -383,7 +383,7 @@ class CRM_Report_Form_Mailing_Detail extends CRM_Report_Form {
     }
 
     if (array_key_exists('optout_id', $this->_params['fields']) ||
-      is_numeric(CRM_Utils_Array::value('is_optout_value', $this->_params))
+      is_numeric($this->_params['is_optout_value'] ?? '')
     ) {
       if (($this->_params['is_optout_value'] ?? NULL) == 1) {
         $joinType = 'INNER';
@@ -402,7 +402,7 @@ class CRM_Report_Form_Mailing_Detail extends CRM_Report_Form {
     }
 
     if (array_key_exists('forward_id', $this->_params['fields']) ||
-      is_numeric(CRM_Utils_Array::value('is_forwarded_value', $this->_params))
+      is_numeric($this->_params['is_forwarded_value'] ?? '')
     ) {
       if (($this->_params['is_forwarded_value'] ?? NULL) == 1) {
         $joinType = 'INNER';
index 4310bd585bf890e7e6a3c406ca468b1bc463dc68..690ff54af4aed67ac0f8b62857f5302abde89c3c 100644 (file)
@@ -279,7 +279,7 @@ function _civicrm_api3_generic_getfield_spec(&$params, $apiRequest) {
 function civicrm_api3_generic_getcount($apiRequest) {
   $apiRequest['params']['options']['is_count'] = TRUE;
   $result = civicrm_api($apiRequest['entity'], 'get', $apiRequest['params']);
-  if (is_numeric(CRM_Utils_Array::value('values', $result))) {
+  if (is_numeric($result['values'] ?? '')) {
     return (int) $result['values'];
   }
   if (!isset($result['count'])) {
index d33c0731a4011cbf93fa6e3935d3a027daae82d8..5c7bdebcd648623a7f4e0fb7e5b22f70551738eb 100644 (file)
@@ -278,8 +278,8 @@ class CRM_Contact_Form_Search_Custom_Proximity extends CRM_Contact_Form_Search_C
   public function formRule($fields, $files, $self) {
     $this->addGeocodingData($fields);
 
-    if (!is_numeric(CRM_Utils_Array::value('geo_code_1', $fields)) ||
-      !is_numeric(CRM_Utils_Array::value('geo_code_2', $fields)) ||
+    if (!is_numeric($fields['geo_code_1'] ?? '') ||
+      !is_numeric($fields['geo_code_2'] ?? '') ||
       !isset($fields['distance'])
     ) {
       $errorMessage = ts('Could not determine co-ordinates for provided data');