From f61c224674d80b86d56d64bd9ed23e06721f5777 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 25 Jul 2025 10:27:27 +0200 Subject: [PATCH] Bug 40753: Fix DT's SaveState on the orders table We build the the orders table depending on some conditions (sysprefs or if the basket is closed/opened). DataTables cannot correctly restore the state because the number of columns stored in localStorage is different than the one we have one the table. Test plan: Open and close a basket Confirm that the table is correctly displayed (no extra columns) --- .../prog/en/modules/acqui/basket.tt | 102 +++++++++--------- 1 file changed, 53 insertions(+), 49 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt index 2176e799594..d9b27c670c3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -563,35 +563,29 @@ - - - - - - - - - - - - - - - - - - - - [% IF Koha.Preference('EDIFACT') && ediaccount %] - - [% END %] - - [% IF ( active && !closedate ) %] - - [% END %] - [% IF !closedate || Koha.Preference('CancelOrdersInClosedBaskets') %] - - [% END %] + + + + + + + + + + + + + + + + + + + + + + + @@ -616,16 +610,10 @@ - [% IF Koha.Preference('EDIFACT') && ediaccount %] - - [% END %] - [% IF ( active && !closedate ) %] - - [% END %] - [% IF !closedate || Koha.Preference('CancelOrdersInClosedBaskets') %] - - [% END %] + + + [% END %] @@ -648,16 +636,10 @@ - [% IF Koha.Preference('EDIFACT') && ediaccount %] - - [% END %] - [% IF ( active && !closedate ) %] - - [% END %] - [% IF !closedate || Koha.Preference('CancelOrdersInClosedBaskets') %] - - [% END %] + + + @@ -801,6 +783,8 @@ [% IF Koha.Preference('EDIFACT') && ediaccount %] + [% ELSE %] + [% END %] + [% ELSE %] + [% END %] [% IF ( !closedate || Koha.Preference('CancelOrdersInClosedBaskets') ) %] + [% ELSE %] + [% END %] [% END %] @@ -1254,10 +1242,26 @@ $(document).ready(function() { var table_settings = [% TablesSettings.GetTableSettings( 'acqui', 'basket', 'orders', 'json' ) | $raw %]; [% IF !(Koha.Preference('EDIFACT') && ediaccount) %] - // FIXME This cannot work correctly without bKohaColumnsUseNames - table_settings['columns'].splice(18, 1); + table_settings.columns.find(c => c.columnname == 'supplier_report').is_hidden = 1; + table_settings.columns.find(c => c.columnname == 'supplier_report').cannot_be_toggled = 1; + [% ELSE %] + table_settings.columns.find(c => c.columnname == 'supplier_report').is_hidden = 0; + [% END %] + [% IF ( active && !closedate ) %] + table_settings.columns.find(c => c.columnname == 'modify').is_hidden = 1; + table_settings.columns.find(c => c.columnname == 'modify').cannot_be_toggled = 1; + [% ELSE %] + table_settings.columns.find(c => c.columnname == 'modify').is_hidden = 0; + [% END %] + [% IF !closedate || Koha.Preference('CancelOrdersInClosedBaskets') %] + table_settings.columns.find(c => c.columnname == 'cancel').is_hidden = 1; + table_settings.columns.find(c => c.columnname == 'modify').cannot_be_toggled = 1; + [% ELSE %] + table_settings.columns.find(c => c.columnname == 'cancel').is_hidden = 0; [% END %] + $("#orders").kohaTable({ + bKohaColumnsUseNames: true, pagingType: "full", autoWidth: false, }, table_settings); -- 2.34.1
No.[% tp('noun', 'Order') | html %]RRP tax exc.Actual cost tax exc.Budgeted cost tax exc.RRP tax inc.Actual cost tax inc.Budgeted cost tax inc.Replacement priceQty.Total tax exc. ([% currency | html %])Total tax inc. ([% currency | html %])GST %GSTFundEstimated delivery dateStatistic 1Statistic 2InvoiceSupplier reportPlace holdModifyCancel orderNo.[% tp('noun', 'Order') | html %]RRP tax exc.Actual cost tax exc.Budgeted cost tax exc.RRP tax inc.Actual cost tax inc.Budgeted cost tax inc.Replacement priceQty.Total tax exc. ([% currency | html %])Total tax inc. ([% currency | html %])GST %GSTFundEstimated delivery dateStatistic 1Statistic 2InvoiceSupplier reportPlace holdModifyCancel order
            
            
[% books_loo.suppliers_report | html %] [% IF ( books_loo.biblionumber && CAN_user_reserveforothers_place_holds ) %] @@ -828,6 +812,8 @@ > [% END %] @@ -864,6 +850,8 @@ [% END %] [% END %]