CRM-15555 fix front end form to use byProcessor method rather than type
authorEileen McNaughton <eileen@fuzion.co.nz>
Mon, 3 Nov 2014 10:18:36 +0000 (23:18 +1300)
committerEileen McNaughton <eileen@fuzion.co.nz>
Mon, 3 Nov 2014 10:18:36 +0000 (23:18 +1300)
CRM/Core/Payment/Form.php
CRM/Core/Payment/ProcessorForm.php
CRM/Financial/BAO/PaymentProcessor.php

index 12cc966b2973d87aaa1a928c7e89e89b0a3e7da3..f770737e35de118fcdb373564ce4bdeeae2eddd1 100644 (file)
@@ -54,7 +54,7 @@ class CRM_Core_Payment_Form {
   /**
    * Add payment fields are depending on payment processor
    *
-   * @param CRM_Contribute_Form_Contribution $form
+   * @param CRM_Contribute_Form_Contribution| CRM_Contribute_Form_Contribution_Main $form
    * @todo - add other forms specifically to the definition - since we don't have for $form - since we aren't adding the property to
    * CRM_Core_Form (don't suppose we should?)
    * @param array $processor array of properties including 'object' as loaded from CRM_Financial_BAO_PaymentProcessor::getPaymentProcessors
index 3f63056575ae37886d7f5ed23aea9b1e1b801268..3f2394be24b635ef83d06119b92098bf40c870c4 100644 (file)
@@ -68,10 +68,8 @@ class CRM_Core_Payment_ProcessorForm {
     //checks after setting $form->_paymentProcessor
     // we do this outside of the above conditional to avoid
     // saving the country/state list in the session (which could be huge)
+    CRM_Core_Payment_Form::setPaymentFieldsByProcessor($form, $form->_paymentProcessor);
 
-    if (($form->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_FORM) && !empty($form->_values['is_monetary'])) {
-      CRM_Core_Payment_Form::setPaymentFieldsByType($form->_paymentProcessor['payment_type'], $form);
-    }
 
     $form->assign_by_ref('paymentProcessor', $form->_paymentProcessor);
 
index fb42a37414b098408f11d0adad1a5f93d4b27c16..b673f59dbb9245e3d0297e2f806190f801f1a56b 100644 (file)
@@ -269,7 +269,7 @@ class CRM_Financial_BAO_PaymentProcessor extends CRM_Financial_DAO_PaymentProces
     $fields = array(
       'id', 'name', 'payment_processor_type_id', 'user_name', 'password',
       'signature', 'url_site', 'url_api', 'url_recur', 'url_button',
-      'subject', 'class_name', 'is_recur', 'billing_mode',
+      'subject', 'class_name', 'is_recur', 'billing_mode', 'is_test',
       'payment_type', 'is_default',
     );
     $result = array();
@@ -278,7 +278,7 @@ class CRM_Financial_BAO_PaymentProcessor extends CRM_Financial_DAO_PaymentProces
     }
     $result['payment_processor_type'] = CRM_Core_PseudoConstant::paymentProcessorType(FALSE, $dao->payment_processor_type_id, 'name');
 
-    $result['instance'] =& CRM_Core_Payment::singleton($mode, $result);
+    $result['instance'] = $result['object'] =& CRM_Core_Payment::singleton($mode, $result);
 
     return $result;
   }