From a2a83a4b198fe03b3ee74e4e36828538668b0a1d Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 24 Apr 2014 12:41:29 -0400 Subject: [PATCH] Bug 9723 - Hourly loans don't show time due in OPAC Content-Type: text/plain; charset="utf-8" Due dates in the OPAC don't display the time items are due, and thus items which are on hourly loans don't display an accurate due date and time. This patch corrects this by adding (and using) a new "as_due_date" option to the KohaDates plugin made possible by Bug 11148. Thanks to Galen for providing the changes to KohaDates.pm. To test, enable an hourly loan period for an itemtype in your collection. View the display of date due on the following pages: - Patron details (opac-user.pl) - Log into the OPAC as a user who has something checked out which circulates by the hour. - Bibliographic details (opac-detail.pl) - View the details for an item which is circulates by the hour and is checked out. - Course reserves details (opac-course-details.pl) - View the contents of a course reserve, one of which should be an item which circulates by the hour and is checked out. Due dates for hourly items should show both date and time and be formatted correctly. Due dates for non-hourly loans should show only the date. Test in both prog and Bootstrap themes. --- Koha/Template/Plugin/KohaDates.pm | 4 +++- .../bootstrap/en/modules/opac-course-details.tt | 2 +- .../opac-tmpl/bootstrap/en/modules/opac-detail.tt | 2 +- .../opac-tmpl/bootstrap/en/modules/opac-user.tt | 6 +++--- .../prog/en/modules/opac-course-details.tt | 2 +- koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 2 +- koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt | 6 +++--- 7 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Koha/Template/Plugin/KohaDates.pm b/Koha/Template/Plugin/KohaDates.pm index 134712f..37d03af 100644 --- a/Koha/Template/Plugin/KohaDates.pm +++ b/Koha/Template/Plugin/KohaDates.pm @@ -30,7 +30,9 @@ sub filter { return "" unless $text; $config->{with_hours} //= 0; my $dt = dt_from_string( $text, 'iso' ); - return output_pref({ dt => $dt, dateonly => !$config->{with_hours} }); + return $config->{as_due_date} ? + output_pref({ dt => $dt, as_due_date => 1 }) : + output_pref({ dt => $dt, dateonly => !$config->{with_hours} }); } 1; diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-details.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-details.tt index d5ff4bc..dec305f 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-details.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-details.tt @@ -68,7 +68,7 @@ [% cr.item.itemcallnumber %] [% cr.item.copynumber %] [% INCLUDE 'item-status.inc' item=cr.item issue=cr.issue %] - [% cr.issue.date_due | $KohaDates %] + [% cr.issue.date_due | $KohaDates as_due_date => 1 %] [% cr.public_note %] [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt index 4abf17e..4f44783 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -1199,7 +1199,7 @@ [% IF ( itemdata_copynumber ) %][% ITEM_RESULT.copynumber %][% END %] [% INCLUDE 'item-status-schema-org.inc' item = ITEM_RESULT %][% INCLUDE 'item-status.inc' item = ITEM_RESULT %] [% IF ( itemdata_itemnotes ) %][% ITEM_RESULT.itemnotes %][% END %] - [% ITEM_RESULT.datedue | $KohaDates %] + [% ITEM_RESULT.datedue | $KohaDates as_due_date => 1 %] [% IF ( OPACShowBarcode ) %][% ITEM_RESULT.barcode %][% END %] [% IF holds_count.defined || show_priority %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt index 95c597c..cb62fd4 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -172,14 +172,14 @@ Date due: - [% ISSUE.date_due | $KohaDates %] + [% ISSUE.date_due | $KohaDates as_due_date => 1 %] [% ELSE %] Date due: - [% ISSUE.date_due | $KohaDates %] + [% ISSUE.date_due | $KohaDates as_due_date => 1 %] [% END %] @@ -428,7 +428,7 @@ Date due: - [% OVERDUE.date_due | $KohaDates %] + [% OVERDUE.date_due | $KohaDates as_due_date => 1 %] [% IF ( OpacRenewalAllowed ) %] diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-course-details.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-course-details.tt index 39cecbe..24b576e 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-course-details.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-course-details.tt @@ -60,7 +60,7 @@ [% cr.item.itemcallnumber %] [% cr.item.copynumber %] [% INCLUDE 'item-status.inc' item=cr.item issue=cr.issue %] - [% cr.issue.date_due | $KohaDates %] + [% cr.issue.date_due | $KohaDates as_due_date => 1 %] [% cr.public_note %] [% END %] diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt index 7ffbbd0..de3ed9c 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -1581,7 +1581,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% IF ( itemdata_copynumber ) %][% ITEM_RESULT.copynumber %][% END %] [% INCLUDE 'item-status-schema-org.inc' item = ITEM_RESULT %][% INCLUDE 'item-status.inc' item = ITEM_RESULT %] [% IF ( itemdata_itemnotes ) %][% ITEM_RESULT.itemnotes %][% END %] - [% ITEM_RESULT.datedue | $KohaDates %] + [% ITEM_RESULT.datedue | $KohaDates as_due_date => 1 %] [% IF ( OPACShowBarcode ) %][% ITEM_RESULT.barcode %][% END %] [% IF holds_count.defined || show_priority %] diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt index e9fe2d2..e050a46 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt @@ -184,9 +184,9 @@ var MSG_CONFIRM_RESUME_HOLDS = _("Are you sure you want to resume all suspended [% ISSUE.author %] [% IF ( ISSUE.overdue ) %] - [% ISSUE.date_due | $KohaDates %] + [% ISSUE.date_due | $KohaDates as_due_date => 1 %] [% ELSE %] - [% ISSUE.date_due | $KohaDates %] + [% ISSUE.date_due | $KohaDates as_due_date => 1 %] [% END %] [% UNLESS ( item_level_itypes ) %][% IF ( ISSUE.imageurl ) %][% ISSUE.description %][% END %] [% ISSUE.description %][% END %] [% IF ( show_barcode ) %][% ISSUE.barcode %][% END %] @@ -342,7 +342,7 @@ var MSG_CONFIRM_RESUME_HOLDS = _("Are you sure you want to resume all suspended [% UNLESS ( item_level_itypes ) %][% IF ( OVERDUE.imageurl ) %][% OVERDUE.description %][% END %] [% OVERDUE.description %][% END %] [% IF ( show_barcode ) %][% OVERDUE.barcode %][% END %] [% OVERDUE.itemcallnumber %] -[% OVERDUE.date_due | $KohaDates %] +[% OVERDUE.date_due | $KohaDates as_due_date => 1 %] [% IF ( OpacRenewalAllowed ) %] [% IF ( OVERDUE.debarred ) %]Account frozen -- 1.7.9.5