From 7b269cae041a3ed2868a6682115a2706704dbefd 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. --- admin/columns_settings.yml | 31 ++++++++++++++++++++++ .../prog/en/modules/admin/itemtypes.tt | 24 ++++++++++++----- 2 files changed, 48 insertions(+), 7 deletions(-) diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml index 3c5d2a91812..be21d3161df 100644 --- a/admin/columns_settings.yml +++ b/admin/columns_settings.yml @@ -157,6 +157,37 @@ 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: 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 6ac7988e60c..48ff15676d6 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> @@ -359,7 +360,7 @@ Item types administration <th>Default replacement cost</th> <th>Processing fee (when lost)</th> <th>Checkin message</th> - <th>Actions</th> + <th class="noExport">Actions</th> </thead> [% FOREACH itemtype IN itemtypes %] <tr> @@ -437,17 +438,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.11.0