From 6f0215da9efcd1d7dba02aba5dde327f8d17b13f Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 24 Apr 2014 12:41:29 -0400 Subject: [PATCH] Bug 9723: display time due for hourly loans in the public catalog 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 Signed-off-by: Galen Charlton --- Koha/Template/Plugin/KohaDates.pm | 4 +++- .../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 134712f40c..37d03af52d 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 d5ff4bce23..dec305f6f9 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 45392ec9ac..5e39779ac0 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 8b732293fc..50c66c1462 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 39cecbef39..24b576e268 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 d29a26a147..57bbd013f6 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 0483f29523..c3a4fe1e66 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 -- 2.39.5