Bug 9723: display time due for hourly loans in the public catalog
authorOwen Leonard <oleonard@myacpl.org>
Thu, 24 Apr 2014 16:41:29 +0000 (12:41 -0400)
committerGalen Charlton <gmc@esilibrary.com>
Thu, 8 May 2014 16:38:43 +0000 (16:38 +0000)
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>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Koha/Template/Plugin/KohaDates.pm
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-details.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt
koha-tmpl/opac-tmpl/prog/en/modules/opac-course-details.tt
koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt
koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt

index 134712f..37d03af 100644 (file)
@@ -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;
index d5ff4bc..dec305f 100644 (file)
@@ -68,7 +68,7 @@
                                     <td>[% cr.item.itemcallnumber %]</td>
                                     <td>[% cr.item.copynumber %]</td>
                                     <td>[% INCLUDE 'item-status.inc' item=cr.item issue=cr.issue %]</td>
-                                    <td>[% cr.issue.date_due | $KohaDates %]</td>
+                                    <td>[% cr.issue.date_due | $KohaDates as_due_date => 1 %]</td>
                                     <td>[% cr.public_note %]</td>
                                 </tr>
                             [% END %]
index 45392ec..5e39779 100644 (file)
                     [% IF ( itemdata_copynumber ) %]<td class="copynumber">[% ITEM_RESULT.copynumber %]</td>[% END %]
                     <td class="status">[% INCLUDE 'item-status-schema-org.inc' item = ITEM_RESULT %][% INCLUDE 'item-status.inc' item = ITEM_RESULT %]</td>
                     [% IF ( itemdata_itemnotes ) %]<td class="notes" property="description">[% ITEM_RESULT.itemnotes %]</td>[% END %]
-                    <td class="date_due"><span title="[% ITEM_RESULT.datedue %]">[% ITEM_RESULT.datedue | $KohaDates %]</span></td>
+                    <td class="date_due"><span title="[% ITEM_RESULT.datedue %]">[% ITEM_RESULT.datedue | $KohaDates as_due_date => 1 %]</span></td>
                     [% IF ( OPACShowBarcode ) %]<td class="barcode" property="serialNumber">[% ITEM_RESULT.barcode %]</td>[% END %]
                     [% IF holds_count.defined || show_priority %]
                         <td class="holds_count">
index 8b73229..50c66c1 100644 (file)
                                                     <td class="date_due overdue">
                                                         <span title="[% ISSUE.date_due %]">
                                                             <span class="tdlabel">Date due:</span>
-                                                            [% ISSUE.date_due | $KohaDates %]
+                                                            [% ISSUE.date_due | $KohaDates as_due_date => 1 %]
                                                         </span>
                                                     </td>
                                                 [% ELSE %]
                                                     <td class="date_due">
                                                         <span title="[% ISSUE.date_due %]">
                                                             <span class="tdlabel">Date due:</span>
-                                                            [% ISSUE.date_due | $KohaDates %]
+                                                            [% ISSUE.date_due | $KohaDates as_due_date => 1 %]
                                                         </span>
                                                     </td>
                                                 [% END %]
                                                 <td>
                                                     <span title="[% OVERDUE.date_due %]">
                                                         <span class="tdlabel">Date due:</span>
-                                                        [% OVERDUE.date_due | $KohaDates %]
+                                                        [% OVERDUE.date_due | $KohaDates as_due_date => 1 %]
                                                     </span>
                                                 </td>
                                                 [% IF ( OpacRenewalAllowed ) %]
index 39cecbe..24b576e 100644 (file)
@@ -60,7 +60,7 @@
                             <td>[% cr.item.itemcallnumber %]</td>
                             <td>[% cr.item.copynumber %]</td>
                             <td>[% INCLUDE 'item-status.inc' item=cr.item issue=cr.issue %]</td>
-                            <td>[% cr.issue.date_due | $KohaDates %]</td>
+                            <td>[% cr.issue.date_due | $KohaDates as_due_date => 1 %]</td>
                             <td>[% cr.public_note %]</td>
                         </tr>
                     [% END %]
index d29a26a..57bbd01 100644 (file)
@@ -1570,7 +1570,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
                [% IF ( itemdata_copynumber ) %]<td class="copynumber">[% ITEM_RESULT.copynumber %]</td>[% END %]
               <td class="status">[% INCLUDE 'item-status-schema-org.inc' item = ITEM_RESULT %][% INCLUDE 'item-status.inc' item = ITEM_RESULT %]</td>
              [% IF ( itemdata_itemnotes ) %]<td class="notes" property="description">[% ITEM_RESULT.itemnotes %]</td>[% END %]
-        <td class="date_due"><span title="[% ITEM_RESULT.datedue %]">[% ITEM_RESULT.datedue | $KohaDates %]</span></td>
+        <td class="date_due"><span title="[% ITEM_RESULT.datedue %]">[% ITEM_RESULT.datedue | $KohaDates as_due_date => 1 %]</span></td>
         [% IF ( OPACShowBarcode ) %]<td class="barcode" property="serialNumber">[% ITEM_RESULT.barcode %]</td>[% END %]
         [% IF holds_count.defined || show_priority %]
         <td class="holds_count">
index 0483f29..c3a4fe1 100644 (file)
@@ -210,9 +210,9 @@ var MSG_CONFIRM_RESUME_HOLDS  = _("Are you sure you want to resume all suspended
                         [% ISSUE.author %]
                     </span></td>
                 [% IF ( ISSUE.overdue ) %]
-                    <td class="date_due overdue"><span title="[% ISSUE.date_due %]">[% ISSUE.date_due | $KohaDates %]</span></td>
+                    <td class="date_due overdue"><span title="[% ISSUE.date_due %]">[% ISSUE.date_due | $KohaDates as_due_date => 1 %]</span></td>
                 [% ELSE %]
-                    <td class="date_due"><span title="[% ISSUE.date_due %]">[% ISSUE.date_due | $KohaDates %]</span></td>
+                    <td class="date_due"><span title="[% ISSUE.date_due %]">[% ISSUE.date_due | $KohaDates as_due_date => 1 %]</span></td>
                 [% END %]
                 [% UNLESS ( item_level_itypes ) %]<td class="itype">[% IF ( ISSUE.imageurl ) %]<img src="[% ISSUE.imageurl %]" title="[% ISSUE.description %]" alt="[% ISSUE.description %]" />[% END %] [% ISSUE.description %]</td>[% END %]
                 [% IF ( show_barcode ) %]<td class="barcode">[% ISSUE.barcode %]</td>[% END %]
@@ -368,7 +368,7 @@ var MSG_CONFIRM_RESUME_HOLDS  = _("Are you sure you want to resume all suspended
 [% UNLESS ( item_level_itypes ) %]<td>[% IF ( OVERDUE.imageurl ) %]<img src="[% OVERDUE.imageurl %]" title="[% OVERDUE.description %]" alt="[% OVERDUE.description %]" />[% END %] [% OVERDUE.description %]</td>[% END %]
 [% IF ( show_barcode ) %]<td>[% OVERDUE.barcode %]</td>[% END %]
 <td>[% OVERDUE.itemcallnumber %]</td>
-<td><span title="[% OVERDUE.date_due %]">[% OVERDUE.date_due | $KohaDates %]</span></td>
+<td><span title="[% OVERDUE.date_due %]">[% OVERDUE.date_due | $KohaDates as_due_date => 1 %]</span></td>
                 [% IF ( OpacRenewalAllowed ) %]
 <td>
 [% IF ( OVERDUE.debarred ) %]Account frozen