From 280f1b053be4132adc3c9eb8a6daf96bad572108 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Sun, 3 Aug 2014 16:50:38 +0100 Subject: [PATCH] Change select option to use more standard pseudoconstant callback --- CRM/Core/SelectValues.php | 8 +++++++ CRM/Financial/BAO/PaymentProcessorType.php | 24 ------------------- xml/schema/Financial/PaymentProcessorType.xml | 4 +++- 3 files changed, 11 insertions(+), 25 deletions(-) diff --git a/CRM/Core/SelectValues.php b/CRM/Core/SelectValues.php index d9e63c5246..2816c20a31 100644 --- a/CRM/Core/SelectValues.php +++ b/CRM/Core/SelectValues.php @@ -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 */ diff --git a/CRM/Financial/BAO/PaymentProcessorType.php b/CRM/Financial/BAO/PaymentProcessorType.php index 845a4a5f85..055b5f248b 100644 --- a/CRM/Financial/BAO/PaymentProcessorType.php +++ b/CRM/Financial/BAO/PaymentProcessorType.php @@ -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); - } } diff --git a/xml/schema/Financial/PaymentProcessorType.xml b/xml/schema/Financial/PaymentProcessorType.xml index 456a8c0518..55b766bb4d 100644 --- a/xml/schema/Financial/PaymentProcessorType.xml +++ b/xml/schema/Financial/PaymentProcessorType.xml @@ -153,7 +153,9 @@ int unsigned true Billing Mode - true + + CRM_Core_SelectValues::billingMode + Select -- 2.25.1