CRM-16559 allow recurring contributions to go against pledges for supporting processors
authorEileen McNaughton <eileen@fuzion.co.nz>
Tue, 21 Jul 2015 07:29:06 +0000 (19:29 +1200)
committerEileen McNaughton <eileen@fuzion.co.nz>
Tue, 28 Jul 2015 08:32:52 +0000 (20:32 +1200)
Conflicts:
CRM/Contribute/Form/Contribution.php
CRM/Core/Payment.php
CRM/Core/Payment/PayPalImpl.php

CRM/Contribute/Form/Contribution.php

index 7c4d8a0058d5b30463408e3dff22e248c192aaa4..17c75b62b4a5d77100de3933c492a6f857e2e149 100644 (file)
@@ -548,10 +548,23 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
     if ($this->_mode) {
       if (CRM_Core_Payment_Form::buildPaymentForm($this, $this->_paymentProcessor, FALSE, TRUE) == TRUE) {
         if (!empty($this->_recurPaymentProcessors)) {
-          CRM_Contribute_Form_Contribution_Main::buildRecur($this);
-          $this->setDefaults(array('is_recur' => 0));
-          $this->assign('buildRecurBlock', TRUE);
-          $recurJs = array('onChange' => "buildRecurBlock( this.value ); return false;");
+          $buildRecurBlock = TRUE;
+           if ($this->_ppID) {
+            // ppID denotes a pledge payment.
+            foreach ($this->_paymentProcessors as $processor) {
+              if (!empty($processor['is_recur']) && !empty($processor['object']) && $processor['object']->supports('recurContributionsForPledges')) {
+                $buildRecurBlock = TRUE;
+                break;
+              }
+              $buildRecurBlock = FALSE;
+            }
+          }
+          if ($buildRecurBlock) {
+            CRM_Contribute_Form_Contribution_Main::buildRecur($this);
+            $this->setDefaults(array('is_recur' => 0));
+            $this->assign('buildRecurBlock', TRUE);
+            $recurJs = array('onChange' => "buildRecurBlock( this.value ); return false;");
+          }
         }
       }
     }