From c8f0445aabd532448b29c901bed751a0076b806e Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Tue, 2 Jul 2024 22:11:20 +0000 Subject: [PATCH] Bug 37238: Add column configuration to item search results table To test: 1. APPLY PATCH 2. Do an item search that will return results. 3. To the right of the table notice thee Columns, Export, Configure buttons 4. Use the Columns button to hide and show various columns, make sure it works right. 5. Use the Export button to try and export the table in various file formats. You should only see visible columns in your export. 6. Go to Admin -> Table settings, make sure you can hide columns properly from there. Signed-off-by: Sam Lau --- admin/columns_settings.yml | 52 ++++++++++++++++++ .../prog/en/modules/catalogue/itemsearch.tt | 55 ++++++++++--------- 2 files changed, 81 insertions(+), 26 deletions(-) diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml index af24061dcf..c9090c906b 100644 --- a/admin/columns_settings.yml +++ b/admin/columns_settings.yml @@ -591,6 +591,58 @@ modules: cannot_be_toggled: 1 cannot_be_modified: 1 + itemsearch: + results: + columns: + - + columnname: itemsearch_checkbox + cannot_be_toggled: 1 + cannot_be_modified: 1 + - + columnname: title + - + columnname: publication_date + - + columnname: publisher + - + columnname: collection + - + columnname: barcode + - + columnname: item_number + - + columnname: serial_enumeration + - + columnname: call_number + - + columnname: home_library + - + columnname: current_library + - + columnname: shelving_location + - + columnname: item_type + - + columnname: inventory_number + - + columnname: notforloan_status + - + columnname: lost_status + - + columnname: withdrawn_status + - + columnname: damaged_status + - + columnname: checkouts + - + columnname: last_checkout_date + - + columnname: due_date + - + columnname: actions + cannot_be_toggled: 1 + cannot_be_modified: 1 + cataloguing: addbooks: reservoir-table: diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt index 59b4c9225a..0693811def 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt @@ -2,6 +2,7 @@ [% USE To %] [% USE Asset %] [% USE AuthorisedValues %] +[% USE TablesSettings %] [% PROCESS 'i18n.inc' %] [%- BLOCK form_label -%] [%- SWITCH label -%] @@ -286,6 +287,7 @@ [% MACRO jsinclude BLOCK %] [% INCLUDE 'datatables.inc' %] + [% INCLUDE 'columns_settings.inc' %] [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %] [% Asset.js("lib/hc-sticky/hc-sticky.js") | $raw %] [% INCLUDE 'select2.inc' %] @@ -371,28 +373,28 @@ function submitForm($form) { var tr = '' + ' ' - + ' ' - + ' ' + _("Title") + '' - + ' ' + _("Publication date") + '' - + ' ' + _("Publisher") + '' - + ' ' + _("Collection") + '' - + ' ' + _("Barcode") + '' - + ' ' + _("Item number") + '' - + ' ' + _("Serial enumeration") + '' - + ' ' + _("Call number") + '' - + ' ' + _("Home library") + '' - + ' ' + _("Current library") + '' - + ' ' + _("Shelving location") + '' - + ' ' + _("Itemtype") + '' - + ' ' + _("Inventory number") + '' - + ' ' + _("Not for loan status") + '' - + ' ' + _("Lost status") + '' - + ' ' + _("Withdrawn status") + '' - + ' ' + _("Damaged status") + '' - + ' ' + _("Checkouts") + '' - + ' ' + _("Last checkout date") + '' - + ' ' + _("Due date") + '' - + ' ' + + ' ' + + ' ' + _("Title") + '' + + ' ' + _("Publication date") + '' + + ' ' + _("Publisher") + '' + + ' ' + _("Collection") + '' + + ' ' + _("Barcode") + '' + + ' ' + _("Item number") + '' + + ' ' + _("Serial enumeration") + '' + + ' ' + _("Call number") + '' + + ' ' + _("Home library") + '' + + ' ' + _("Current library") + '' + + ' ' + _("Shelving location") + '' + + ' ' + _("Itemtype") + '' + + ' ' + _("Inventory number") + '' + + ' ' + _("Not for loan status") + '' + + ' ' + _("Lost status") + '' + + ' ' + _("Withdrawn status") + '' + + ' ' + _("Damaged status") + '' + + ' ' + _("Checkouts") + '' + + ' ' + _("Last checkout date") + '' + + ' ' + _("Due date") + '' + + ' Actions' + ' '; var table = '' @@ -473,8 +475,9 @@ params.push({ 'name': $(this).attr('name'), 'value': $(this).val() }); } }); - - $('#results').dataTable($.extend(true, {}, dataTablesDefaults, { + var table_settings = [% TablesSettings.GetTableSettings( 'catalogue', 'itemsearch', 'results', 'json' ) | $raw %]; + KohaTable('results' , { + "bKohaColumnsUseNames": true, "destroy": true, "serverSide": true, "processing": true, @@ -493,7 +496,7 @@ return d; } }, - 'dom': '<"top pager"ilp>t<"bottom pager"ip>r', + 'dom': 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>', 'order': [[1, 'asc']], 'columns': [ { 'name': 'checkbox', 'orderable': false }, @@ -524,7 +527,7 @@ prepSelections(); }, fixedHeader: false // There is a bug on this view - })).columnFilter({ + }, table_settings ).columnFilter({ 'sPlaceHolder': 'head:after', "columns": [ null, -- 2.39.2