From 7c894b3b1d12b5abb9e3b797e8230184e50f1b4e Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 25 Jan 2019 14:02:01 +0000 Subject: [PATCH] Bug 22175: Make stock rotation table sortable This patch adds sorting and column configuration to the stock rotation tables, both rotas and items. No new defaults for the table are defined. To test, apply the patch and clear your browser cache if necessary. - Go to Tools -> Stock rotation. - In the table of rotas test that sorting works correctly. - 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. - Choose a rota with multiple items on it and select manage -> stages. Repeat the above DataTables functionality tests. - Go to Administration -> Columns settings and edit the default configuration of the stock rotation tables. Confirm that these changes are reflected in the corresponding tables. --- admin/columns_settings.yml | 35 +++++++++++++++++ .../prog/en/modules/tools/stockrotation.tt | 45 ++++++++++------------ .../intranet-tmpl/prog/js/pages/stockrotation.js | 23 +++++++++++ 3 files changed, 78 insertions(+), 25 deletions(-) diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml index c616851..4d343ab 100644 --- a/admin/columns_settings.yml +++ b/admin/columns_settings.yml @@ -765,3 +765,38 @@ modules: columnname: actions cannot_be_toggled: 1 cannot_be_modified: 1 + + stockrotation: + stock_rotation: + - + columnname: name + - + columnname: cyclical + - + columnname: active + - + columnname: description + - + columnname: number_of_items + - + columnname: actions + cannot_be_toggled: 1 + cannot_be_modified: 1 + + stock_rotation_manage_items: + - + columnname: barcode + - + columnname: title + - + columnname: author + - + columnname: call_number + - + columnname: in_transit + - + columnname: stages + - + columnname: actions + cannot_be_toggled: 1 + cannot_be_modified: 1 diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stockrotation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stockrotation.tt index 7d98a93..971125f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stockrotation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stockrotation.tt @@ -3,6 +3,7 @@ [% USE Koha %] [% USE Branches %] [% USE KohaDates %] +[% USE ColumnsSettings %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Koha › Stock rotation @@ -54,14 +55,14 @@

Stock rotation

[% IF existing_rotas.size > 0 %] - +
- + - + [% FOREACH rota IN existing_rotas %] @@ -76,12 +77,12 @@ Edit -
+
-
NameName Cyclical Active Description Number of items  
+
- - - - - - - + + + + + + + + + [% FOREACH item IN items %] @@ -497,23 +500,15 @@ [% INCLUDE 'tools-menu.inc' %] - [% MACRO jsinclude BLOCK %] [% Asset.js("js/tools-menu.js") | $raw %] [% INCLUDE 'datatables.inc' %] + [% INCLUDE 'columns_settings.inc' %] [% Asset.js("js/pages/stockrotation.js") | $raw %] - [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/stockrotation.js b/koha-tmpl/intranet-tmpl/prog/js/pages/stockrotation.js index 2763945..36a3f0d 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/pages/stockrotation.js +++ b/koha-tmpl/intranet-tmpl/prog/js/pages/stockrotation.js @@ -1,3 +1,5 @@ +/* global KohaTable columns_settings */ + function init() { $('#ajax_status').hide(); $('#ajax_saving_msg').hide(); @@ -62,4 +64,25 @@ $(document).ready(function() { }) } }); + + KohaTable("stock_rotation_manage_items", { + "aoColumnDefs": [ + { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] }, + { "sType": "anti-the", "aTargets": [ "anti-the" ] } + ], + "sPaginationType": "four_button", + "autoWidth": false, + "exportColumns": [0,1,2,3,4,5] + }, stock_rotation_items_columns_settings); + + KohaTable("stock_rotation", { + "aoColumnDefs": [ + { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] }, + { "sType": "anti-the", "aTargets": [ "anti-the" ] } + ], + "sPaginationType": "four_button", + "autoWidth": false, + "exportColumns": [0,1,2,3] + }, stock_rotation_columns_settings); + }); -- 2.1.4
BarcodeTitleAuthorCallnumberIn transitStages & duration in days
(current stage highlighted)
 
BarcodeTitleAuthorCall numberIn transitStages & duration in days
(current stage highlighted)