CRM-17887 - Add a new setting `Financial Batch date`
authorDilip Raj Baral <rajb.dilip@gmail.com>
Mon, 23 May 2016 06:10:22 +0000 (11:40 +0530)
committerDilip Raj Baral <rajb.dilip@gmail.com>
Thu, 26 May 2016 05:38:47 +0000 (11:08 +0530)
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.

CRM/Admin/Form/Setting/Date.php
CRM/Core/Config/MagicMerge.php
CRM/Financial/BAO/ExportFormat/IIF.php
settings/Localization.setting.php
templates/CRM/Admin/Form/Setting/Date.tpl

index 72271ae377b2a6e7d072c958b7ac5ddab09eb317..c99335a79cab58f623992f2c903e796457647067 100644 (file)
@@ -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,
index 16923909c79f25df8266c3811b1841d0289e189e..b1b84ab86814059fc9f488b1a575ab0727a98dab 100644 (file)
@@ -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'),
index e2f0c65d145213313e23e3181f8a51d69b79e438..66c1912d46e5de5a296a5560ff8aeab1a121f0bd 100644 (file)
@@ -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':
index 0864a3f60527bf392e4800138923cbd70dae4949..454b00e5dec65a22ca2d1db0331873d421cae2ab 100644 (file)
@@ -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,
index 9ce2f557615be6ba9af117e1b72e414702d5ca85..c12e3ce7f4247e702a3839eecfb9fa7b2753cd6c 100644 (file)
           <td class="label">{$form.dateformatTime.label}</td>
           <td>{$form.dateformatTime.html}</td>
        </tr>
+       <tr class="crm-date-form-block-dateformatTime">
+          <td class="label">{$form.dateformatFinancialBatch.label}</td>
+          <td>{$form.dateformatFinancialBatch.html}</td>
+       </tr>
      </table>
 </fieldset>
 <fieldset><legend>{ts}Date Input Fields{/ts}</legend>