CRM-17469 - set default pledge payment amount
authorunknown <Marty Wright@.(none)>
Fri, 30 Oct 2015 19:47:01 +0000 (13:47 -0600)
committerunknown <Marty Wright@.(none)>
Fri, 30 Oct 2015 19:47:01 +0000 (13:47 -0600)
CRM/Contribute/Form/Contribution/Main.php

index d03eb0557a6f564be3cc0f54e76175c7a5a655b3..93df1079e9169681c21a9d38fa3524bfedc94df0 100644 (file)
@@ -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();