Bug 22191: Add column configuration to libraries administration
authorOwen Leonard <oleonard@myacpl.org>
Wed, 23 Jan 2019 15:23:15 +0000 (15:23 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Wed, 30 Jan 2019 12:09:18 +0000 (12:09 +0000)
This patch adds column configuration to the table of libraries
in administration. No new defaults for the table are defined.

To test, apply the patch and clear your browser cache if necessary.

 - Go to Administration -> Libraries
   - Test that the "Column visibility" button works to show and hide
     columns. The "actions" column should be excluded.
   - Test that export options (Excel, CSV, etc) exclude the "actions"
     column.
 - Go to Administration -> Columns settings and edit the default
   configuration of the libraries table. Confirm that these
   changes are reflected in libraries administration.

Signed-off-by: Jose-Mario Monteiro-Santos <jose-mario.monteiro-santos@inLibro.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

admin/columns_settings.yml
koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt

index 8d636f1..6bc5c55 100644 (file)
@@ -157,6 +157,25 @@ modules:
           cannot_be_toggled: 1
           cannot_be_modified: 1
 
+    libraries:
+      libraries:
+        -
+          columnname: library_name
+        -
+          columnname: library_code
+        -
+          columnname: library_address
+        -
+          columnname: marc_organization_code
+        -
+          columnname: library_ip
+        -
+          columnname: is_pickup_location
+        -
+          columnname: actions
+          cannot_be_toggled: 1
+          cannot_be_modified: 1
+
 
   catalogue:
     detail:
index 4c23852..20ed241 100644 (file)
@@ -1,6 +1,7 @@
 [% USE raw %]
 [% USE Asset %]
 [% SET footerjs = 1 %]
+[% USE ColumnsSettings %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Administration &rsaquo; Libraries
 [% IF op == 'add_form' %]
 [% IF op == 'list' %]
     <h3>Libraries</h3>
     [% IF libraries.count %]
-        <table id="branchest">
+        <table id="libraries">
             <thead>
                 <tr>
                     <th>Name</th>
 [% MACRO jsinclude BLOCK %]
     [% Asset.js("js/admin-menu.js") | $raw %]
     [% INCLUDE 'datatables.inc' %]
+    [% INCLUDE 'columns_settings.inc' %]
     [% Asset.js("lib/tiny_mce/tiny_mce.js") | $raw %]
     <script>
+        var columns_settings = [% ColumnsSettings.GetColumns( 'admin', 'libraries', 'libraries', 'json' ) | $raw %];
         $(document).ready(function() {
-            $("#branchest").dataTable($.extend(true, {}, dataTablesDefaults, {
+            KohaTable("libraries", {
                 "aoColumnDefs": [
                     { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
                 ],
-                "iDisplayLength": 10,
-                "sPaginationType": "four_button"
-            }));
+                "sPaginationType": "four_button",
+                "exportColumns": [0,1,2,3,4,5]
+            }, columns_settings);
 
             [% UNLESS library %]
                 $("#Aform").on("submit", function( event ) {