(REF) Replace CRM_Utils_Array in more complex cases
authorcolemanw <coleman@civicrm.org>
Sat, 22 Jul 2023 03:32:02 +0000 (20:32 -0700)
committerTim Otten <totten@civicrm.org>
Sat, 22 Jul 2023 03:33:38 +0000 (20:33 -0700)
CRM/Campaign/Page/Petition/Confirm.php
CRM/Core/BAO/CustomValueTable.php
CRM/Report/Form.php
api/v3/Relationship.php

index ca31c36b0d00afffc9216f17ec907485c2f7823e..77d7d1d9c2d84d656078061f0f6f20fb2c4f8848 100644 (file)
@@ -58,10 +58,12 @@ class CRM_Campaign_Page_Petition_Confirm extends CRM_Core_Page {
     $pparams['id'] = $petition_id;
     $this->petition = [];
     CRM_Campaign_BAO_Survey::retrieve($pparams, $this->petition);
-    $this->assign('is_share', CRM_Utils_Array::value('is_share', $this->petition));
-    $this->assign('thankyou_title', CRM_Utils_Array::value('thankyou_title', $this->petition));
-    $this->assign('thankyou_text', CRM_Utils_Array::value('thankyou_text', $this->petition));
-    CRM_Utils_System::setTitle(CRM_Utils_Array::value('thankyou_title', $this->petition));
+    $this->assign('is_share', $this->petition['is_share'] ?? FALSE);
+    $this->assign('thankyou_title', $this->petition['thankyou_title'] ?? '');
+    $this->assign('thankyou_text', $this->petition['thankyou_text'] ?? '');
+    if (!empty($this->petition['thankyou_title'])) {
+      CRM_Utils_System::setTitle($this->petition['thankyou_title']);
+    }
 
     // send thank you email
     $params['contactId'] = $contact_id;
index 1b2c0003de4565c418350e64bbff419be5cc87d6..f2d7199d98d01275997342792364b5104863b34b 100644 (file)
@@ -249,7 +249,7 @@ class CRM_Core_BAO_CustomValueTable {
             || $fieldExtends === 'Organization'
             || $fieldExtends === 'Household'
           ) {
-            $paramFieldsExtendContactForEntities[$entityID]['custom_' . CRM_Utils_Array::value('custom_field_id', $field)] = $field['custom_field_id'] ?? NULL;
+            $paramFieldsExtendContactForEntities[$entityID]['custom_' . ($field['custom_field_id'] ?? '')] = $field['custom_field_id'] ?? NULL;
           }
         }
 
index 95b08b81de28af905e3081131fd7ab6d2255a6a8..33b3b96d94c9ce89c95b2e94209f4f04df6c2238 100644 (file)
@@ -3540,11 +3540,11 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
                 isset($field['options']) &&
                 is_array($field['options']) && !empty($field['options'])
               ) {
-                $value = CRM_Utils_Array::value($op, $pair) . " " .
+                $value = ($pair[$op] ?? '') . " " .
                   CRM_Utils_Array::value($val, $field['options'], $val);
               }
               elseif ($val || $val == '0') {
-                $value = CRM_Utils_Array::value($op, $pair) . " " . $val;
+                $value = ($pair[$op] ?? '') . " " . $val;
               }
             }
             if ($value && empty($field['no_display'])) {
@@ -3648,7 +3648,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
    */
   public function compileContent() {
     $templateFile = $this->getHookedTemplateFileName();
-    return CRM_Utils_Array::value('report_header', $this->_formValues) .
+    return ($this->_formValues['report_header'] ?? '') .
     CRM_Core_Form::$_template->fetch($templateFile) .
     CRM_Utils_Array::value('report_footer', $this->_formValues);
   }
index 0c4251254faccca2f730dffafc0af387e6016df9..f79b26c645011d6b7365523d41f9439278b2ca8d 100644 (file)
@@ -87,10 +87,10 @@ function civicrm_api3_relationship_get($params) {
   }
   else {
     $relationships = CRM_Contact_BAO_Relationship::getRelationship($params['contact_id'],
-      CRM_Utils_Array::value('status_id', $params),
+      $params['status_id'] ?? 0,
       0,
-      CRM_Utils_Array::value('is_count', $options),
-      CRM_Utils_Array::value('id', $params),
+      $options['is_count'] ?? 0,
+      $params['id'] ?? 0,
       NULL,
       NULL,
       FALSE,