From a8cc831735f13323fa544f99335066d981cef938 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 2 Jun 2023 11:15:32 +0200 Subject: [PATCH] Bug 33568: (follow-up) Restore filters MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This is a bit ugly but fixes the problem raised in the previous commit, as well as others for instance comment 18 "* Click 'show filters', 'hide filters' and repeat X 2 - status column disappears?" Signed-off-by: Owen Leonard Signed-off-by: Laurence Rault Signed-off-by: Emily Lamancusa Signed-off-by: Tomás Cohen Arazi Signed-off-by: Katrin Fischer --- .../tables/items/catalogue_detail.inc | 67 ++++++++++++------- 1 file changed, 41 insertions(+), 26 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc index 488227df2d..94f8e91dc8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc @@ -3,32 +3,7 @@ [% USE AuthorisedValues %] [% USE raw %] -[% BLOCK items_table %] -
- [% IF (StaffDetailItemSelection) %] - - - Show filters - - - | Select all - | Clear all - - | Actions: - [% IF CAN_user_tools_items_batchdel %] - Delete selected items - [% END %] - [% IF CAN_user_tools_items_batchmod %] - Modify selected items - [% END %] - [% IF CAN_user_editcatalogue_manage_item_groups && biblio.item_groups.count %] - Add/move to item group - Remove from item group - [% END %] - - [% END %] -
- +[% BLOCK build_table %] [% IF (StaffDetailItemSelection) %][% END %] @@ -65,6 +40,34 @@
+[% END %] +[% BLOCK items_table %] +
+ [% IF (StaffDetailItemSelection) %] + + + Show filters + + + | Select all + | Clear all + + | Actions: + [% IF CAN_user_tools_items_batchdel %] + Delete selected items + [% END %] + [% IF CAN_user_tools_items_batchmod %] + Modify selected items + [% END %] + [% IF CAN_user_editcatalogue_manage_item_groups && biblio.item_groups.count %] + Add/move to item group + Remove from item group + [% END %] + + [% END %] +
+ + [% PROCESS build_table tab => tab %] [% END %][%# end of block items_table %] @@ -211,8 +214,20 @@ otherholdings: [% TablesSettings.GetTableSettings('catalogue', 'detail','otherholdings_table','json') | $raw %], }; + let table_nodes = { + holdings: '[% PROCESS 'build_table' tab="holdings" | collapse %]', + otherholdings: '[% PROCESS 'build_table' tab="otherholdings" | collapse %]', + }; function build_items_table (tab_id, add_filters, dt_options) { + if ( dt_options && dt_options.hasOwnProperty('destroy') ) { + let table_id = "#"+tab_id+"_table"; + if( $.fn.dataTable.isDataTable(table_id) ) { + $(table_id).DataTable().destroy(); + } + $(table_id).replaceWith(table_nodes[tab_id]); + dt_options['destroy'] = null; + } let default_filters = {}; [% IF Koha.Preference('SeparateHoldings') %] [% SET SeparateHoldingsBranch = Koha.Preference('SeparateHoldingsBranch') || 'homebranch' %]; -- 2.39.5