Change select option to use more standard pseudoconstant callback
authorColeman Watts <coleman@civicrm.org>
Sun, 3 Aug 2014 15:50:38 +0000 (16:50 +0100)
committerColeman Watts <coleman@civicrm.org>
Sun, 3 Aug 2014 15:50:38 +0000 (16:50 +0100)
CRM/Core/SelectValues.php
CRM/Financial/BAO/PaymentProcessorType.php
xml/schema/Financial/PaymentProcessorType.xml

index d9e63c5246e1f9b9fb958d38118a309f5598beaa..2816c20a31159de6486f13dc5a5a8c474ed2d930 100644 (file)
@@ -876,6 +876,14 @@ class CRM_Core_SelectValues {
     );
   }
 
+  static function billingMode() {
+    return array(
+      CRM_Core_Payment::BILLING_MODE_FORM => 'form',
+      CRM_Core_Payment::BILLING_MODE_BUTTON => 'button',
+      CRM_Core_Payment::BILLING_MODE_NOTIFY => 'notify',
+    );
+  }
+
   /**
    * Frequency unit for schedule reminders
    */
index 845a4a5f855a9fa3ad3e95a87952a47bab6f9a28..055b5f248b565d3256b535f05d891d7a12908872 100644 (file)
@@ -221,29 +221,5 @@ WHERE pp.payment_processor_type_id = ppt.id AND ppt.id = %1";
     return $ppt;
   }
 
-  /**
-   * Get options for a given field.
-   * @see CRM_Core_DAO::buildOptions
-   *
-   * @param String $fieldName
-   * @param String $context : @see CRM_Core_DAO::buildOptionsContext
-   * @param Array $props : whatever is known about this dao object
-   *
-   * @return Array|bool
-   */
-  public static function buildOptions($fieldName, $context = NULL, $props = array()) {
-    $params = array();
-    // Special logic for fields whose options depend on context or properties
-    switch ($fieldName) {
-      // These options are not in the db
-      case 'billing_mode':
-        return array(
-          CRM_Core_Payment::BILLING_MODE_FORM => 'form',
-          CRM_Core_Payment::BILLING_MODE_BUTTON => 'button',
-          CRM_Core_Payment::BILLING_MODE_NOTIFY => 'notify',
-        );
-    }
-    return CRM_Core_PseudoConstant::get(__CLASS__, $fieldName, $params, $context);
-  }
 }
 
index 456a8c05182421367b92c2f85edd128bda5d6437..55b766bb4dfea113696b99c5701c91d8fbb74f0f 100644 (file)
       <type>int unsigned</type>
       <required>true</required>
       <comment>Billing Mode</comment>
-      <pseudoconstant>true</pseudoconstant>
+      <pseudoconstant>
+        <callback>CRM_Core_SelectValues::billingMode</callback>
+      </pseudoconstant>
 <html>
   <type>Select</type>
 </html>