CRM/Report - Cleanup bitwise conditionals using CRM_Utils_Array
authorcolemanw <coleman@civicrm.org>
Mon, 28 Aug 2023 16:23:02 +0000 (12:23 -0400)
committercolemanw <coleman@civicrm.org>
Mon, 28 Aug 2023 16:23:02 +0000 (12:23 -0400)
25 files changed:
CRM/Report/Form.php
CRM/Report/Form/Activity.php
CRM/Report/Form/ActivitySummary.php
CRM/Report/Form/Campaign/SurveyDetails.php
CRM/Report/Form/Case/Detail.php
CRM/Report/Form/Case/TimeSpent.php
CRM/Report/Form/Contact/CurrentEmployer.php
CRM/Report/Form/Contact/Detail.php
CRM/Report/Form/Contact/Log.php
CRM/Report/Form/Contact/Relationship.php
CRM/Report/Form/Contribute/DeferredRevenue.php
CRM/Report/Form/Contribute/History.php
CRM/Report/Form/Contribute/HouseholdSummary.php
CRM/Report/Form/Contribute/OrganizationSummary.php
CRM/Report/Form/Contribute/PCP.php
CRM/Report/Form/Contribute/Repeat.php
CRM/Report/Form/Contribute/Sybunt.php
CRM/Report/Form/Contribute/TopDonor.php
CRM/Report/Form/Event/IncomeCountSummary.php
CRM/Report/Form/Event/Summary.php
CRM/Report/Form/Mailing/Bounce.php
CRM/Report/Form/Mailing/Summary.php
CRM/Report/Form/Pledge/Detail.php
CRM/Report/Form/Pledge/Summary.php
CRM/Report/Utils/Report.php

index 5078254988e6b3f7d161d80e3420cbffb88a01bb..29f0a4dad8972f178f98c4c2cb0998fe0da5d76c 100644 (file)
@@ -1026,7 +1026,7 @@ class CRM_Report_Form extends CRM_Core_Form {
       if (array_key_exists('filters', $table)) {
         foreach ($table['filters'] as $fieldName => $field) {
           if (isset($field['default'])) {
-            if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE
+            if (($field['type'] ?? 0) & CRM_Utils_Type::T_DATE
             ) {
               if (is_array($field['default'])) {
                 $this->_defaults["{$fieldName}_from"] = $field['default']['from'] ?? NULL;
@@ -6066,7 +6066,7 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a
    *   Relevant where clause.
    */
   protected function generateFilterClause($field, $fieldName) {
-    if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
+    if (($field['type'] ?? 0) & CRM_Utils_Type::T_DATE) {
       if (($field['operatorType'] ?? NULL) ==
         CRM_Report_Form::OP_MONTH
       ) {
index 17eda67bf1390a7d909eeb0310690b2d34144a3e..395a9e863c80be57b10668a12ea3b38ad1860e7e 100644 (file)
@@ -544,7 +544,7 @@ class CRM_Report_Form_Activity extends CRM_Report_Form {
           ) {
             continue;
           }
-          if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
+          if (($field['type'] ?? 0) & CRM_Utils_Type::T_DATE) {
             $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
             $from = $this->_params["{$fieldName}_from"] ?? NULL;
             $to = $this->_params["{$fieldName}_to"] ?? NULL;
index d66b710d7a496b44c0dfe5b235e06bbfaaa2a960..d61beb941feee6f0af61173e35cbc05a6a6619ea 100644 (file)
@@ -363,7 +363,7 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form {
 
         foreach ($table['filters'] as $fieldName => $field) {
           $clause = NULL;
-          if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
+          if (($field['type'] ?? 0) & CRM_Utils_Type::T_DATE) {
             $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
             $from = $this->_params["{$fieldName}_from"] ?? NULL;
             $to = $this->_params["{$fieldName}_to"] ?? NULL;
index cd5f64153c7de111ce8e9d1089cc0126afc43d61..0f8cc4fc343f81284e016966f0fc2e3aa2b29050 100644 (file)
@@ -306,7 +306,7 @@ class CRM_Report_Form_Campaign_SurveyDetails extends CRM_Report_Form {
         foreach ($table['filters'] as $fieldName => $field) {
           $clause = NULL;
 
-          if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
+          if (($field['type'] ?? 0) & CRM_Utils_Type::T_DATE) {
             $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
             $from = $this->_params["{$fieldName}_from"] ?? NULL;
             $to = $this->_params["{$fieldName}_to"] ?? NULL;
index 6d89b22e742eb570792c9f85425fdd269253657a..f6307b1656094b14c23dcec4aa4fb3663cce7892 100644 (file)
@@ -428,7 +428,7 @@ class CRM_Report_Form_Case_Detail extends CRM_Report_Form {
         foreach ($table['filters'] as $fieldName => $field) {
           $clause = NULL;
 
-          if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
+          if (($field['type'] ?? 0) & CRM_Utils_Type::T_DATE) {
             $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
             $from = $this->_params["{$fieldName}_from"] ?? NULL;
             $to = $this->_params["{$fieldName}_to"] ?? NULL;
index 25a4eaded29d602517f7bc39854d59a3934196a4..432bf8d7061b22ce96c965feebddd7196d2f4c99 100644 (file)
@@ -239,7 +239,7 @@ class CRM_Report_Form_Case_TimeSpent extends CRM_Report_Form {
 
         foreach ($table['filters'] as $fieldName => $field) {
           $clause = NULL;
-          if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
+          if (($field['type'] ?? 0) & CRM_Utils_Type::T_DATE) {
             $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
             $from = $this->_params["{$fieldName}_from"] ?? NULL;
             $to = $this->_params["{$fieldName}_to"] ?? NULL;
index 7ad996b7a7ce68575eeef3fe657fb306d8a4c717..be2d0ef48cb25612217eab553a375fd4fd58602d 100644 (file)
@@ -236,7 +236,7 @@ FROM civicrm_contact {$this->_aliases['civicrm_contact']}
       if (array_key_exists('filters', $table)) {
         foreach ($table['filters'] as $fieldName => $field) {
           $clause = NULL;
-          if (CRM_Utils_Array::value('operatorType', $field) & CRM_Report_Form::OP_DATE
+          if (($field['operatorType'] ?? 0) & CRM_Report_Form::OP_DATE
           ) {
             $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
             $from = $this->_params["{$fieldName}_from"] ?? NULL;
index 0d82c2b2c1b8240ba1bd9ad96c43d3c105042557..0af2b5fcbf454e47cc3e8fe5cc3bd6ea2bedf65d 100644 (file)
@@ -599,7 +599,7 @@ HERESQL;
       if (array_key_exists('filters', $table)) {
         foreach ($table['filters'] as $fieldName => $field) {
           $clause = NULL;
-          if (CRM_Utils_Array::value('operatorType', $field) & CRM_Report_Form::OP_DATE
+          if (($field['operatorType'] ?? 0) & CRM_Report_Form::OP_DATE
           ) {
             $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
             $from = $this->_params["{$fieldName}_from"] ?? NULL;
index a7bfc26a765c7721e232bf7f04caab48ec085c52..65589629d73f35b2b3fd88f731a59634ae52fc3e 100644 (file)
@@ -181,7 +181,7 @@ class CRM_Report_Form_Contact_Log extends CRM_Report_Form {
       if (array_key_exists('filters', $table)) {
         foreach ($table['filters'] as $fieldName => $field) {
           $clause = NULL;
-          if (CRM_Utils_Array::value('operatorType', $field) & CRM_Report_Form::OP_DATE
+          if (($field['operatorType'] ?? 0) & CRM_Report_Form::OP_DATE
           ) {
             $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
             $from = $this->_params["{$fieldName}_from"] ?? NULL;
index 8707e371f1534bfa41440e92c77cf948329ad729..4cc4512c716d8adc22535ca8d4d9343e7ce2de9e 100644 (file)
@@ -443,7 +443,7 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form {
         foreach ($table['filters'] as $fieldName => $field) {
 
           $clause = NULL;
-          if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
+          if (($field['type'] ?? 0) & CRM_Utils_Type::T_DATE) {
             $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
             $from = $this->_params["{$fieldName}_from"] ?? NULL;
             $to = $this->_params["{$fieldName}_to"] ?? NULL;
index 5dc5634f6acaf3c92312a08ca629949f74f45ace..f76b8292e0c7cebf29d9d711b730c381581fdfa5 100644 (file)
@@ -448,10 +448,10 @@ class CRM_Report_Form_Contribute_DeferredRevenue extends CRM_Report_Form {
         $arraykey = $dao->civicrm_financial_account_id . '_' . $dao->civicrm_financial_account_1_id;
 
         if (property_exists($dao, $key)) {
-          if (CRM_Utils_Array::value('type', $value) & CRM_Utils_Type::T_DATE) {
+          if (($value['type'] ?? 0) & CRM_Utils_Type::T_DATE) {
             $row[$key] = CRM_Utils_Date::customFormat($dao->$key, $dateFormat);
           }
-          elseif (CRM_Utils_Array::value('type', $value) & CRM_Utils_Type::T_MONEY) {
+          elseif (($value['type'] ?? 0) & CRM_Utils_Type::T_MONEY) {
             $values = [];
             foreach (explode(',', $dao->$key) as $moneyValue) {
               $values[] = CRM_Utils_Money::format($moneyValue);
index 900454e192d7168b2be19dd63c6354d647d6e5ac..fb2141aa221f8660acf2e5d85f78f3f0d427c1e9 100644 (file)
@@ -411,7 +411,7 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form {
           if ($fieldName == 'this_year' || $fieldName == 'other_year') {
             continue;
           }
-          elseif (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE
+          elseif (($field['type'] ?? 0) & CRM_Utils_Type::T_DATE
           ) {
             $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
             $from = $this->_params["{$fieldName}_from"] ?? NULL;
index 9d08b36e529e8bf1f73e98d6b87db49fc850f416..474ce68efcfb36d2f0b822967398b5aea003e316 100644 (file)
@@ -258,7 +258,7 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form {
       if (array_key_exists('filters', $table)) {
         foreach ($table['filters'] as $fieldName => $field) {
           $clause = NULL;
-          if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
+          if (($field['type'] ?? 0) & CRM_Utils_Type::T_DATE) {
             $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
             $from = $this->_params["{$fieldName}_from"] ?? NULL;
             $to = $this->_params["{$fieldName}_to"] ?? NULL;
index c6ac398258ddf848ee31ed53542d34b646e63e98..109eb68841b20438a33f97d03b7c9615dad923c0 100644 (file)
@@ -275,7 +275,7 @@ class CRM_Report_Form_Contribute_OrganizationSummary extends CRM_Report_Form {
       if (array_key_exists('filters', $table)) {
         foreach ($table['filters'] as $fieldName => $field) {
           $clause = NULL;
-          if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
+          if (($field['type'] ?? 0) & CRM_Utils_Type::T_DATE) {
             $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
             $from = $this->_params["{$fieldName}_from"] ?? NULL;
             $to = $this->_params["{$fieldName}_to"] ?? NULL;
index 37edb4eedc78a067c217b922be020753ce4a6415..f3effc38a379bc56b45413d059424cb31d354ea0 100644 (file)
@@ -247,7 +247,7 @@ LEFT JOIN civicrm_event {$this->_aliases['civicrm_event']}
         foreach ($table['filters'] as $fieldName => $field) {
           $clause = NULL;
 
-          if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
+          if (($field['type'] ?? 0) & CRM_Utils_Type::T_DATE) {
             $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
             $from = $this->_params["{$fieldName}_from"] ?? NULL;
             $to = $this->_params["{$fieldName}_to"] ?? NULL;
index f8be583a376198b6405dda8140cba87e9910b780..f5e33a14ef45a01c27fcc487eb40e42ecc6c3d84 100644 (file)
@@ -395,7 +395,7 @@ LEFT JOIN $this->tempTableRepeat2 {$this->_aliases['civicrm_contribution']}2
 
     foreach ($this->_columns['civicrm_contribution']['filters'] as $fieldName => $field) {
       $clause = NULL;
-      if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
+      if (($field['type'] ?? 0) & CRM_Utils_Type::T_DATE) {
         $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
         $from = $this->_params["{$fieldName}_from"] ?? NULL;
         $to = $this->_params["{$fieldName}_to"] ?? NULL;
index 5bad43bde2847f5888d92e7702b4519af746be33..ed9a2080a1c3d93e1ca2e3aa9118cef6fe2b0a45 100644 (file)
@@ -355,7 +355,7 @@ class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form {
               self::fiscalYearOffset('contri.receive_date') .
               " = {$this->_params['yid_value']} AND contri.is_test = 0 AND contri.is_template = 0 )";
           }
-          elseif (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE
+          elseif (($field['type'] ?? 0) & CRM_Utils_Type::T_DATE
           ) {
             $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
             $from = $this->_params["{$fieldName}_from"] ?? NULL;
index 7666485e9c75c80b20c00f856f4bd27ad58a9146..0dcff4a211c291636d66cd1ed755a46879099d58 100644 (file)
@@ -252,7 +252,7 @@ class CRM_Report_Form_Contribute_TopDonor extends CRM_Report_Form {
       if (array_key_exists('filters', $table)) {
         foreach ($table['filters'] as $fieldName => $field) {
           $clause = NULL;
-          if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
+          if (($field['type'] ?? 0) & CRM_Utils_Type::T_DATE) {
             $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
             $from = $this->_params["{$fieldName}_from"] ?? NULL;
             $to = $this->_params["{$fieldName}_to"] ?? NULL;
index b440dacbe17f8b95303f7e33114a3c83256767d8..e42e0036fa1cbacf144d79d7dd45ff8e57cba87f 100644 (file)
@@ -204,7 +204,7 @@ class CRM_Report_Form_Event_IncomeCountSummary extends CRM_Report_Form {
       if (array_key_exists('filters', $table)) {
         foreach ($table['filters'] as $fieldName => $field) {
           $clause = NULL;
-          if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
+          if (($field['type'] ?? 0) & CRM_Utils_Type::T_DATE) {
             $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
             $from = $this->_params["{$fieldName}_from"] ?? NULL;
             $to = $this->_params["{$fieldName}_to"] ?? NULL;
index edb3b0776a0f6dad6cab7ad8272d595fcbeff5c9..ca86340dcd82577f4dc0d66927b69962dfe162e2 100644 (file)
@@ -143,7 +143,7 @@ class CRM_Report_Form_Event_Summary extends CRM_Report_Form {
       if (array_key_exists('filters', $table)) {
         foreach ($table['filters'] as $fieldName => $field) {
           $clause = NULL;
-          if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
+          if (($field['type'] ?? 0) & CRM_Utils_Type::T_DATE) {
             $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
             $from = $this->_params["{$fieldName}_from"] ?? NULL;
             $to = $this->_params["{$fieldName}_to"] ?? NULL;
index 45f23d00cae3bb33f4a48feb05c0e57a4c79be95..ebe9d1a846446d65e049596d47d6bebcba85113c 100644 (file)
@@ -336,7 +336,7 @@ class CRM_Report_Form_Mailing_Bounce extends CRM_Report_Form {
       if (array_key_exists('filters', $table)) {
         foreach ($table['filters'] as $fieldName => $field) {
           $clause = NULL;
-          if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
+          if (($field['type'] ?? 0) & CRM_Utils_Type::T_DATE) {
             $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
             $from = $this->_params["{$fieldName}_from"] ?? NULL;
             $to = $this->_params["{$fieldName}_to"] ?? NULL;
index 61a6424aae4a339b5e6fcb01b3685847b90b22b3..d2e4e61942a3366d63e572231aa87738a48411b5 100644 (file)
@@ -419,7 +419,7 @@ class CRM_Report_Form_Mailing_Summary extends CRM_Report_Form {
       if (array_key_exists('filters', $table)) {
         foreach ($table['filters'] as $fieldName => $field) {
           $clause = NULL;
-          if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
+          if (($field['type'] ?? 0) & CRM_Utils_Type::T_DATE) {
             $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
             $from = $this->_params["{$fieldName}_from"] ?? NULL;
             $to = $this->_params["{$fieldName}_to"] ?? NULL;
index 21ca22a0367cb0ff96d3eee8de2bc358b7d57084..73ce3b67011df47776cd9e7fdd8cfd300f62849f 100644 (file)
@@ -330,7 +330,7 @@ class CRM_Report_Form_Pledge_Detail extends CRM_Report_Form {
       if (array_key_exists('filters', $table)) {
         foreach ($table['filters'] as $fieldName => $field) {
           $clause = NULL;
-          if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
+          if (($field['type'] ?? 0) & CRM_Utils_Type::T_DATE) {
             $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
             $from = $this->_params["{$fieldName}_from"] ?? NULL;
             $to = $this->_params["{$fieldName}_to"] ?? NULL;
index c49e7b5a7f302d46e0966f204db9982e73197271..e22300560f00cdcae63541b2e97d0f504f3509f2 100644 (file)
@@ -305,7 +305,7 @@ class CRM_Report_Form_Pledge_Summary extends CRM_Report_Form {
       if (array_key_exists('filters', $table)) {
         foreach ($table['filters'] as $fieldName => $field) {
           $clause = NULL;
-          if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
+          if (($field['type'] ?? 0) & CRM_Utils_Type::T_DATE) {
             $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
             $from = $this->_params["{$fieldName}_from"] ?? NULL;
             $to = $this->_params["{$fieldName}_to"] ?? NULL;
index beb1454f30575cbc15623b21a2e3d695b19089fb..2f91c687b88caf8d9e26b613a7d957c1613f3247 100644 (file)
@@ -253,7 +253,7 @@ WHERE  inst.report_id = %1";
           // Remove HTML, unencode entities, and escape quotation marks.
           $value = str_replace('"', '""', html_entity_decode(strip_tags($value), ENT_QUOTES | ENT_HTML401));
 
-          if (CRM_Utils_Array::value('type', $form->_columnHeaders[$v]) & 4) {
+          if (($form->_columnHeaders[$v]['type'] ?? 0) & 4) {
             if (($form->_columnHeaders[$v]['group_by'] ?? NULL) == 'MONTH' ||
               ($form->_columnHeaders[$v]['group_by'] ?? NULL) == 'QUARTER'
             ) {