Bugzilla – Attachment 13906 Details for
Bug 9014
Add time due to slips
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9014 - Add time due to slips
Bug-9014---Add-time-due-to-slips.patch (text/plain), 5.70 KB, created by
Kyle M Hall (khall)
on 2012-12-06 14:25:47 UTC
(
hide
)
Description:
Bug 9014 - Add time due to slips
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2012-12-06 14:25:47 UTC
Size:
5.70 KB
patch
obsolete
>From 3271503513517ccb7522cb3555466bdaad20fceb Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 6 Nov 2012 14:00:06 -0500 >Subject: [PATCH] Bug 9014 - Add time due to slips > >This patch modifies Koha::DateUtils::output_pref to support the new system preference TimeFormat, which defines the visual format for a time as either the 24 hour format ( default ), or the 12 hour format (HH:MM AM/PM). > >The patch also modifies C4::Members::IssueSlip to use output_pref rather than format_date. > >Test Plan: >1) Apply patch >2) Run updatedatabase.pl >3) Issue an item to a patron, verify the times are in 24 hour format. >4) Switch TimeFormat to the 12 hour format. >5) Revist the patron record you issued an item to, times should now be in a 12 hour format. >6) Print a slip for this patron, you should now see the time as well as the date. >--- > 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(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index f381a41..8dec46c 100644 >--- a/C4/Members.pm >+++ b/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; > >diff --git a/Koha/DateUtils.pm b/Koha/DateUtils.pm >index 4ffc160..b4d8bee 100644 >--- a/Koha/DateUtils.pm >+++ b/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"); > } > > } >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 0cc5a54..b399f52 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/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'); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 6908704..8ec8923 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/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) >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 cc6700b..374db6d 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 >@@ -9,6 +9,14 @@ I18N/L10N: > iso: yyyy-mm-dd > - . > - >+ - Format times string >+ - pref: TimeFormat >+ default: 24hr >+ choices: >+ 24hr: 24 hour format >+ 12hr: 12 hour format >+ - . >+ - > - Use > - pref: CalendarFirstDayOfWeek > default: Sunday >-- >1.7.2.5
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 9014
:
13272
|
13273
|
13507
|
13827
|
13906
|
13907
|
14164
|
14373
|
14374
|
14396
|
16411
|
16417
|
16424