View | Details | Raw Unified | Return to bug 12072
Collapse All | Expand All

(-)a/Koha/DateUtils.pm (+16 lines)
Lines 85-90 sub dt_from_string { Link Here
85
            (?<year>\d{4})
85
            (?<year>\d{4})
86
        |xms;
86
        |xms;
87
    }
87
    }
88
    elsif ( $date_format eq 'dmydot' ) {
89
        # dmydot format is "dd.mm.yyyy[ hh:mm:ss]"
90
        $regex = qr|
91
            (?<day>\d{2})
92
            .
93
            (?<month>\d{2})
94
            .
95
            (?<year>\d{4})
96
        |xms;
97
    }
88
    elsif ( $date_format eq 'us' ) {
98
    elsif ( $date_format eq 'us' ) {
89
        # us format is "mm/dd/yyyy[ hh:mm:ss]"
99
        # us format is "mm/dd/yyyy[ hh:mm:ss]"
90
        $regex = qr|
100
        $regex = qr|
Lines 231-236 sub output_pref { Link Here
231
          ? $dt->strftime("%d/%m/%Y")
241
          ? $dt->strftime("%d/%m/%Y")
232
          : $dt->strftime("%d/%m/%Y $time");
242
          : $dt->strftime("%d/%m/%Y $time");
233
    }
243
    }
244
    elsif ( $pref =~ m/^dmydot/ ) {
245
        $date = $dateonly
246
          ? $dt->strftime("%d.%m.%Y")
247
          : $dt->strftime("%d.%m.%Y $time");
248
    }
249
234
    elsif ( $pref =~ m/^us/ ) {
250
    elsif ( $pref =~ m/^us/ ) {
235
        $date = $dateonly
251
        $date = $dateonly
236
          ? $dt->strftime("%m/%d/%Y")
252
          ? $dt->strftime("%m/%d/%Y")
(-)a/installer/data/mysql/atomicupdate/bug_12072_update_syspref_dateformat.sql (+1 lines)
Line 0 Link Here
1
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'
(-)a/installer/data/mysql/sysprefs.sql (-1 / +1 lines)
Lines 99-105 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
99
('ConsiderOnSiteCheckoutsAsNormalCheckouts','1',NULL,'Consider on-site checkouts as normal checkouts','YesNo'),
99
('ConsiderOnSiteCheckoutsAsNormalCheckouts','1',NULL,'Consider on-site checkouts as normal checkouts','YesNo'),
100
('CronjobLog','0',NULL,'If ON, log information from cron jobs.','YesNo'),
100
('CronjobLog','0',NULL,'If ON, log information from cron jobs.','YesNo'),
101
('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'),
101
('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'),
102
('dateformat','us','metric|us|iso','Define global date format (us mm/dd/yyyy, metric dd/mm/yyy, ISO yyyy-mm-dd)','Choice'),
102
('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'),
103
('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'),
103
('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'),
104
('decreaseLoanHighHolds',NULL,'','Decreases the loan period for items with number of holds above the threshold specified in decreaseLoanHighHoldsValue','YesNo'),
104
('decreaseLoanHighHolds',NULL,'','Decreases the loan period for items with number of holds above the threshold specified in decreaseLoanHighHoldsValue','YesNo'),
105
('decreaseLoanHighHoldsDuration',NULL,'','Specifies a number of days that a loan is reduced to when used in conjunction with decreaseLoanHighHolds','Integer'),
105
('decreaseLoanHighHoldsDuration',NULL,'','Specifies a number of days that a loan is reduced to when used in conjunction with decreaseLoanHighHolds','Integer'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/i18n_l10n.pref (+1 lines)
Lines 6-11 I18N/L10N: Link Here
6
          choices:
6
          choices:
7
              us: mm/dd/yyyy
7
              us: mm/dd/yyyy
8
              metric: dd/mm/yyyy
8
              metric: dd/mm/yyyy
9
              dmydot: dd.mm.yyyy
9
              iso: yyyy-mm-dd
10
              iso: yyyy-mm-dd
10
        - . <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!
11
        - . <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!
11
    -
12
    -
(-)a/t/DateUtils.t (-2 / +5 lines)
Lines 3-9 use DateTime; Link Here
3
use DateTime::TimeZone;
3
use DateTime::TimeZone;
4
4
5
use C4::Context;
5
use C4::Context;
6
use Test::More tests => 59;
6
7
use Test::More tests => 60;
8
7
use Test::MockModule;
9
use Test::MockModule;
8
use Test::Warn;
10
use Test::Warn;
9
use Time::HiRes qw/ gettimeofday /;
11
use Time::HiRes qw/ gettimeofday /;
Lines 197-202 $dt = eval { dt_from_string( '31/01/2015', 'us' ); }; Link Here
197
is( ref($dt), '', '31/01/2015 is not a correct date in us format' );
199
is( ref($dt), '', '31/01/2015 is not a correct date in us format' );
198
$dt = dt_from_string( '01/01/2015', 'us' );
200
$dt = dt_from_string( '01/01/2015', 'us' );
199
is( ref($dt), 'DateTime', '01/01/2015 is a correct date in us format' );
201
is( ref($dt), 'DateTime', '01/01/2015 is a correct date in us format' );
202
$dt = dt_from_string( '01.01.2015', 'dmydot' );
203
is( ref($dt), 'DateTime', '01.01.2015 is a correct date in dmydot format' );
200
204
201
205
202
# default value for hh and mm is 00:00
206
# default value for hh and mm is 00:00
203
- 

Return to bug 12072