Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-19490 Add in a shortdate format setting and ensure that date fiel… #9253

Merged
merged 1 commit into from
Oct 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CRM/Admin/Form/Setting/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class CRM_Admin_Form_Setting_Date extends CRM_Admin_Form_Setting {
'dateformatYear' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME,
'dateformatTime' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME,
'dateformatFinancialBatch' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME,
'dateformatshortdate' => 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,
Expand Down
1 change: 1 addition & 0 deletions CRM/Core/Config/MagicMerge.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public static function getPropertyMap() {
'dateformatTime' => array('setting'),
'dateformatYear' => array('setting'),
'dateformatFinancialBatch' => array('setting'),
'dateformatshortdate' => array('setting'),
'debug' => array('setting', 'debug_enabled'), // renamed.
'defaultContactCountry' => array('setting'),
'defaultContactStateProvince' => array('setting'),
Expand Down
19 changes: 19 additions & 0 deletions settings/Localization.setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,25 @@
'title' => 'Date Format: Financial Batch',
'description' => '',
),
'dateformatshortdate' => array(
'add' => '4.7',
'help_text' => NULL,
'is_domain' => 1,
'is_contact' => 0,
'group_name' => 'Localization Preferences',
'group' => 'localization',
'name' => 'dateformatshortdate',
'type' => 'String',
'quick_form_type' => 'Element',
'html_type' => 'text',
'html_attributes' => array(
'size' => '12',
'maxlength' => '60',
),
'default' => '%m/%d/%Y',
'title' => 'Date Format: Short date Day Month Year',
'description' => '',
),
'dateInputFormat' => array(
'add' => '4.7',
'help_text' => NULL,
Expand Down
60 changes: 31 additions & 29 deletions sql/civicrm_generated.mysql

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions templates/CRM/Admin/Form/Setting/Date.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
<td class="label">{$form.dateformatFinancialBatch.label}</td>
<td>{$form.dateformatFinancialBatch.html}</td>
</tr>
<tr class="crm-date-form-block-dateformatTime">
<td class="label">{$form.dateformatshortdate.label}</td>
<td>{$form.dateformatshortdate.html}</td>
</tr>
</table>
</fieldset>
<fieldset><legend>{ts}Date Input Fields{/ts}</legend>
Expand Down
2 changes: 2 additions & 0 deletions templates/CRM/UF/Form/Block.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@
( $form.formName neq 'Confirm' ) AND
( $form.formName neq 'ThankYou' ) }
{include file="CRM/common/jcalendar.tpl" elementName=$n}
{elseif ( $n|substr:-5:5 eq '_date' )}
{$form.$n.value|date_format:"%Y-%m-%d"|crmDate:$config->dateformatshortdate}
{elseif $n|substr:0:5 eq 'phone'}
{assign var="phone_ext_field" value=$n|replace:'phone':'phone_ext'}
{if $prefix}{$form.$prefix.$n.html}{else}{$form.$n.html}{/if}
Expand Down