Skip to content

Commit

Permalink
(REF) Replace CRM_Utils_Array in more complex cases
Browse files Browse the repository at this point in the history
  • Loading branch information
colemanw authored and totten committed Jul 22, 2023
1 parent fda1e3f commit ab268a1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
10 changes: 6 additions & 4 deletions CRM/Campaign/Page/Petition/Confirm.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,12 @@ public function run() {
$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;
Expand Down
2 changes: 1 addition & 1 deletion CRM/Core/BAO/CustomValueTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public static function create($customParams, $parentOperation = NULL) {
|| $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;
}
}

Expand Down
6 changes: 3 additions & 3 deletions CRM/Report/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -3540,11 +3540,11 @@ public function filterStat(&$statistics) {
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'])) {
Expand Down Expand Up @@ -3648,7 +3648,7 @@ public function getTemplateFileName() {
*/
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);
}
Expand Down
6 changes: 3 additions & 3 deletions api/v3/Relationship.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit ab268a1

Please sign in to comment.