From f27fa89003a2d1cb691ff90cd662d2e4d996e706 Mon Sep 17 00:00:00 2001 From: Jitendra Purohit Date: Tue, 6 Apr 2021 15:12:02 +0530 Subject: [PATCH] Fix recalculation of dates on pledge --- CRM/Pledge/BAO/Pledge.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CRM/Pledge/BAO/Pledge.php b/CRM/Pledge/BAO/Pledge.php index 2f647e153b..63078610fd 100644 --- a/CRM/Pledge/BAO/Pledge.php +++ b/CRM/Pledge/BAO/Pledge.php @@ -128,6 +128,7 @@ class CRM_Pledge_BAO_Pledge extends CRM_Pledge_DAO_Pledge { $params = array_merge($defaults, $params); } + $isRecalculatePledgePayment = self::isPaymentsRequireRecalculation($params); $transaction = new CRM_Core_Transaction(); $paymentParams = []; @@ -172,10 +173,10 @@ class CRM_Pledge_BAO_Pledge extends CRM_Pledge_DAO_Pledge { } // skip payment stuff in edit mode - if (empty($params['id']) || self::isPaymentsRequireRecalculation($params)) { + if (empty($params['id']) || $isRecalculatePledgePayment) { // if pledge is pending delete all payments and recreate. - if (!empty(empty($params['id']))) { + if ($isRecalculatePledgePayment) { CRM_Pledge_BAO_PledgePayment::deletePayments($pledge->id); } -- 2.25.1