CRM-16204 - Use EntityRef for configure event payment processors
authorColeman Watts <coleman@civicrm.org>
Wed, 6 May 2015 21:22:47 +0000 (17:22 -0400)
committerColeman Watts <coleman@civicrm.org>
Wed, 29 Jul 2015 19:43:26 +0000 (15:43 -0400)
CRM/Event/Form/ManageEvent/Fee.php

index 50ae47e8c3c4405ee1de9452e63376473fabc34e..ed7cb9178d35b395f4072e1a99e2b055a550b0c9 100644 (file)
@@ -238,9 +238,9 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent {
     $this->assign('inDate', $this->_inDate);
 
     if (!empty($defaults['payment_processor'])) {
-      $defaults['payment_processor'] = array_fill_keys(explode(CRM_Core_DAO::VALUE_SEPARATOR,
+      $defaults['payment_processor'] = str_replace(CRM_Core_DAO::VALUE_SEPARATOR, ',',
         $defaults['payment_processor']
-      ), '1');
+      );
     }
     return $defaults;
   }
@@ -266,11 +266,11 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent {
 
     $this->assign('paymentProcessor', $paymentProcessor);
 
-    $this->addCheckBox('payment_processor', ts('Payment Processor'),
-      array_flip($paymentProcessor),
-      NULL, NULL, NULL, NULL,
-      array('&nbsp;&nbsp;', '&nbsp;&nbsp;', '&nbsp;&nbsp;', '<br/>')
-    );
+    $this->addEntityRef('payment_processor', ts('Payment Processor'), array(
+      'entity' => 'PaymentProcessor',
+      'multiple' => TRUE,
+      'select' => array('minimumInputLength' => 0),
+    ));
 
     // financial type
     $this->addSelect('financial_type_id');
@@ -565,10 +565,8 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent {
       return;
     }
 
-    if (array_key_exists('payment_processor', $params) &&
-      !CRM_Utils_System::isNull($params['payment_processor'])
-    ) {
-      $params['payment_processor'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($params['payment_processor']));
+    if (!empty($params['payment_processor'])) {
+      $params['payment_processor'] = str_replace(',', CRM_Core_DAO::VALUE_SEPARATOR, $params['payment_processor']);
     }
     else {
       $params['payment_processor'] = 'null';