Skip to content

Commit

Permalink
Merge pull request #24544 from eileenmcnaughton/dep_record
Browse files Browse the repository at this point in the history
Remove call to deprecated function `CRM_Contribute_PseudoConstant::contributionStatus`
  • Loading branch information
colemanw authored Sep 20, 2022
2 parents 567225c + 4dd1661 commit 24ac262
Showing 1 changed file with 6 additions and 7 deletions.
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

0 comments on commit 24ac262

Please sign in to comment.