Bugzilla – Attachment 43318 Details for
Bug 12072
New dateformat dd.mm.yyyy
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12072 - Add system preference for New dateformat dd.mm.yyyy (dmydot)
Bug-12072---Add-system-preference-for-New-dateform.patch (text/plain), 5.17 KB, created by
Marc Véron
on 2015-10-10 12:42:32 UTC
(
hide
)
Description:
Bug 12072 - Add system preference for New dateformat dd.mm.yyyy (dmydot)
Filename:
MIME Type:
Creator:
Marc Véron
Created:
2015-10-10 12:42:32 UTC
Size:
5.17 KB
patch
obsolete
>From cc89b11f8940957b11bd48839859bfd50b7ffbc0 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Marc=20V=C3=A9ron?= <veron@veron.ch> >Date: Sat, 7 Mar 2015 08:38:04 +0100 >Subject: [PATCH] Bug 12072 - Add system preference for New dateformat > dd.mm.yyyy (dmydot) > >Note: This feature depends on Bug 14870 'Delete C4/Dates from system' > >System preferences: >To test: >- apply the patch >- run updatedatabase.pl >- go to Admin > Sysprefs > I18N, change dateformat to dd.mm.yyyy, save >- verify that the value was saved > >Date handling: >- go through the staff client and verify that dates behave as expected. > The Bugs where Bug 14870 depends on contain test plans that can be > used for the overall testing. > >Note: Make sure that you reset the dateformat to the former value after > testing. >--- > Koha/DateUtils.pm | 10 ++++++++++ > .../atomicupdate/bug_12072_update_syspref_dateformat.sql | 2 ++ > installer/data/mysql/sysprefs.sql | 2 +- > .../prog/en/modules/admin/preferences/i18n_l10n.pref | 1 + > t/DateUtils.t | 4 +++- > 5 files changed, 17 insertions(+), 2 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_12072_update_syspref_dateformat.sql > >diff --git a/Koha/DateUtils.pm b/Koha/DateUtils.pm >index 7a98120..6b8a1d2 100644 >--- a/Koha/DateUtils.pm >+++ b/Koha/DateUtils.pm >@@ -86,6 +86,16 @@ sub dt_from_string { > (?<year>\d{4}) > |xms; > } >+ elsif ( $date_format eq 'dmydot' ) { >+ # dmydot format is "dd.mm.yyyy[ hh:mm:ss]" >+ $regex = qr| >+ (?<day>\d{2}) >+ . >+ (?<month>\d{2}) >+ . >+ (?<year>\d{4}) >+ |xms; >+ } > elsif ( $date_format eq 'us' ) { > # us format is "mm/dd/yyyy[ hh:mm:ss]" > $regex = qr| >diff --git a/installer/data/mysql/atomicupdate/bug_12072_update_syspref_dateformat.sql b/installer/data/mysql/atomicupdate/bug_12072_update_syspref_dateformat.sql >new file mode 100644 >index 0000000..486a674 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_12072_update_syspref_dateformat.sql >@@ -0,0 +1,2 @@ >+UPDATE systempreferences SET options = 'metric|us|iso|dmydot', explanation = 'Define global date format (us mm/dd/yyyy, metric dd/mm/yyy, ISO yyyy-mm-dd, DMY separated by dots dd.mm.yyyy)' WHERE variable = 'dateformat' >+ >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 13639f0..e0ddc17 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -95,7 +95,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('ConfirmFutureHolds','0','','Number of days for confirming future holds','Integer'), > ('CronjobLog','0',NULL,'If ON, log information from cron jobs.','YesNo'), > ('CurrencyFormat','US','US|FR','Determines the display format of currencies. eg: \'36000\' is displayed as \'360 000,00\' in \'FR\' or \'360,000.00\' in \'US\'.','Choice'), >-('dateformat','us','metric|us|iso','Define global date format (us mm/dd/yyyy, metric dd/mm/yyy, ISO yyyy-mm-dd)','Choice'), >+('dateformat','us','metric|us|iso|dmydot','Define global date format (us mm/dd/yyyy, metric dd/mm/yyy, ISO yyyy-mm-dd, dmydot dd.mm.yyyy)','Choice'), > ('DebugLevel','2','0|1|2','Define the level of debugging information sent to the browser when errors are encountered (set to 0 in production). 0=none, 1=some, 2=most','Choice'), > ('decreaseLoanHighHolds',NULL,'','Decreases the loan period for items with number of holds above the threshold specified in decreaseLoanHighHoldsValue','YesNo'), > ('decreaseLoanHighHoldsDuration',NULL,'','Specifies a number of days that a loan is reduced to when used in conjunction with decreaseLoanHighHolds','Integer'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/i18n_l10n.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/i18n_l10n.pref >index 6bf9793..89e4436 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/i18n_l10n.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/i18n_l10n.pref >@@ -6,6 +6,7 @@ I18N/L10N: > choices: > us: mm/dd/yyyy > metric: dd/mm/yyyy >+ dmydot: dd.mm.yyyy > iso: yyyy-mm-dd > - . <b>Note:</b> Do not change this preference on a production server with overdue items that are accruing fines. Doing so will result in duplicate fines! > - >diff --git a/t/DateUtils.t b/t/DateUtils.t >index 4f7c773..064b0c1 100755 >--- a/t/DateUtils.t >+++ b/t/DateUtils.t >@@ -3,7 +3,7 @@ use DateTime; > use DateTime::TimeZone; > > use C4::Context; >-use Test::More tests => 55; >+use Test::More tests => 56; > use Test::MockModule; > use Time::HiRes qw/ gettimeofday /; > use t::lib::Mocks; >@@ -196,6 +196,8 @@ $dt = eval { dt_from_string( '31/01/2015', 'us' ); }; > is( ref($dt), '', '31/01/2015 is not a correct date in us format' ); > $dt = dt_from_string( '01/01/2015', 'us' ); > is( ref($dt), 'DateTime', '01/01/2015 is a correct date in us format' ); >+$dt = dt_from_string( '01.01.2015', 'dmydot' ); >+is( ref($dt), 'DateTime', '01.01.2015 is a correct date in dmydot format' ); > > > # default value for hh and mm is 00:00 >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12072
:
27068
|
27069
|
27082
|
27107
|
27108
|
27109
|
27118
|
27130
|
36726
|
36761
|
43317
|
43318
|
44463
|
44606
|
44747
|
44964
|
44966
|
44980
|
45020
|
45022