From 7fae989c44518109b7d3d045bd61ee0f1fc78b2d Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 19 Nov 2024 10:25:06 +0100 Subject: [PATCH] Bug 38482: Remove save state for the holdings tables On the holdings table of the bibliographic record detail page, we have a special behaviour: we hide columns if there is no data to display. Indeed we have a lot of column and we want to limit the number of columns displayed. This behaviour conflicts with "Save state": when the columns are hidden the state is modified. If you leave the page and come back, the column will stay hidden, even if the global settings does not have it as hidden and even if the user didn't explicitly hide it. We want to implement something correctly to prevent a conflict with those 2 behaviours, but 24.11.00 is coming and we need a quick fix: here we are going to remove save state for these 2 tables. Test plan: Apply this patch, restart_all Go to the tables settings admin, jump to holdings_table Notice that "Save configuration state on page change" is turned off by default Go to catalogue/detail.plbiblionumber=13 (item does not have call number) => "Call number" column is not displayed Edit the item, set a call number Go to catalogue/detail.plbiblionumber=13 (item has call number) => "Call number" column is displayed Go to the tables settings admin, jump to holdings_table Turn on "Save configuration state on page change" Go to catalogue/detail.plbiblionumber=1 (item does not have call number) => "Call number" column is not displayed Edit the item, set a call number Go to catalogue/detail.plbiblionumber=13 (item does not have call number) => "Call number" column is still not displayed This can be considered a bug, that why we are disabling the feature for this table. Signed-off-by: Michaela Sieber --- C4/Utils/DataTables/TablesSettings.pm | 13 +++++++++---- admin/columns_settings.yml | 2 ++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/C4/Utils/DataTables/TablesSettings.pm b/C4/Utils/DataTables/TablesSettings.pm index 0d2f87f39e0..40fe890160b 100644 --- a/C4/Utils/DataTables/TablesSettings.pm +++ b/C4/Utils/DataTables/TablesSettings.pm @@ -101,19 +101,24 @@ sub get_table_settings { } )->next; + my $table_settings = $list->{modules}->{$module}->{$page}->{$tablename}; return { default_display_length => $rs ? $rs->default_display_length - : $list->{modules}{$module}{$page}{$tablename}{default_display_length}, + : $table_settings->{default_display_length}, default_sort_order => $rs ? $rs->default_sort_order - : $list->{modules}{$module}{$page}{$tablename}{default_sort_order}, + : $table_settings->{default_sort_order}, default_save_state => $rs ? $rs->default_save_state - : 1, + : exists $table_settings->{default_save_state} + ? $table_settings->{default_save_state} + : 1, default_save_state_search => $rs ? $rs->default_save_state_search - : $list->{modules}{$module}{$page}{$tablename}{default_save_state_search}, + : exists $table_settings->{default_save_state_search} + ? $table_settings->{default_save_state_search} + : 0, }; } diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml index 815fcee119a..cf3beff5585 100644 --- a/admin/columns_settings.yml +++ b/admin/columns_settings.yml @@ -420,6 +420,7 @@ modules: detail: holdings_table: default_display_length: 20 + default_save_state: 0 columns: - columnname: checkbox @@ -490,6 +491,7 @@ modules: otherholdings_table: default_display_length: 20 + default_save_state: 0 columns: - columnname: checkbox -- 2.34.1