Bug 21497: Correctly format dates for ILL requests in OPAC
authorOwen Leonard <oleonard@myacpl.org>
Fri, 5 Oct 2018 12:50:26 +0000 (12:50 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Fri, 19 Oct 2018 16:40:24 +0000 (16:40 +0000)
This patch updates the opac ILL template to use the $KohaDates plugin
for displaying dates. Also updated:

- Added "title-string" sorting to allow for correct sorting of dates in
  the table of requests.
- Corrected capitalization as per our capitalization rules.
- Added self-closing / to inputs as per coding guidelines.

To test, apply the patch and log in to the OPAC as a user who has
multiple outstanding ILL requests.

 - In the table of ILL requests, the "Request placed" and "Last updated"
   dates should be formatted according to your system's dateformat
   preference.
 - Sorting of those columns should work correctly.
 - View a request and confirm that "Request placed" and "Last updated"
   dates in this view are also formatted correctly.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt

index f1f8099..8091efa 100644 (file)
@@ -1,8 +1,9 @@
 [% USE raw %]
 [% USE Koha %]
+[% USE KohaDates %]
 [% USE Branches %]
 [% INCLUDE 'doc-head-open.inc' %]
-<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo;   Your Interlibrary loan requests</title>[% INCLUDE 'doc-head-close.inc' %]
+<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo;   Your interlibrary loan requests</title>[% INCLUDE 'doc-head-close.inc' %]
 [% BLOCK cssinclude %][% END %]
 </head>
 [% INCLUDE 'bodytag.inc' bodyid='opac-illrequests' bodyclass='scrollto' %]
@@ -24,9 +25,9 @@
         [% IF method != 'list' %]
             <li><a href="/cgi-bin/koha/opac-illrequests.pl">Interlibrary loan requests</a> <span class="divider">&rsaquo;</span></li>
             [% IF method == 'create' %]
-                <li>New Interlibrary loan request</li>
+                <li>New interlibrary loan request</li>
             [% ELSIF method == 'view' %]
-                <li>View Interlibrary loan request</li>
+                <li>View interlibrary loan request</li>
             [% END %]
         [% ELSE %]
             <li>Interlibrary loan requests</li>
@@ -54,7 +55,7 @@
           [% ELSE %]
             <div id="illrequests" class="maincontent">
                 [% IF method == 'create' %]
-                    <h2>New Interlibrary loan request</h2>
+                    <h2>New interlibrary loan request</h2>
                     [% IF stage == 'copyrightclearance' %]
                         [% INCLUDE messages %]
                         <div>
@@ -79,8 +80,8 @@
                                     </select>
                                 </fieldset>
                                 <fieldset class="action">
-                                    <input type="hidden" name="method" value="create">
-                                    <input type="submit" name="create_select_backend" value="Next">
+                                    <input type="hidden" name="method" value="create" />
+                                    <input type="submit" name="create_select_backend" value="Next" />
                                 </fieldset>
                             </form>
                         [% ELSE %]
                                 <th>Requested from</th>
                                 <th>Request type</th>
                                 <th>Status</th>
-                                <th>Request placed</th>
-                                <th>Last updated</th>
+                                <th class="title-string">Request placed</th>
+                                <th class="title-string">Last updated</th>
                                 <th></th>
                             </tr>
                         </thead>
                                     <td>[% request.backend | html %]</td>
                                     <td>[% request.medium | html %]</td>
                                     <td>[% request.capabilities.$status.name | html %]</td>
-                                    <td>[% request.placed | html %]</td>
-                                    <td>[% request.updated | html %]</td>
+                                    <td><span title="[% request.placed | html %]">[% request.placed | $KohaDates %]</span></td>
+                                    <td><span title="[% request.updated | html %]">[% request.updated | $KohaDates %]</span></td>
                                     <td>
                                         <a href="/cgi-bin/koha/opac-illrequests.pl?method=view&amp;illrequest_id=[% request.id | html %]" class="btn btn-default btn-small pull-right">View</a>
                                     </td>
                         </tbody>
                     </table>
                 [% ELSIF method == 'view' %]
-                    <h2>View Interlibrary loan request</h2>
+                    <h2>View interlibrary loan request</h2>
                     [% INCLUDE messages %]
                     [% status = request.status | html %]
                     <form method="post" action="?method=update" id="illrequestupdate-form" novalidate="novalidate">
                                     </li>
                                     <li>
                                         <label for="placed">Request placed:</label>
-                                        [% request.placed | html %]
+                                        [% request.placed | $KohaDates %]
                                     </li>
                                     <li>
                                         <label for="updated">Last updated:</label>
-                                        [% request.updated | html %]
+                                        [% request.updated | $KohaDates %]
                                     </li>
                                     <li>
                                         <label for="notesopac">Notes:</label>
                                 [% END %]
                             </div>
                             <fieldset class="action illrequest-actions">
-                                <input type="hidden" name="illrequest_id" value="[% request.illrequest_id | html %]">
-                                <input type="hidden" name="method" value="update">
+                                <input type="hidden" name="illrequest_id" value="[% request.illrequest_id | html %]" />
+                                <input type="hidden" name="method" value="update" />
                                 [% IF !request.completed %]
                                     [% IF request.status == "NEW" %]
                                         <a class="cancel-illrequest btn btn-danger" href="/cgi-bin/koha/opac-illrequests.pl?method=cancreq&amp;illrequest_id=[% request.illrequest_id | html %]">Request cancellation</a>
                                     [% END %]
-                                    <input type="submit" class="update-illrequest btn btn-default" value="Submit modifications">
+                                    <input type="submit" class="update-illrequest btn btn-default" value="Submit modifications" />
                                 [% END %]
                                 <span class="cancel"><a href="/cgi-bin/koha/opac-illrequests.pl">Cancel</a></span>
                             </fieldset>
     //<![CDATA[
         $("#illrequestlist").dataTable($.extend(true, {}, dataTablesDefaults, {
             "columnDefs": [
-                { "targets": [ -1 ], "sortable": false, "searchable": false }
+                { "targets": [ -1 ], "sortable": false, "searchable": false },
+                { "type": "title-string", "targets" : [ "title-string" ] }
             ],
             "order": [[ 3, "desc" ]],
             "deferRender": true