From 762dc4cf763d93545f5a1a7fb63b191996c55bee Mon Sep 17 00:00:00 2001 From: Jitendra Purohit Date: Tue, 27 Jun 2017 10:20:02 +0530 Subject: [PATCH] avoid completed payment getting cancelled on cancelling pledge --- CRM/Pledge/BAO/PledgePayment.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CRM/Pledge/BAO/PledgePayment.php b/CRM/Pledge/BAO/PledgePayment.php index 18113b1a2e..5d56d843a4 100644 --- a/CRM/Pledge/BAO/PledgePayment.php +++ b/CRM/Pledge/BAO/PledgePayment.php @@ -668,6 +668,10 @@ WHERE civicrm_pledge.id = %2 $payments = implode(',', $paymentIds); $paymentClause = " AND civicrm_pledge_payment.id IN ( {$payments} )"; } + elseif ($paymentStatusId == array_search('Cancelled', $allStatus)) { + $completedStatus = array_search('Completed', $allStatus); + $paymentClause = " AND civicrm_pledge_payment.status_id != {$completedStatus}"; + } $actualAmountClause = NULL; $contributionIdClause = NULL; if (isset($contributionId) && !$isScriptUpdate) { -- 2.25.1