From: Dilip Raj Baral Date: Mon, 23 May 2016 06:10:22 +0000 (+0530) Subject: CRM-17887 - Add a new setting `Financial Batch date` X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=378464365fbd7dac97bdceb26b3d6dd786729157;p=civicrm-core.git CRM-17887 - Add a new setting `Financial Batch date` https://issues.civicrm.org/jira/browse/CRM-17887 He's likely referencing the setting at Administer > Localization > Date Formats, Complete Date fields. Unfortunately, those settings don't include a convenient one for this purpose, since by default they include text names of months, etc. So, added a new field exclusively for Financial Batch. --- diff --git a/CRM/Admin/Form/Setting/Date.php b/CRM/Admin/Form/Setting/Date.php index 72271ae377..c99335a79c 100644 --- a/CRM/Admin/Form/Setting/Date.php +++ b/CRM/Admin/Form/Setting/Date.php @@ -42,6 +42,7 @@ class CRM_Admin_Form_Setting_Date extends CRM_Admin_Form_Setting { 'dateformatPartial' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, 'dateformatYear' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, 'dateformatTime' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, + 'dateformatFinancialBatch' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, 'weekBegins' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, 'dateInputFormat' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, 'timeInputFormat' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, diff --git a/CRM/Core/Config/MagicMerge.php b/CRM/Core/Config/MagicMerge.php index 16923909c7..b1b84ab868 100644 --- a/CRM/Core/Config/MagicMerge.php +++ b/CRM/Core/Config/MagicMerge.php @@ -125,6 +125,7 @@ class CRM_Core_Config_MagicMerge { 'dateformatPartial' => array('setting'), 'dateformatTime' => array('setting'), 'dateformatYear' => array('setting'), + 'dateformatFinancialBatch' => array('setting'), 'debug' => array('setting', 'debug_enabled'), // renamed. 'defaultContactCountry' => array('setting'), 'defaultContactStateProvince' => array('setting'), diff --git a/CRM/Financial/BAO/ExportFormat/IIF.php b/CRM/Financial/BAO/ExportFormat/IIF.php index e2f0c65d14..66c1912d46 100644 --- a/CRM/Financial/BAO/ExportFormat/IIF.php +++ b/CRM/Financial/BAO/ExportFormat/IIF.php @@ -351,7 +351,8 @@ class CRM_Financial_BAO_ExportFormat_IIF extends CRM_Financial_BAO_ExportFormat $s1 = str_replace(self::$SEPARATOR, '\t', $s); switch ($type) { case 'date': - $sout = date('Y/m/d', strtotime($s1)); + $dateFormat = Civi::settings()->get('dateformatFinancialBatch'); + $sout = CRM_Utils_Date::customFormat($s1, $dateFormat); break; case 'money': diff --git a/settings/Localization.setting.php b/settings/Localization.setting.php index 0864a3f605..454b00e5de 100644 --- a/settings/Localization.setting.php +++ b/settings/Localization.setting.php @@ -324,6 +324,25 @@ return array( 'title' => 'Date Format: Year Only', 'description' => '', ), + 'dateformatFinancialBatch' => array( + 'add' => '4.7', + 'help_text' => NULL, + 'is_domain' => 1, + 'is_contact' => 0, + 'group_name' => 'Localization Preferences', + 'group' => 'localization', + 'name' => 'dateformatFinancialBatch', + 'type' => 'String', + 'quick_form_type' => 'Element', + 'html_type' => 'text', + 'html_attributes' => array( + 'size' => '12', + 'maxlength' => '60', + ), + 'default' => '%m/%d/%Y', + 'title' => 'Date Format: Financial Batch', + 'description' => '', + ), 'dateInputFormat' => array( 'add' => '4.7', 'help_text' => NULL, diff --git a/templates/CRM/Admin/Form/Setting/Date.tpl b/templates/CRM/Admin/Form/Setting/Date.tpl index 9ce2f55761..c12e3ce7f4 100644 --- a/templates/CRM/Admin/Form/Setting/Date.tpl +++ b/templates/CRM/Admin/Form/Setting/Date.tpl @@ -51,6 +51,10 @@ {$form.dateformatTime.label} {$form.dateformatTime.html} + + {$form.dateformatFinancialBatch.label} + {$form.dateformatFinancialBatch.html} +
{ts}Date Input Fields{/ts}