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

Remove call to deprecated function CRM_Contribute_PseudoConstant::contributionStatus #24544

Merged
merged 1 commit into from
Sep 20, 2022
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
13 changes: 6 additions & 7 deletions CRM/Contribute/BAO/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -3049,10 +3049,9 @@ public static function recordFinancialAccounts(&$params, CRM_Contribute_DAO_Cont
$isUpdate = !empty($params['prevContribution']);

$additionalParticipantId = [];
$contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
$contributionStatus = empty($params['contribution_status_id']) ? NULL : $contributionStatuses[$params['contribution_status_id']];
$contributionStatus = CRM_Core_PseudoConstant::getName('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $params['contribution_status_id'] ?? NULL);

if (CRM_Utils_Array::value('contribution_mode', $params) == 'participant') {
if (CRM_Utils_Array::value('contribution_mode', $params) === 'participant') {
$entityId = $params['participant_id'];
$entityTable = 'civicrm_participant';
$additionalParticipantId = CRM_Event_BAO_Participant::getAdditionalParticipantIds($entityId);
Expand Down Expand Up @@ -3083,8 +3082,8 @@ public static function recordFinancialAccounts(&$params, CRM_Contribute_DAO_Cont

$statusId = $params['contribution']->contribution_status_id;

if ($contributionStatus != 'Failed' &&
!($contributionStatus == 'Pending' && !$params['contribution']->is_pay_later)
if ($contributionStatus !== 'Failed' &&
!($contributionStatus === 'Pending' && !$params['contribution']->is_pay_later)
) {
$skipRecords = TRUE;
$pendingStatus = [
Expand Down Expand Up @@ -3148,7 +3147,7 @@ public static function recordFinancialAccounts(&$params, CRM_Contribute_DAO_Cont
'pan_truncation' => $params['pan_truncation'] ?? NULL,
'card_type_id' => $params['card_type_id'] ?? NULL,
];
if ($contributionStatus == 'Refunded' || $contributionStatus == 'Chargeback' || $contributionStatus == 'Cancelled') {
if ($contributionStatus === 'Refunded' || $contributionStatus === 'Chargeback' || $contributionStatus === 'Cancelled') {
$trxnParams['trxn_date'] = !empty($params['contribution']->cancel_date) ? $params['contribution']->cancel_date : date('YmdHis');
if (isset($params['refund_trxn_id'])) {
// CRM-17751 allow a separate trxn_id for the refund to be passed in via api & form.
Expand Down Expand Up @@ -3340,7 +3339,7 @@ public static function recordFinancialAccounts(&$params, CRM_Contribute_DAO_Cont
CRM_Core_BAO_FinancialTrxn::recordFees($params);
}

if (!empty($params['prevContribution']) && $entityTable == 'civicrm_participant'
if (!empty($params['prevContribution']) && $entityTable === 'civicrm_participant'
&& $params['prevContribution']->contribution_status_id != $params['contribution']->contribution_status_id
) {
$eventID = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $entityId, 'event_id');
Expand Down