@@ -, +, @@ --- C4/Members.pm | 4 ++-- Koha/DateUtils.pm | 20 ++++++++++++-------- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 +++++++ .../en/modules/admin/preferences/i18n_l10n.pref | 8 ++++++++ 5 files changed, 30 insertions(+), 10 deletions(-) --- a/C4/Members.pm +++ a/C4/Members.pm @@ -2302,8 +2302,8 @@ sub IssueSlip { elsif ((substr $it->{'date_due'}, 0, 10) le $now) { $it->{'overdue'} = 1; } - - $it->{'date_due'}=format_date($it->{'date_due'}); + my $dt = dt_from_string( $it->{'date_due'} ); + $it->{'date_due'} = output_pref( $dt );; } my @issues = sort { $b->{'timestamp'} <=> $a->{'timestamp'} } @$issueslist; --- a/Koha/DateUtils.pm +++ a/Koha/DateUtils.pm @@ -115,26 +115,30 @@ sub output_pref { my $pref = defined $force_pref ? $force_pref : C4::Context->preference('dateformat'); + + my $time = ( C4::Context->preference('TimeFormat') eq '12hr' ) ? '%I:%M %p' : '%H:%M'; + given ($pref) { when (/^iso/) { return $dateonly - ? $dt->strftime('%Y-%m-%d') - : $dt->strftime('%Y-%m-%d %H:%M'); + ? $dt->strftime("%Y-%m-%d") + : $dt->strftime("%Y-%m-%d $time"); } when (/^metric/) { return $dateonly - ? $dt->strftime('%d/%m/%Y') - : $dt->strftime('%d/%m/%Y %H:%M'); + ? $dt->strftime("%d/%m/%Y") + : $dt->strftime("%d/%m/%Y $time"); } when (/^us/) { + return $dateonly - ? $dt->strftime('%m/%d/%Y') - : $dt->strftime('%m/%d/%Y %H:%M'); + ? $dt->strftime("%m/%d/%Y") + : $dt->strftime("%m/%d/%Y $time"); } default { return $dateonly - ? $dt->strftime('%Y-%m-%d') - : $dt->strftime('%Y-%m-%d %H:%M'); + ? $dt->strftime("%Y-%m-%d") + : $dt->strftime("%Y-%m-%d $time"); } } --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -388,3 +388,4 @@ INSERT INTO systempreferences (variable, value, options, explanation, type) VALU INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('HoldsToPullStartDate','2','Set the default start date for the Holds to pull list to this many days ago',NULL,'Integer'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('alphabet','A B C D E F G H I J K L M N O P Q R S T U V W X Y Z','Alphabet than can be expanded into browse links, e.g. on Home > Patrons',NULL,'free'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('RefundLostItemFeeOnReturn', '1', 'If enabled, the lost item fee charged to a borrower will be refunded when the lost item is returned.', NULL, 'YesNo'); +INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('TimeFormat','24hr','12hr|24hr','Defines the global time format for visual output.','Choice'); --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -6125,6 +6125,13 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.11.00.XXX"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('TimeFormat','24hr','12hr|24hr','Defines the global time format for visual output.','Choice')"); + print "Upgrade to $DBversion done (Add syspref TimeFormat)\n"; + SetVersion ($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/i18n_l10n.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/i18n_l10n.pref @@ -9,6 +9,14 @@ I18N/L10N: iso: yyyy-mm-dd - . - + - Format times in + - pref: TimeFormat + default: 24hr + choices: + 24hr: 24 hour format ( e.g. "14:18" ) + 12hr: 12 hour format ( e.g. "02:18 PM" ) + - . + - - Use - pref: CalendarFirstDayOfWeek default: Sunday --