Skip to content

Commit

Permalink
[REF] Further removal on unreachable code in transitionComponents
Browse files Browse the repository at this point in the history
Once civicrm#18997 & civicrm#18998 is merged it becomes clear that processContribution can never be true & hence this code is unreachable
  • Loading branch information
eileenmcnaughton committed Nov 21, 2020
1 parent 3dc0e9d commit 4470208
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions CRM/Contribute/BAO/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -2144,8 +2144,6 @@ public static function transitionComponents($params) {
// if we already processed contribution object pass previous status id.
$previousContriStatusId = $params['previous_contribution_status_id'] ?? NULL;

$updateResult = [];

$contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');

// we process only ( Completed, Cancelled, or Failed ) contributions.
Expand Down Expand Up @@ -2227,8 +2225,6 @@ public static function transitionComponents($params) {
'status_id'
);
}
// we might want to process contribution object.
$processContribution = FALSE;
if ($contributionStatusId == array_search('Cancelled', $contributionStatuses)) {
// Call interim cancel function - with a goal to cleaning up the signature on it and switching to a tested api Contribution.cancel function.
list($updateResult, $processContribution) = self::cancel(FALSE, $memberships, $contributionId, $membershipStatuses, $updateResult, $participant, $oldStatus, $pledgePayment, $pledgeID, $pledgePaymentIDs, $contributionStatusId);
Expand Down Expand Up @@ -2416,35 +2412,6 @@ public static function transitionComponents($params) {
}
}

// process contribution object.
if ($processContribution) {
$contributionParams = [];
$fields = [
'contact_id',
'total_amount',
'receive_date',
'is_test',
'campaign_id',
'payment_instrument_id',
'trxn_id',
'invoice_id',
'financial_type_id',
'contribution_status_id',
'non_deductible_amount',
'receipt_date',
'check_number',
];
foreach ($fields as $field) {
if (empty($params[$field])) {
continue;
}
$contributionParams[$field] = $params[$field];
}

$contributionParams['id'] = $contributionId;
$contribution = CRM_Contribute_BAO_Contribution::create($contributionParams);
}

}

/**
Expand Down

0 comments on commit 4470208

Please sign in to comment.