Bug 21852: Add more columns and column configuration to overdues report
authorOwen Leonard <oleonard@myacpl.org>
Fri, 16 Nov 2018 14:51:48 +0000 (14:51 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 17 Sep 2019 13:51:00 +0000 (14:51 +0100)
This patch adds some new columns to the overdue report: Patron category,
item home library, item holding library, item type. Adding these columns
makes available columns better match the available filter fields in the
sidebar form.

Column configuration is added to this DataTable, with the new columns
defined as hidden by default in order to preserve current functionality.

This patch also fixes a bug where the home and holding branch template
variable names didn't match what was being used in the template for
pre-selecting the searched-for value in the sidebar filter menu.

To test, apply the patch and go to Circulation -> Overdues.

 - The list of overdues should look correct, with no new columns shown.
 - Test the column visibility button, showing the columns which are
   hidden by default. Confirm that the data in these columns displays
   correctly.
 - Update the default configuration for this table in Administration
   -> Configure columns. Confirm that your changes are applied to the
   overdues report.

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

admin/columns_settings.yml
circ/overdue.pl
koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt

index 3c5d2a9..1ea975d 100644 (file)
@@ -920,6 +920,37 @@ modules:
         -
           columnname: items_needed
 
+    overdues:
+      circ-overdues:
+        -
+          columnname: due_date
+        -
+          columnname: patron
+        -
+          columnname: patron_category
+          is_hidden: 1
+        -
+          columnname: patron_library
+        -
+          columnname: title
+        -
+          columnname: home_library
+          is_hidden: 1
+        -
+          columnname: holding_library
+          is_hidden: 1
+        -
+          columnname: barcode
+        -
+          columnname: call_number
+        -
+          columnname: item_type
+          is_hidden: 1
+        -
+          columnname: price
+        -
+          columnname: non-public_note
+
   opac:
     biblio-detail:
       holdingst:
index 0f286bc..0e558dc 100755 (executable)
@@ -248,7 +248,8 @@ if ($noreport) {
         items.itemcallnumber,
         items.replacementprice,
         items.enumchron,
-        items.itemnotes_nonpublic
+        items.itemnotes_nonpublic,
+        items.itype
       FROM issues
     LEFT JOIN borrowers   ON (issues.borrowernumber=borrowers.borrowernumber )
     LEFT JOIN items       ON (issues.itemnumber=items.itemnumber)
@@ -331,12 +332,13 @@ if ($noreport) {
             biblionumber           => $data->{biblionumber},
             title                  => $data->{title},
             author                 => $data->{author},
-            homebranchcode         => $data->{homebranchcode},
-            holdingbranchcode      => $data->{holdingbranchcode},
+            homebranchcode         => $data->{homebranch},
+            holdingbranchcode      => $data->{holdingbranch},
             itemcallnumber         => $data->{itemcallnumber},
             replacementprice       => $data->{replacementprice},
             itemnotes_nonpublic    => $data->{itemnotes_nonpublic},
             enumchron              => $data->{enumchron},
+            itemtype               => $data->{itype},
             patron_attr_value_loop => \@patron_attr_value_loop,
         };
     }
index c1cecc6..1e29484 100644 (file)
@@ -3,6 +3,9 @@
 [% USE KohaDates %]
 [%- USE Branches -%]
 [%- USE Price -%]
+[%- USE ItemTypes -%]
+[%- USE Categories -%]
+[%- USE ColumnsSettings -%]
 [% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Circulation &rsaquo; Items overdue as of [% todaysdate | html %]</title>
         <tr>
           <th class="title-string">Due date</th>
           <th>Patron</th>
-          <th>Library</th>
-          <th>Title</th>
+          <th>Patron category</th>
+          <th>Patron library</th>
+          <th class="anti-the">Title</th>
+          <th>Home library</th>
+          <th>Holding library</th>
           <th>Barcode</th>
           <th>Call number</th>
+          <th>Item type</th>
           <th>Price</th>
           <th>Non-public note</th>
         </tr>
                 [% IF ( overdueloo.email ) %][<a href="mailto:[% overdueloo.email | uri %]?subject=[% INCLUDE subject %] [% overdueloo.title | uri %]">email</a>][% END %]
                 [% IF ( overdueloo.phone ) %]([% overdueloo.phone | html %])[% ELSIF ( overdueloo.mobile ) %]([% overdueloo.mobile | html %])[% ELSIF ( overdueloo.phonepro ) %]([% overdueloo.phonepro | html %])[% END %]</td>
             [% END %]
-          <td>[% Branches.GetName( overdueloo.patron.branchcode ) | html %]</td>
+            <td>[% Categories.GetName( overdueloo.patron.categorycode ) | html %]</td>
+            <td>[% Branches.GetName( overdueloo.homebranchcode ) | html %]</td>
           <td>[% INCLUDE 'biblio-default-view.inc' biblionumber = overdueloo.biblionumber %][% INCLUDE 'biblio-title.inc' biblio=overdueloo %]</a> [% IF ( overdueloo.author ) %], by [% overdueloo.author | html %][% END %][% IF ( overdueloo.enumchron ) %], [% overdueloo.enumchron | html %][% END %]</td>
+            <td>[% Branches.GetName( overdueloo.holdingbranchcode ) | html %]</td>
+            <td>[% Branches.GetName( overdueloo.patron.branchcode ) | html %]</td>
           <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% overdueloo.biblionumber | uri %]&amp;itemnumber=[% overdueloo.itemnum | uri %]#item[% overdueloo.itemnum | uri %]">[% overdueloo.barcode | html %]</a></td>
           <td>[% overdueloo.itemcallnumber | html %]</td>
+            <td>[% ItemTypes.GetDescription( overdueloo.itemtype ) | html %]</td>
           <td>[% overdueloo.replacementprice | $Price %]</td>
           <td>[% overdueloo.itemnotes_nonpublic | html %]</td>
         </tr>
 [% MACRO jsinclude BLOCK %]
     [% INCLUDE 'calendar.inc' %]
     [% INCLUDE 'datatables.inc' %]
-    <script type="text/javascript">
+    [% INCLUDE 'columns_settings.inc' %]
+    <script>
         function clone_parent(node) {
             var parent = node.parentNode;
             var clone = parent.cloneNode(true);
         }
 
         $(document).ready(function(){
-            $("#overduest").dataTable($.extend(true, {}, dataTablesDefaults, {
+            var columns_settings = [% ColumnsSettings.GetColumns( 'circ', 'overdues', 'circ-overdues', 'json' ) | $raw %];
+            KohaTable("overduest", {
                 "sPaginationType": "full",
                 "aaSorting": [[0, 'asc']],
                 "aoColumnDefs": [
-                    { "sType": "title-string", "aTargets": [ "title-string" ] }
-                ]
-            }));
+                    { "sType": "title-string", "aTargets": [ "title-string" ] },
+                    { "sType": "anti-the", "aTargets" : [ "anti-the" ] }
+                ],
+                "autoWidth": false,
+                "stateSave": true
+            }, columns_settings);
         });
   </script>
 [% END %]