From 8eaa90c6322529afe07d9ec901bdd3c94918b4d5 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 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. Signed-off-by: Aleisha Signed-off-by: Jonathan Druart --- Koha/Template/Plugin/KohaDates.pm | 4 +++- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-details.tt | 2 +- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt | 2 +- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt | 6 +++--- koha-tmpl/opac-tmpl/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 45392ec..5e39779 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -1209,7 +1209,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 8b73229..50c66c1 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -190,14 +190,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 %] @@ -446,7 +446,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 d29a26a..57bbd01 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -1570,7 +1570,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 0483f29..c3a4fe1 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt @@ -210,9 +210,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 %] @@ -368,7 +368,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.10.4