Fix required payment fields CRM-12149
authorColeman Watts <coleman@civicrm.org>
Wed, 3 Apr 2013 20:22:27 +0000 (13:22 -0700)
committerColeman Watts <coleman@civicrm.org>
Wed, 3 Apr 2013 20:22:27 +0000 (13:22 -0700)
CRM/Contribute/Form/Contribution/Main.php
CRM/Event/Form/Registration/Register.php

index d6135d6b45449d186d1f497a55cea2f894bed8c9..6d876ec942456370ab8719143ca8132c22ae3dea 100644 (file)
@@ -170,15 +170,6 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
         }
       }
     }
-
-    if (CRM_Utils_Array::value('hidden_processor', $_POST)) {
-      $this->set('type', CRM_Utils_Array::value('payment_processor', $_POST));
-      $this->set('mode', $this->_mode);
-      $this->set('paymentProcessor', $this->_paymentProcessor);
-
-      CRM_Core_Payment_ProcessorForm::preProcess($this);
-      CRM_Core_Payment_ProcessorForm::buildQuickForm($this);
-    }
   }
 
   function setDefaultValues() {
@@ -1366,8 +1357,15 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
     $form->assign('ppType', FALSE);
     $form->_ppType = NULL;
     if (!empty($paymentProcessors)) {
+      // Fetch type during form post
+      if (CRM_Utils_Array::value('hidden_processor', $_POST)) {
+        $form->_ppType = CRM_Utils_Array::value('payment_processor', $_POST);
+        $form->set('type', $form->_ppType);
+        $form->set('mode', $form->_mode);
+        $form->set('paymentProcessor', $form->_paymentProcessor);
+      }
       // Fetch type during ajax request
-      if (isset($_GET['type']) && $form->_snippet) {
+      elseif (isset($_GET['type']) && $form->_snippet) {
         $form->_ppType = $_GET['type'];
       }
       // Set default payment processor
index d9da063a454950a0c1c71f1910dbe54133ccbb8e..9d324ad6365d7fdfea60d851b2754bc7e085a2c6 100644 (file)
@@ -115,16 +115,6 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
     if ($this->_allowConfirmation) {
       CRM_Event_Form_EventFees::preProcess($this);
     }
-
-    if (CRM_Utils_Array::value('hidden_processor', $_POST)) {
-      $this->set('type', CRM_Utils_Array::value('payment_processor', $_POST));
-      $this->set('mode', $this->_mode);
-      $this->set('paymentProcessor', $this->_paymentProcessor);
-
-      CRM_Core_Payment_ProcessorForm::preProcess($this);
-      CRM_Core_Payment_ProcessorForm::buildQuickForm($this);
-    }
-
   }
 
   /**