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] Swap out CRM_Utils_Array::value() - partial pull out from PR 18207 #18391

Merged
merged 1 commit into from
Sep 7, 2020
Merged
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
16 changes: 6 additions & 10 deletions CRM/Contribute/BAO/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public static function add(&$params) {
CRM_Contribute_BAO_ContributionRecur::updateOnNewPayment(
(!empty($params['contribution_recur_id']) ? $params['contribution_recur_id'] : $params['prevContribution']->contribution_recur_id),
$contributionStatus,
CRM_Utils_Array::value('receive_date', $params)
$params['receive_date'] ?? NULL
);
}

Expand Down Expand Up @@ -2262,7 +2262,7 @@ public static function transitionComponents($params, $processContributionObject
$numterms = 1;
$lineitems = CRM_Price_BAO_LineItem::getLineItemsByContributionID($contributionId);
foreach ($lineitems as $lineitem) {
if ($membership->membership_type_id == CRM_Utils_Array::value('membership_type_id', $lineitem)) {
if ($membership->membership_type_id == ($lineitem['membership_type_id'] ?? NULL)) {
$numterms = $lineitem['membership_num_terms'] ?? NULL;

// in case membership_num_terms comes through as null or zero
Expand Down Expand Up @@ -2324,7 +2324,7 @@ public static function transitionComponents($params, $processContributionObject
//updating the membership log
$membershipLog = [];
$membershipLog = $formattedParams;
$logStartDate = CRM_Utils_Date::customFormat(CRM_Utils_Array::value('log_start_date', $dates), $format);
$logStartDate = CRM_Utils_Date::customFormat($dates['log_start_date'] ?? NULL, $format);
$logStartDate = ($logStartDate) ? CRM_Utils_Date::isoToMysql($logStartDate) : $formattedParams['start_date'];

$membershipLog['start_date'] = $logStartDate;
Expand Down Expand Up @@ -3237,7 +3237,7 @@ public function _assignMessageVariablesToTemplate(&$values, $input, $returnMessa

// For some unit tests contribution cannot contain paymentProcessor information
$billingMode = empty($this->_relatedObjects['paymentProcessor']) ? CRM_Core_Payment::BILLING_MODE_NOTIFY : $this->_relatedObjects['paymentProcessor']['billing_mode'];
$template->assign('contributeMode', CRM_Utils_Array::value($billingMode, CRM_Core_SelectValues::contributeMode()));
$template->assign('contributeMode', CRM_Core_SelectValues::contributeMode()[$billingMode] ?? NULL);

//assign honor information to receipt message
$softRecord = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($this->id);
Expand Down Expand Up @@ -3287,7 +3287,7 @@ public function _assignMessageVariablesToTemplate(&$values, $input, $returnMessa
$template->assign('price', $productDAO->price);
$template->assign('sku', $productDAO->sku);
}
$template->assign('title', CRM_Utils_Array::value('title', $values));
$template->assign('title', $values['title'] ?? NULL);
$values['amount'] = CRM_Utils_Array::value('total_amount', $input, (CRM_Utils_Array::value('amount', $input)), NULL);
if (!$values['amount'] && isset($this->total_amount)) {
$values['amount'] = $this->total_amount;
Expand Down Expand Up @@ -3333,11 +3333,7 @@ public function _assignMessageVariablesToTemplate(&$values, $input, $returnMessa
);
$values['receipt_date'] = (empty($this->receipt_date) ? NULL : $this->receipt_date);
$template->assign('action', $this->is_test ? 1024 : 1);
$template->assign('receipt_text',
CRM_Utils_Array::value('receipt_text',
$values
)
);
$template->assign('receipt_text', $values['receipt_text'] ?? NULL);
$template->assign('is_monetary', 1);
$template->assign('is_recur', !empty($this->contribution_recur_id));
$template->assign('currency', $this->currency);
Expand Down