From: colemanw Date: Mon, 28 Aug 2023 16:23:02 +0000 (-0400) Subject: CRM/Report - Cleanup bitwise conditionals using CRM_Utils_Array X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=fdf51a51e7e440f3d798643f8b6bf8c8182056d5;p=civicrm-core.git CRM/Report - Cleanup bitwise conditionals using CRM_Utils_Array --- diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php index 5078254988..29f0a4dad8 100644 --- a/CRM/Report/Form.php +++ b/CRM/Report/Form.php @@ -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 ) { diff --git a/CRM/Report/Form/Activity.php b/CRM/Report/Form/Activity.php index 17eda67bf1..395a9e863c 100644 --- a/CRM/Report/Form/Activity.php +++ b/CRM/Report/Form/Activity.php @@ -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; diff --git a/CRM/Report/Form/ActivitySummary.php b/CRM/Report/Form/ActivitySummary.php index d66b710d7a..d61beb941f 100644 --- a/CRM/Report/Form/ActivitySummary.php +++ b/CRM/Report/Form/ActivitySummary.php @@ -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; diff --git a/CRM/Report/Form/Campaign/SurveyDetails.php b/CRM/Report/Form/Campaign/SurveyDetails.php index cd5f64153c..0f8cc4fc34 100644 --- a/CRM/Report/Form/Campaign/SurveyDetails.php +++ b/CRM/Report/Form/Campaign/SurveyDetails.php @@ -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; diff --git a/CRM/Report/Form/Case/Detail.php b/CRM/Report/Form/Case/Detail.php index 6d89b22e74..f6307b1656 100644 --- a/CRM/Report/Form/Case/Detail.php +++ b/CRM/Report/Form/Case/Detail.php @@ -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; diff --git a/CRM/Report/Form/Case/TimeSpent.php b/CRM/Report/Form/Case/TimeSpent.php index 25a4eaded2..432bf8d706 100644 --- a/CRM/Report/Form/Case/TimeSpent.php +++ b/CRM/Report/Form/Case/TimeSpent.php @@ -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; diff --git a/CRM/Report/Form/Contact/CurrentEmployer.php b/CRM/Report/Form/Contact/CurrentEmployer.php index 7ad996b7a7..be2d0ef48c 100644 --- a/CRM/Report/Form/Contact/CurrentEmployer.php +++ b/CRM/Report/Form/Contact/CurrentEmployer.php @@ -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; diff --git a/CRM/Report/Form/Contact/Detail.php b/CRM/Report/Form/Contact/Detail.php index 0d82c2b2c1..0af2b5fcbf 100644 --- a/CRM/Report/Form/Contact/Detail.php +++ b/CRM/Report/Form/Contact/Detail.php @@ -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; diff --git a/CRM/Report/Form/Contact/Log.php b/CRM/Report/Form/Contact/Log.php index a7bfc26a76..65589629d7 100644 --- a/CRM/Report/Form/Contact/Log.php +++ b/CRM/Report/Form/Contact/Log.php @@ -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; diff --git a/CRM/Report/Form/Contact/Relationship.php b/CRM/Report/Form/Contact/Relationship.php index 8707e371f1..4cc4512c71 100644 --- a/CRM/Report/Form/Contact/Relationship.php +++ b/CRM/Report/Form/Contact/Relationship.php @@ -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; diff --git a/CRM/Report/Form/Contribute/DeferredRevenue.php b/CRM/Report/Form/Contribute/DeferredRevenue.php index 5dc5634f6a..f76b8292e0 100644 --- a/CRM/Report/Form/Contribute/DeferredRevenue.php +++ b/CRM/Report/Form/Contribute/DeferredRevenue.php @@ -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); diff --git a/CRM/Report/Form/Contribute/History.php b/CRM/Report/Form/Contribute/History.php index 900454e192..fb2141aa22 100644 --- a/CRM/Report/Form/Contribute/History.php +++ b/CRM/Report/Form/Contribute/History.php @@ -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; diff --git a/CRM/Report/Form/Contribute/HouseholdSummary.php b/CRM/Report/Form/Contribute/HouseholdSummary.php index 9d08b36e52..474ce68efc 100644 --- a/CRM/Report/Form/Contribute/HouseholdSummary.php +++ b/CRM/Report/Form/Contribute/HouseholdSummary.php @@ -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; diff --git a/CRM/Report/Form/Contribute/OrganizationSummary.php b/CRM/Report/Form/Contribute/OrganizationSummary.php index c6ac398258..109eb68841 100644 --- a/CRM/Report/Form/Contribute/OrganizationSummary.php +++ b/CRM/Report/Form/Contribute/OrganizationSummary.php @@ -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; diff --git a/CRM/Report/Form/Contribute/PCP.php b/CRM/Report/Form/Contribute/PCP.php index 37edb4eedc..f3effc38a3 100644 --- a/CRM/Report/Form/Contribute/PCP.php +++ b/CRM/Report/Form/Contribute/PCP.php @@ -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; diff --git a/CRM/Report/Form/Contribute/Repeat.php b/CRM/Report/Form/Contribute/Repeat.php index f8be583a37..f5e33a14ef 100644 --- a/CRM/Report/Form/Contribute/Repeat.php +++ b/CRM/Report/Form/Contribute/Repeat.php @@ -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; diff --git a/CRM/Report/Form/Contribute/Sybunt.php b/CRM/Report/Form/Contribute/Sybunt.php index 5bad43bde2..ed9a2080a1 100644 --- a/CRM/Report/Form/Contribute/Sybunt.php +++ b/CRM/Report/Form/Contribute/Sybunt.php @@ -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; diff --git a/CRM/Report/Form/Contribute/TopDonor.php b/CRM/Report/Form/Contribute/TopDonor.php index 7666485e9c..0dcff4a211 100644 --- a/CRM/Report/Form/Contribute/TopDonor.php +++ b/CRM/Report/Form/Contribute/TopDonor.php @@ -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; diff --git a/CRM/Report/Form/Event/IncomeCountSummary.php b/CRM/Report/Form/Event/IncomeCountSummary.php index b440dacbe1..e42e0036fa 100644 --- a/CRM/Report/Form/Event/IncomeCountSummary.php +++ b/CRM/Report/Form/Event/IncomeCountSummary.php @@ -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; diff --git a/CRM/Report/Form/Event/Summary.php b/CRM/Report/Form/Event/Summary.php index edb3b0776a..ca86340dcd 100644 --- a/CRM/Report/Form/Event/Summary.php +++ b/CRM/Report/Form/Event/Summary.php @@ -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; diff --git a/CRM/Report/Form/Mailing/Bounce.php b/CRM/Report/Form/Mailing/Bounce.php index 45f23d00ca..ebe9d1a846 100644 --- a/CRM/Report/Form/Mailing/Bounce.php +++ b/CRM/Report/Form/Mailing/Bounce.php @@ -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; diff --git a/CRM/Report/Form/Mailing/Summary.php b/CRM/Report/Form/Mailing/Summary.php index 61a6424aae..d2e4e61942 100644 --- a/CRM/Report/Form/Mailing/Summary.php +++ b/CRM/Report/Form/Mailing/Summary.php @@ -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; diff --git a/CRM/Report/Form/Pledge/Detail.php b/CRM/Report/Form/Pledge/Detail.php index 21ca22a036..73ce3b6701 100644 --- a/CRM/Report/Form/Pledge/Detail.php +++ b/CRM/Report/Form/Pledge/Detail.php @@ -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; diff --git a/CRM/Report/Form/Pledge/Summary.php b/CRM/Report/Form/Pledge/Summary.php index c49e7b5a7f..e22300560f 100644 --- a/CRM/Report/Form/Pledge/Summary.php +++ b/CRM/Report/Form/Pledge/Summary.php @@ -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; diff --git a/CRM/Report/Utils/Report.php b/CRM/Report/Utils/Report.php index beb1454f30..2f91c687b8 100644 --- a/CRM/Report/Utils/Report.php +++ b/CRM/Report/Utils/Report.php @@ -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' ) {