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

(-)a/Koha/DateUtils.pm (+10 lines)
Lines 86-91 sub dt_from_string { Link Here
86
            (?<year>\d{4})
86
            (?<year>\d{4})
87
        |xms;
87
        |xms;
88
    }
88
    }
89
    elsif ( $date_format eq 'dmydot' ) {
90
        # dmydot format is "dd.mm.yyyy[ hh:mm:ss]"
91
        $regex = qr|
92
            (?<day>\d{2})
93
            .
94
            (?<month>\d{2})
95
            .
96
            (?<year>\d{4})
97
        |xms;
98
    }
89
    elsif ( $date_format eq 'us' ) {
99
    elsif ( $date_format eq 'us' ) {
90
        # us format is "mm/dd/yyyy[ hh:mm:ss]"
100
        # us format is "mm/dd/yyyy[ hh:mm:ss]"
91
        $regex = qr|
101
        $regex = qr|
(-)a/installer/data/mysql/atomicupdate/bug_12072_update_syspref_dateformat.sql (+2 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'
2
(-)a/installer/data/mysql/sysprefs.sql (-1 / +1 lines)
Lines 95-101 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
95
('ConfirmFutureHolds','0','','Number of days for confirming future holds','Integer'),
95
('ConfirmFutureHolds','0','','Number of days for confirming future holds','Integer'),
96
('CronjobLog','0',NULL,'If ON, log information from cron jobs.','YesNo'),
96
('CronjobLog','0',NULL,'If ON, log information from cron jobs.','YesNo'),
97
('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'),
97
('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'),
98
('dateformat','us','metric|us|iso','Define global date format (us mm/dd/yyyy, metric dd/mm/yyy, ISO yyyy-mm-dd)','Choice'),
98
('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'),
99
('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'),
99
('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'),
100
('decreaseLoanHighHolds',NULL,'','Decreases the loan period for items with number of holds above the threshold specified in decreaseLoanHighHoldsValue','YesNo'),
100
('decreaseLoanHighHolds',NULL,'','Decreases the loan period for items with number of holds above the threshold specified in decreaseLoanHighHoldsValue','YesNo'),
101
('decreaseLoanHighHoldsDuration',NULL,'','Specifies a number of days that a loan is reduced to when used in conjunction with decreaseLoanHighHolds','Integer'),
101
('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 / +3 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 => 55;
6
use Test::More tests => 56;
7
use Test::MockModule;
7
use Test::MockModule;
8
use Time::HiRes qw/ gettimeofday /;
8
use Time::HiRes qw/ gettimeofday /;
9
use t::lib::Mocks;
9
use t::lib::Mocks;
Lines 196-201 $dt = eval { dt_from_string( '31/01/2015', 'us' ); }; Link Here
196
is( ref($dt), '', '31/01/2015 is not a correct date in us format' );
196
is( ref($dt), '', '31/01/2015 is not a correct date in us format' );
197
$dt = dt_from_string( '01/01/2015', 'us' );
197
$dt = dt_from_string( '01/01/2015', 'us' );
198
is( ref($dt), 'DateTime', '01/01/2015 is a correct date in us format' );
198
is( ref($dt), 'DateTime', '01/01/2015 is a correct date in us format' );
199
$dt = dt_from_string( '01.01.2015', 'dmydot' );
200
is( ref($dt), 'DateTime', '01.01.2015 is a correct date in dmydot format' );
199
201
200
202
201
# default value for hh and mm is 00:00
203
# default value for hh and mm is 00:00
202
- 

Return to bug 12072