Bug 20526: Show and sort by date of request in pending discharges table
authorOwen Leonard <oleonard@myacpl.org>
Thu, 5 Apr 2018 13:59:18 +0000 (13:59 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 6 Apr 2018 17:51:15 +0000 (14:51 -0300)
This patch adds a "date requested" column to the table of pending
discharges, and updates the DataTables configuration to sort by this
column by default.

The patch also makes some other changes:

- Table information and filtering have been added.
- The "Allow" link has been converted to a Bootstrap-styled buttong with
  an icon.

To test, apply the patch and view the table of pending discharge
requests. It should be sorted by default by date requested.

- Confirm that date sorting is correct.
- Confirm that other columns still sort correctly.
- Confirm that buttons look right.
- Confirm that the table information is correct.
- Confirm that the table search form works.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
koha-tmpl/intranet-tmpl/prog/en/modules/members/discharges.tt

index 2f63f3d..254a1d9 100644 (file)
@@ -1,4 +1,5 @@
 [% USE Branches %]
+[% USE KohaDates %]
 [% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Patrons &rsaquo; Pending discharge requests</title>
@@ -23,6 +24,7 @@
             <tr>
               <th>Patron</th>
               <th>Library</th>
+              <th class="title-string">Date requested</th>
               <th>Allow</th>
             </tr>
           </thead>
@@ -31,7 +33,8 @@
               <tr>
                 <td><a href="/cgi-bin/koha/members/discharge.pl?borrowernumber=[% d.borrower.borrowernumber %]">[% d.borrower.surname %], [% d.borrower.firstname %]</a></td>
                 <td>[% d.borrower.branchcode.branchname %]</td>
-                <td><a href="/cgi-bin/koha/members/discharges.pl?op=allow&borrowernumber=[% d.borrower.borrowernumber %]">Allow</a></td>
+                <td><span title="[% d.needed %]">[% d.needed | $KohaDates %]</span></td>
+                <td><a class="btn btn-xs btn-default" href="/cgi-bin/koha/members/discharges.pl?op=allow&borrowernumber=[% d.borrower.borrowernumber %]"><i class="fa fa-check"></i> Allow</a></td>
               </tr>
             [% END %]
           </tbody>
         $(document).ready(function() {
             $('#pending_updates table').DataTable($.extend(true, {}, dataTablesDefaults, {
                 paging: false,
-                info: false,
-                searching: false,
-                order: [],
+                info: true,
+                searching: true,
+                order: [[2, "asc"]],
                 columnDefs: [
                     { targets: -1, orderable: false },
+                    { "sType": "title-string", "aTargets" : [ "title-string" ] }
                 ],
             }));
         });