Merge pull request #11153 from yashodha/CRM-21327
authorMonish Deb <monish.deb@jmaconsulting.biz>
Thu, 19 Oct 2017 10:31:42 +0000 (16:01 +0530)
committerGitHub <noreply@github.com>
Thu, 19 Oct 2017 10:31:42 +0000 (16:01 +0530)
CRM-21327 - Not able to change Payment Processor in event fees

CRM/Event/Form/ManageEvent/Fee.php

index beaeb885bfaa1c8ff0d1f9e6c46f0984149d1a27..8b024d73e202f0c54ff3eaa21547c9f1250fa49a 100644 (file)
@@ -228,12 +228,12 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent {
     }
     $this->_showHide->addToTemplate();
     $this->assign('inDate', $this->_inDate);
-
     if (!empty($defaults['payment_processor'])) {
-      $defaults['payment_processor'] = str_replace(CRM_Core_DAO::VALUE_SEPARATOR, ',',
+      $defaults['payment_processor'] = array_fill_keys(explode(CRM_Core_DAO::VALUE_SEPARATOR,
         $defaults['payment_processor']
-      );
+      ), '1');
     }
+
     return $defaults;
   }
 
@@ -255,15 +255,11 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent {
     $paymentProcessor = CRM_Core_PseudoConstant::paymentProcessor();
 
     $this->assign('paymentProcessor', $paymentProcessor);
-
-    $this->addEntityRef('payment_processor', ts('Payment Processor'), array(
-      'entity' => 'PaymentProcessor',
-      'multiple' => TRUE,
-      'api' => array(
-        'params' => array('domain_id' => CRM_Core_Config::domainID()),
-      ),
-      'select' => array('minimumInputLength' => 0),
-    ));
+    $this->addCheckBox('payment_processor', ts('Payment Processor'),
+      array_flip($paymentProcessor),
+      NULL, NULL, NULL, NULL,
+      array('&nbsp;&nbsp;', '&nbsp;&nbsp;', '&nbsp;&nbsp;', '<br/>')
+    );
 
     // financial type
     if (!CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() ||
@@ -564,7 +560,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent {
     }
 
     if (!empty($params['payment_processor'])) {
-      $params['payment_processor'] = str_replace(',', CRM_Core_DAO::VALUE_SEPARATOR, $params['payment_processor']);
+      $params['payment_processor'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($params['payment_processor']));
     }
     else {
       $params['payment_processor'] = 'null';