Bug 9723 - Hourly loans don't show time due in OPAC
Summary: Hourly loans don't show time due in OPAC
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Owen Leonard
QA Contact:
URL:
Keywords:
Depends on:
Blocks: 9724
  Show dependency treegraph
 
Reported: 2013-02-27 15:29 UTC by Kyle M Hall
Modified: 2015-06-04 23:33 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 9723 - Hourly loans don't show time due in OPAC (10.38 KB, patch)
2014-04-24 16:53 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 9723 - Hourly loans don't show time due in OPAC (10.77 KB, patch)
2014-04-24 19:17 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 9723 - Hourly loans don't show time due in OPAC (10.87 KB, patch)
2014-05-06 09:07 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 9723 - Hourly loans don't show time due in OPAC (10.94 KB, patch)
2014-05-08 16:07 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle M Hall 2013-02-27 15:29:49 UTC
The time an item is due does not display on the patron's record in the OPAC.
Comment 1 Owen Leonard 2014-04-24 16:53:53 UTC Comment hidden (obsolete)
Comment 2 Galen Charlton 2014-04-24 18:17:14 UTC
(In reply to Owen Leonard from comment #1)
> However, without doing a check of each item's circulation policy every
> time we display the due date I don't know how you can tell it's an
> hourly loan. Assume that items due at 23:59 are non-hourly?

See bug 11148.  The new 'as_due_date' option could be added to the KohaDates TT filter as well, and it does indeed assume that any loans that are due at a time other than 23:59 are hourly.  That way, there would be no way to clutter up the due date display for daily loans.
Comment 3 Galen Charlton 2014-04-24 18:22:36 UTC
The following diff shows how the TT filter might be updated to add a as_due_date option:

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;
Comment 4 Owen Leonard 2014-04-24 19:17:43 UTC Comment hidden (obsolete)
Comment 5 Biblibre Sandboxes 2014-05-06 05:27:56 UTC
Patch tested with a sandbox, by Aleisha <aleishaamohia@hotmail.com>
Comment 6 Jonathan Druart 2014-05-06 09:07:31 UTC Comment hidden (obsolete)
Comment 7 Jonathan Druart 2014-05-06 09:08:14 UTC
I added the signoff manually. It seems something went wrong on signing off from the sandbox.
Comment 8 Jonathan Druart 2014-05-08 16:07:25 UTC
Created attachment 28114 [details] [review]
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 <aleishaamohia@hotmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 9 Galen Charlton 2014-05-08 16:44:43 UTC
Pushed to master.  Thanks, Owen!