CRM-15555 fix for credit card showing on paylater
authorEileen McNaughton <eileen@fuzion.co.nz>
Mon, 10 Nov 2014 04:15:14 +0000 (17:15 +1300)
committerEileen McNaughton <eileen@fuzion.co.nz>
Thu, 13 Nov 2014 15:04:44 +0000 (04:04 +1300)
CRM/Contribute/Form/Contribution/Main.php

index f4eb1f70c393421224a8414e1fa99d15f10eb8c3..000f3f905c483311e582020c2d78652bbda8beef 100644 (file)
@@ -394,7 +394,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
     }
 
     // Build payment processor form
-    if (($this->_paymentProcessorID || $this->_isBillingAddressRequiredForPayLater) && empty($_GET['onbehalf'])) {
+    if (empty($_GET['onbehalf'])) {
       CRM_Core_Payment_ProcessorForm::buildQuickForm($this);
       // Return if we are in an ajax callback
       if ($this->_snippet) {
@@ -420,6 +420,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
     );
     $this->addRule("email-{$this->_bltID}", ts('Email is not valid.'), 'email');
     $pps = array();
+    //@todo - this should be replaced by a check as to whether billing fields are set
     $onlinePaymentProcessorEnabled = FALSE;
     if (!empty($this->_paymentProcessors)) {
       foreach ($this->_paymentProcessors as $key => $name) {
@@ -1400,7 +1401,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
     if ($form->_paymentProcessors) {
       // Fetch type during ajax request
       if (isset($_GET['type']) && $form->_snippet) {
-        $form->_paymentProcessorID = $_GET['type'];
+        $form->_paymentProcessorID = CRM_Utils_Request::retrieve('type', 'Integer', CRM_Core_DAO::$_nullObject, FALSE, 0);
       }
       // Remember type during form post
       elseif (!empty($form->_submitValues)) {
@@ -1422,6 +1423,9 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
       if ($form->_paymentProcessorID) {
         CRM_Core_Payment_ProcessorForm::preProcess($form);
       }
+      else {
+        $form->_paymentProcessor = array();
+      }
 
       //get payPal express id and make it available to template
       foreach ($form->_paymentProcessors as $ppId => $values) {