From 391ccd2781fc9d116dd04e012eb9123db456d018 Mon Sep 17 00:00:00 2001 From: eileen Date: Sat, 5 Sep 2020 14:50:55 +1200 Subject: [PATCH] Remove inaccessible call to baseIPN failed As is now clear the updateContributionStatus function is only accessible to complete a contribution. This removes the call to baseIPN->failed() as it is unreachable, along with the hacky handling to support it --- CRM/Core/Payment/BaseIPN.php | 16 +++++++--------- CRM/Event/Form/Task/Batch.php | 8 -------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/CRM/Core/Payment/BaseIPN.php b/CRM/Core/Payment/BaseIPN.php index d99c8c8f80..d3f56e9f70 100644 --- a/CRM/Core/Payment/BaseIPN.php +++ b/CRM/Core/Payment/BaseIPN.php @@ -232,17 +232,15 @@ class CRM_Core_Payment_BaseIPN { CRM_Contribute_BAO_ContributionRecur::copyCustomValues($objects['contributionRecur']->id, $contribution->id); } - if (empty($input['IAmAHorribleNastyBeyondExcusableHackInTheCRMEventFORMTaskClassThatNeedsToBERemoved'])) { - if (!empty($memberships)) { - foreach ($memberships as $membership) { - // @fixme Should we cancel only Pending memberships? per cancelled() - $this->cancelMembership($membership, $membership->status_id, FALSE); - } + if (!empty($memberships)) { + foreach ($memberships as $membership) { + // @fixme Should we cancel only Pending memberships? per cancelled() + $this->cancelMembership($membership, $membership->status_id, FALSE); } + } - if ($participant) { - $this->cancelParticipant($participant->id); - } + if ($participant) { + $this->cancelParticipant($participant->id); } if ($transaction) { diff --git a/CRM/Event/Form/Task/Batch.php b/CRM/Event/Form/Task/Batch.php index f8ac3af5f3..66afd39c58 100644 --- a/CRM/Event/Form/Task/Batch.php +++ b/CRM/Event/Form/Task/Batch.php @@ -284,7 +284,6 @@ class CRM_Event_Form_Task_Batch extends CRM_Event_Form_Task { $params = [ 'component_id' => $participantId, 'contribution_id' => $contributionId, - 'contribution_status_id' => array_search('Completed', $contributionStatuses), 'IAmAHorribleNastyBeyondExcusableHackInTheCRMEventFORMTaskClassThatNeedsToBERemoved' => 1, ]; @@ -314,7 +313,6 @@ class CRM_Event_Form_Task_Batch extends CRM_Event_Form_Task { */ public static function updateContributionStatus($params) { // get minimum required values. - $statusId = $params['contribution_status_id'] ?? NULL; $componentId = $params['component_id'] ?? NULL; $contributionId = $params['contribution_id'] ?? NULL; @@ -357,12 +355,6 @@ class CRM_Event_Form_Task_Batch extends CRM_Event_Form_Task { 'flip' => 1, ]); $input['IAmAHorribleNastyBeyondExcusableHackInTheCRMEventFORMTaskClassThatNeedsToBERemoved'] = $params['IAmAHorribleNastyBeyondExcusableHackInTheCRMEventFORMTaskClassThatNeedsToBERemoved'] ?? NULL; - if ($statusId == $contributionStatuses['Failed']) { - $transaction = new CRM_Core_Transaction(); - $baseIPN->failed($objects, $transaction, $input); - $transaction->commit(); - return; - } // status is not pending if ($contribution->contribution_status_id != $contributionStatuses['Pending']) { -- 2.25.1