Skip to content

Commit

Permalink
Merge pull request #18998 from eileenmcnaughton/trans2
Browse files Browse the repository at this point in the history
Remove unused params, return params from processFail
  • Loading branch information
seamuslee001 authored Nov 22, 2020
2 parents 3e0abe7 + 2a66d1d commit f72d958
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions CRM/Contribute/BAO/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -1336,22 +1336,18 @@ protected static function isEmailReceipt(array $input, $contributionPageID, $rec
/**
* Process failed contribution.
*
* @param $processContributionObject
* @param $memberships
* @param $contributionId
* @param array $membershipStatuses
* @param array $updateResult
* @param $participant
* @param $pledgePayment
* @param $pledgeID
* @param array $pledgePaymentIDs
* @param $contributionStatusId
*
* @return array
* @throws \CRM_Core_Exception
*/
protected static function processFail($processContributionObject, $memberships, $contributionId, array $membershipStatuses, array $updateResult, $participant, $pledgePayment, $pledgeID, array $pledgePaymentIDs, $contributionStatusId): array {
$processContribution = FALSE;
protected static function processFail($memberships, $contributionId, array $membershipStatuses, array $participant, $pledgePayment, $pledgeID, array $pledgePaymentIDs, $contributionStatusId): void {
if (is_array($memberships)) {
foreach ($memberships as $membership) {
$update = TRUE;
Expand All @@ -1371,11 +1367,6 @@ protected static function processFail($processContributionObject, $memberships,
$membership->is_override = TRUE;
$membership->status_override_end_date = 'null';
$membership->save();

$updateResult['updatedComponents']['CiviMember'] = $membership->status_id;
if ($processContributionObject) {
$processContribution = TRUE;
}
}
}
}
Expand All @@ -1387,22 +1378,11 @@ protected static function processFail($processContributionObject, $memberships,
$participantStatuses = CRM_Event_PseudoConstant::participantStatus();
$updatedStatusId = array_search('Cancelled', $participantStatuses);
CRM_Event_BAO_Participant::updateParticipantStatus($participant->id, $oldStatus, $updatedStatusId, TRUE);

$updateResult['updatedComponents']['CiviEvent'] = $updatedStatusId;
if ($processContributionObject) {
$processContribution = TRUE;
}
}

if ($pledgePayment) {
CRM_Pledge_BAO_PledgePayment::updatePledgePaymentStatus($pledgeID, $pledgePaymentIDs, $contributionStatusId);

$updateResult['updatedComponents']['CiviPledge'] = $contributionStatusId;
if ($processContributionObject) {
$processContribution = TRUE;
}
}
return [$updateResult, $processContribution];
}

/**
Expand Down Expand Up @@ -2213,7 +2193,7 @@ public static function transitionComponents($params) {
self::cancel($memberships, $contributionId, $membershipStatuses, $participant, $oldStatus, $pledgePayment, $pledgeID, $pledgePaymentIDs, $contributionStatusId);
}
elseif ($contributionStatusId == array_search('Failed', $contributionStatuses)) {
list($updateResult, $processContribution) = self::processFail(FALSE, $memberships, $contributionId, $membershipStatuses, $updateResult, $participant, $pledgePayment, $pledgeID, $pledgePaymentIDs, $contributionStatusId);
self::processFail($memberships, $contributionId, $membershipStatuses, $participant, $pledgePayment, $pledgeID, $pledgePaymentIDs, $contributionStatusId);
}
elseif ($contributionStatusId == array_search('Completed', $contributionStatuses)) {

Expand Down

0 comments on commit f72d958

Please sign in to comment.