From 56251ea76e7110e86cfb1f8aaf550fbc5a1df887 Mon Sep 17 00:00:00 2001 From: kurund Date: Tue, 11 Feb 2014 14:55:36 -0800 Subject: [PATCH] CRM-14181, add callback function, so that enums are accessible via api etc ---------------------------------------- * CRM-14181: migrate enums to varchar in schema for all tables http://issues.civicrm.org/jira/browse/CRM-14181 --- CRM/Admin/Form/Job.php | 5 +---- CRM/Core/SelectValues.php | 34 ++++++++++++++++++++++++++++++++++ xml/schema/Core/Extension.xml | 2 +- xml/schema/Core/Job.xml | 3 +++ 4 files changed, 39 insertions(+), 5 deletions(-) diff --git a/CRM/Admin/Form/Job.php b/CRM/Admin/Form/Job.php index 17f090e8f6..5a18932bc2 100644 --- a/CRM/Admin/Form/Job.php +++ b/CRM/Admin/Form/Job.php @@ -94,10 +94,7 @@ class CRM_Admin_Form_Job extends CRM_Admin_Form { $attributes['api_action'], TRUE ); - $this->add('select', 'run_frequency', ts('Run frequency'), - array('Daily' => ts('Daily'), 'Hourly' => ts('Hourly'), 'Always' => ts('Every time cron job is run')) - ); - + $this->add('select', 'run_frequency', ts('Run frequency'), CRM_Core_SelectValues::getJobFrequency()); $this->add('textarea', 'parameters', ts('Command parameters'), "cols=50 rows=6" diff --git a/CRM/Core/SelectValues.php b/CRM/Core/SelectValues.php index 8b45c63f8b..acb99a20eb 100644 --- a/CRM/Core/SelectValues.php +++ b/CRM/Core/SelectValues.php @@ -929,5 +929,39 @@ class CRM_Core_SelectValues { return $premiumUnits; } + + /** + * extension types + */ + static function getExtensionTypes() { + static $extensionTypes = NULL; + if (!$extensionTypes) { + $extensionTypes = array( + 'payment' => ts('Payment'), + 'search' => ts('Search'), + 'report' => ts('Report'), + 'module' => ts('Module'), + 'sms' => ts('SMS'), + ); + } + + return $extensionTypes; + } + + /** + * job frequency + */ + static function getJobFrequency() { + static $jobFrequency = NULL; + if (!$jobFrequency) { + $jobFrequency = array( + 'Daily' => ts('Daily'), + 'Hourly' => ts('Hourly'), + 'Always' => ts('Every time cron job is run'), + ); + } + + return $jobFrequency; + } } diff --git a/xml/schema/Core/Extension.xml b/xml/schema/Core/Extension.xml index da3fac0a7c..3d1abc4817 100644 --- a/xml/schema/Core/Extension.xml +++ b/xml/schema/Core/Extension.xml @@ -25,7 +25,7 @@ true - CRM_Core_SelectValues::pmf() + CRM_Core_SelectValues::getExtensionTypes() 4.2 diff --git a/xml/schema/Core/Job.xml b/xml/schema/Core/Job.xml index b86bdff9e8..fcf89f856f 100644 --- a/xml/schema/Core/Job.xml +++ b/xml/schema/Core/Job.xml @@ -37,6 +37,9 @@ 8 "Daily" Scheduled job run frequency. + + CRM_Core_SelectValues::getJobFrequency() + 4.1 Select -- 2.25.1