From dfc09d85ba1b28bf21870ff29633d0fd32467989 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Tue, 10 Aug 2021 19:25:59 +1200 Subject: [PATCH] [Ref] Simplify IF clause This if is only reached if contributionStatus is completed - ergo it can't be anything else - poof. Also previousStatus will be empty if previous_status_id is not set - so the in_array(previousStatus) check is enough --- CRM/Contribute/BAO/Contribution.php | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 3093761de9..0018c801ba 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -2090,9 +2090,6 @@ LEFT JOIN civicrm_contribution contribution ON ( componentPayment.contribution_ $contributionId = $params['contribution_id']; $contributionStatusId = $params['contribution_status_id']; - // if we already processed contribution object pass previous status id. - $previousContriStatusId = $params['previous_contribution_status_id']; - // we process only ( Completed, Cancelled, or Failed ) contributions. if (!$contributionId || $contributionStatus !== 'Completed') { return; @@ -2169,24 +2166,10 @@ LEFT JOIN civicrm_contribution contribution ON ( componentPayment.contribution_ if ($contributionStatus === 'Completed') { // only pending contribution related object processed. - if ($previousContriStatusId && - !in_array($previousStatus, [ - 'Pending', - 'Partially paid', - ]) - ) { + if (!in_array($previousStatus, ['Pending', 'Partially paid'])) { // this is case when we already processed contribution object. return; } - elseif (!$previousContriStatusId && - !in_array($contributionStatus, [ - 'Pending', - 'Partially paid', - ]) - ) { - // this is case when we are going to process contribution object later. - return; - } if (is_array($memberships)) { foreach ($memberships as $membership) { -- 2.25.1