$params = array_merge($defaults, $params);
}
+ $isRecalculatePledgePayment = self::isPaymentsRequireRecalculation($params);
$transaction = new CRM_Core_Transaction();
$paymentParams = [];
}
// 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);
}