From 439b55dfb75c458de2ec2bf729ed949622208364 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Mon, 17 Aug 2015 18:54:33 -0700 Subject: [PATCH] CRM-16373 - Config - Migrate fiscalYearStart --- CRM/Admin/Form/Setting/Date.php | 5 +---- CRM/Core/Form.php | 13 +++++++++++++ settings/Localization.setting.php | 16 ++++++++++++++++ 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/CRM/Admin/Form/Setting/Date.php b/CRM/Admin/Form/Setting/Date.php index e43136ca69..575997e204 100644 --- a/CRM/Admin/Form/Setting/Date.php +++ b/CRM/Admin/Form/Setting/Date.php @@ -43,6 +43,7 @@ class CRM_Admin_Form_Setting_Date extends CRM_Admin_Form_Setting { 'weekBegins' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, 'dateInputFormat' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, 'timeInputFormat' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, + 'fiscalYearStart' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, ); /** @@ -59,10 +60,6 @@ class CRM_Admin_Form_Setting_Date extends CRM_Admin_Form_Setting { $this->addElement('text', 'dateformatYear', ts('Year Only')); $this->addElement('text', 'dateformatTime', ts('Time Only')); - $this->add('date', 'fiscalYearStart', ts('Fiscal Year Start'), - CRM_Core_SelectValues::date(NULL, 'M d') - ); - parent::buildQuickForm(); } diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index d4f144091e..932c1d8184 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -343,6 +343,19 @@ class CRM_Core_Form extends HTML_QuickForm_Page { return $element; } + /** + * Add an element for inputting a month+day (partial date). + * + * @param string $name + * @param string $label + * @return HTML_QuickForm_Element + */ + public function addMonthDay($name, $label) { + return $this->add('date', $name, $label, + CRM_Core_SelectValues::date(NULL, 'M d') + ); + } + /** * called before buildForm. Any pre-processing that * needs to be done for buildForm should be done here diff --git a/settings/Localization.setting.php b/settings/Localization.setting.php index 517f57fa33..d7775c5602 100644 --- a/settings/Localization.setting.php +++ b/settings/Localization.setting.php @@ -383,6 +383,22 @@ return array( 'title' => 'Import / Export Field Separator', 'description' => 'Global CSV separator character. Modify this setting to enable import and export of different kinds of CSV files (for example: \',\' \';\' \':\' \'|\' ).', ), + 'fiscalYearStart' => array( + 'add' => '4.7', + 'prefetch' => 1, + 'help_text' => NULL, + 'is_domain' => 1, + 'is_contact' => 0, + 'group_name' => 'Localization Preferences', + 'group' => 'localization', + 'name' => 'fiscalYearStart', + 'type' => 'Array', + 'quick_form_type' => 'MonthDay', + 'html_type' => 'MonthDay', + 'default' => ',', + 'title' => 'Fiscal Year Start', + 'description' => '', + ), 'lcMessages' => array( 'group_name' => 'Localization Preferences', 'group' => 'localization', -- 2.25.1