From b8887609842f0f045adecd6805aca25b8ca05c16 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 30 Oct 2015 13:47:01 -0600 Subject: [PATCH] CRM-17469 - set default pledge payment amount --- CRM/Contribute/Form/Contribution/Main.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index d03eb0557a..93df1079e9 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -149,19 +149,23 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $completedContributionIds = array(); $pledgePayments = CRM_Pledge_BAO_PledgePayment::getPledgePayments($this->_values['pledge_id']); + $paymentAmount = 0; $duePayment = FALSE; foreach ($pledgePayments as $payId => $value) { if ($value['status'] == 'Overdue') { $this->_defaults['pledge_amount'][$payId] = 1; + $paymentAmount += $value['scheduled_amount']; } elseif (!$duePayment && $value['status'] == 'Pending') { $this->_defaults['pledge_amount'][$payId] = 1; + $paymentAmount += $value['scheduled_amount']; $duePayment = TRUE; } elseif ($value['status'] == 'Completed' && $value['contribution_id']) { $completedContributionIds[] = $value['contribution_id']; } } + $this->_defaults['price_' . $this->_priceSetId] = $paymentAmount; if (count($completedContributionIds)) { $softCredit = array(); -- 2.25.1