From 42f4249bf1e5087d84606e95d07a24865af1e15e Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 13 Sep 2019 12:57:24 +0000 Subject: [PATCH] Bug 23606: Add columns configuration and export options to item types administration This patch adds column configuration to the table of item types 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 -> Item types. - 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 item types table. Confirm that these changes are reflected in item tyeps administration. Test with noItemTypeImages on and off. Signed-off-by: Maryse Simard Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize --- admin/columns_settings.yml | 33 +++++++++++++++++++ .../prog/en/modules/admin/itemtypes.tt | 24 ++++++++++---- 2 files changed, 50 insertions(+), 7 deletions(-) diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml index 1ea975dce2..4b8600367c 100644 --- a/admin/columns_settings.yml +++ b/admin/columns_settings.yml @@ -157,6 +157,39 @@ modules: cannot_be_toggled: 1 cannot_be_modified: 1 + itemtypes: + table_item_type: + - + columnname: image + - + columnname: code + - + columnname: description + - + columnname: search_category + - + columnname: not_for_loan + - + columnname: hide_in_opac + - + columnname: rental_charge + - + columnname: daily_rental_charge + - + columnname: hourly_rental_charge + - + columnname: default_replacement_cost + - + columnname: lost_processing_fee + - + columnname: checkin_message + - + columnname: library_limitations + - + columnname: actions + cannot_be_toggled: 1 + cannot_be_modified: 1 + libraries: libraries: - diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt index 666701f312..2330e84779 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt @@ -3,6 +3,7 @@ [% USE Koha %] [% USE AuthorisedValues %] [% USE Price %] +[% USE ColumnsSettings %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Koha › Administration › Item types [% IF op == 'add_form' %]› @@ -347,7 +348,7 @@ Item types administration [% IF itemtypes %] <table id="table_item_type"> <thead> - [% UNLESS Koha.Preference('noItemTypeImages') %]<th>Image</th>[% END %] + [% UNLESS Koha.Preference('noItemTypeImages') %]<th class="noExport">Image</th>[% END %] <th>Code</th> <th>Description</th> <th>Search category</th> @@ -360,7 +361,7 @@ Item types administration <th>Processing fee (when lost)</th> <th>Checkin message</th> <th>Library limitations</th> - <th>Actions</th> + <th class="noExport">Actions</th> </thead> [% FOREACH itemtype IN itemtypes %] <tr> @@ -458,17 +459,26 @@ Item types administration [% Asset.js("js/admin-menu.js") | $raw %] [% INCLUDE 'greybox.inc' %] [% INCLUDE 'datatables.inc' %] + [% INCLUDE 'columns_settings.inc' %] <script> $(document).ready(function() { $('#icons').tabs(); - $("#table_item_type").dataTable($.extend(true, {}, dataTablesDefaults, { - "aoColumnDefs": [ - { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }, - ], + var columns_settings = [% ColumnsSettings.GetColumns( 'admin', 'itemtypes', 'table_item_type', 'json' ) | $raw %]; + [% IF Koha.Preference('noItemTypeImages') %] + columns_settings.shift(); // Remove item type image column from configuration + [% END %] + + $(document).ready(function() { + KohaTable("table_item_type", { + "aoColumnDefs": [ + { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }, + ], "aaSorting": [[ 2, "asc" ]], "iDisplayLength": 10, "sPaginationType": "full" - })); + }, columns_settings); + }); + $( "#itemtypeentry" ).validate({ rules: { itemtype: { required: true }, -- 2.39.5