Skip to content

Commit

Permalink
Merge pull request #24575 from eileenmcnaughton/dep_line
Browse files Browse the repository at this point in the history
Remove call to deprecated `CRM_Contribute_PseudoConstant::contributionStatus`
  • Loading branch information
colemanw authored Sep 20, 2022
2 parents 2d321db + cd9f2c9 commit 567225c
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions CRM/Financial/BAO/FinancialItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,19 @@ public static function retrieve($params, &$defaults) {
* @return CRM_Financial_DAO_FinancialItem
*/
public static function add($lineItem, $contribution, $taxTrxnID = FALSE, $trxnId = NULL) {
$contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
$financialItemStatus = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialItem', 'status_id');
$contributionStatus = CRM_Core_PseudoConstant::getName('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $contribution->contribution_status_id);
$itemStatus = NULL;
if ($contribution->contribution_status_id == array_search('Completed', $contributionStatuses)
|| $contribution->contribution_status_id == array_search('Pending refund', $contributionStatuses)
) {
if ($contributionStatus === 'Completed' || $contributionStatus === 'Pending refund') {
$itemStatus = array_search('Paid', $financialItemStatus);
}
elseif ($contribution->contribution_status_id == array_search('Pending', $contributionStatuses)
|| $contribution->contribution_status_id == array_search('In Progress', $contributionStatuses)
elseif ($contributionStatus === 'Pending'
// In progress is no longer present on new installs unless extensions add it.
|| $contributionStatus === 'In Progress'
) {
$itemStatus = array_search('Unpaid', $financialItemStatus);
}
elseif ($contribution->contribution_status_id == array_search('Partially paid', $contributionStatuses)) {
elseif ($contributionStatus === 'Partially paid') {
$itemStatus = array_search('Partially paid', $financialItemStatus);
}
$params = [
Expand Down Expand Up @@ -96,8 +95,7 @@ public static function add($lineItem, $contribution, $taxTrxnID = FALSE, $trxnId
$trxnId['id'] = $trxn['financialTrxnId'];
}
}
$financialItem = self::create($params, NULL, $trxnId);
return $financialItem;
return self::create($params, NULL, $trxnId);
}

/**
Expand Down

0 comments on commit 567225c

Please sign in to comment.