Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REF] CRM/Report - Refactor out uses of deprecated CRM_Utils_Array::value #32047

Merged
merged 1 commit into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions CRM/Report/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -5145,7 +5145,7 @@ protected function setOutputMode() {
'String',
CRM_Core_DAO::$_nullObject,
FALSE,
CRM_Utils_Array::value('task', $this->_params)
$this->_params['task'] ?? NULL
) ?? ''));
// if contacts are added to group
if (!empty($this->_params['groups']) && empty($this->_outputMode)) {
Expand Down Expand Up @@ -6052,9 +6052,9 @@ protected function generateFilterClause($field, $fieldName) {
if ($op) {
return $this->whereClause($field,
$op,
CRM_Utils_Array::value("{$fieldName}_value", $this->_params),
CRM_Utils_Array::value("{$fieldName}_min", $this->_params),
CRM_Utils_Array::value("{$fieldName}_max", $this->_params)
$this->_params["{$fieldName}_value"] ?? NULL,
$this->_params["{$fieldName}_min"] ?? NULL,
$this->_params["{$fieldName}_max"] ?? NULL
);
}
}
Expand Down
8 changes: 4 additions & 4 deletions CRM/Report/Form/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -617,9 +617,9 @@ public function where($recordType = NULL) {
if ($op && !($fieldName === "contact_{$recordType}" && ($op === 'nnll' || $op === 'nll'))) {
$clause = $this->whereClause($field,
$op,
CRM_Utils_Array::value("{$fieldName}_value", $this->_params),
CRM_Utils_Array::value("{$fieldName}_min", $this->_params),
CRM_Utils_Array::value("{$fieldName}_max", $this->_params)
$this->_params["{$fieldName}_value"] ?? NULL,
$this->_params["{$fieldName}_min"] ?? NULL,
$this->_params["{$fieldName}_max"] ?? NULL
);
if ($field['name'] == 'include_case_activities') {
$clause = NULL;
Expand Down Expand Up @@ -964,7 +964,7 @@ public function alterDisplay(&$rows) {
if (empty($this->_params['include_case_activities_value']) || empty($rows[$rowNum]['civicrm_case_activity_case_id'])) {
// Generate a "view activity" link
$actActionLinks = CRM_Activity_Selector_Activity::actionLinks($row['civicrm_activity_activity_type_id'],
CRM_Utils_Array::value('civicrm_activity_source_record_id', $rows[$rowNum]),
$rows[$rowNum]['civicrm_activity_source_record_id'] ?? NULL,
FALSE,
$rows[$rowNum]['civicrm_activity_id']
);
Expand Down
12 changes: 6 additions & 6 deletions CRM/Report/Form/ActivitySummary.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,9 @@ public function where($durationMode = FALSE) {
if ($op) {
$clause = $this->whereClause($field,
$op,
CRM_Utils_Array::value("{$fieldName}_value", $this->_params),
CRM_Utils_Array::value("{$fieldName}_min", $this->_params),
CRM_Utils_Array::value("{$fieldName}_max", $this->_params)
$this->_params["{$fieldName}_value"] ?? NULL,
$this->_params["{$fieldName}_min"] ?? NULL,
$this->_params["{$fieldName}_max"] ?? NULL
);
}
}
Expand Down Expand Up @@ -686,9 +686,9 @@ public function alterDisplay(&$rows) {
if (!empty($this->_params['activity_date_time_' . $suffix])) {
list($from, $to)
= $this->getFromTo(
CRM_Utils_Array::value("activity_date_time_relative", $this->_params),
CRM_Utils_Array::value("activity_date_time_from", $this->_params),
CRM_Utils_Array::value("activity_date_time_to", $this->_params)
$this->_params["activity_date_time_relative"] ?? NULL,
$this->_params["activity_date_time_from"] ?? NULL,
$this->_params["activity_date_time_to"] ?? NULL
);
$url[] = "activity_date_time_from={$from}&activity_date_time_to={$to}";
break;
Expand Down
2 changes: 1 addition & 1 deletion CRM/Report/Form/Case/Detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ public function where() {
$op,
$this->_params["{$fieldName}_value"] ?? NULL,
$this->_params["{$fieldName}_min"] ?? NULL,
CRM_Utils_Array::value("{$fieldName}_max", $this->_params)
$this->_params["{$fieldName}_max"] ?? NULL
);
}
}
Expand Down
12 changes: 3 additions & 9 deletions CRM/Report/Form/Pledge/Detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,15 +344,9 @@ public function where() {
if ($op) {
$clause = $this->whereClause($field,
$op,
CRM_Utils_Array::value("{$fieldName}_value",
$this->_params
),
CRM_Utils_Array::value("{$fieldName}_min",
$this->_params
),
CRM_Utils_Array::value("{$fieldName}_max",
$this->_params
)
$this->_params["{$fieldName}_value"] ?? NULL,
$this->_params["{$fieldName}_min"] ?? NULL,
$this->_params["{$fieldName}_max"] ?? NULL
);
}
}
Expand Down
12 changes: 3 additions & 9 deletions CRM/Report/Form/Pledge/Summary.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,15 +319,9 @@ public function where() {
if ($op) {
$clause = $this->whereClause($field,
$op,
CRM_Utils_Array::value("{$fieldName}_value",
$this->_params
),
CRM_Utils_Array::value("{$fieldName}_min",
$this->_params
),
CRM_Utils_Array::value("{$fieldName}_max",
$this->_params
)
$this->_params["{$fieldName}_value"] ?? NULL,
$this->_params["{$fieldName}_min"] ?? NULL,
$this->_params["{$fieldName}_max"] ?? NULL
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Report/Page/Report.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function run() {
'String', FALSE, TRUE
);

$extKey = strpos(CRM_Utils_Array::value('name', $templateInfo), '.');
$extKey = strpos($templateInfo['name'] ?? '', '.');

$reportClass = NULL;

Expand Down
2 changes: 1 addition & 1 deletion CRM/Report/Utils/Get.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public static function stringParam($fieldName, &$field, &$defaults) {
case 'like':
case 'eq':
case 'neq':
$value = self::getTypedValue("{$fieldName}_value", CRM_Utils_Array::value('type', $field));
$value = self::getTypedValue("{$fieldName}_value", $field['type'] ?? NULL);
if ($value !== NULL) {
$defaults["{$fieldName}_value"] = $value;
$defaults["{$fieldName}_op"] = $fieldOP;
Expand Down
4 changes: 2 additions & 2 deletions CRM/Report/Utils/Report.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static function getValueIDFromUrl($instanceID = NULL) {

if ($optionVal) {
$templateInfo = CRM_Core_OptionGroup::getRowValues('report_template', "{$optionVal}", 'value');
return [CRM_Utils_Array::value('id', $templateInfo), $optionVal];
return [$templateInfo['id'] ?? NULL, $optionVal];
}

return FALSE;
Expand Down Expand Up @@ -191,7 +191,7 @@ public static function mailReport($fileContent, $instanceID = NULL, $outputMode
if (empty($instanceInfo['attachments'])) {
$instanceInfo['attachments'] = [];
}
$params['attachments'] = array_merge(CRM_Utils_Array::value('attachments', $instanceInfo), $attachments);
$params['attachments'] = array_merge($instanceInfo['attachments'] ?? [], $attachments);
$params['text'] = '';
$params['html'] = $fileContent;

Expand Down