From 4e9fcab5745003287a94847140807298908b5ca0 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 3 Oct 2024 09:06:55 +0200 Subject: [PATCH] Bug 33484: Make default_save_state default to 1 Signed-off-by: Pedro Amorim Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer --- C4/Utils/DataTables/TablesSettings.pm | 34 +++++++++++-------- .../data/mysql/atomicupdate/bug_33484.pl | 2 +- installer/data/mysql/kohastructure.sql | 2 +- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/C4/Utils/DataTables/TablesSettings.pm b/C4/Utils/DataTables/TablesSettings.pm index 28e1b257c5..9d7f23b4a3 100644 --- a/C4/Utils/DataTables/TablesSettings.pm +++ b/C4/Utils/DataTables/TablesSettings.pm @@ -57,14 +57,17 @@ sub get_columns { my $columns = $list->{modules}{$module}{$page}{$tablename}{columns} || []; # Assign default value if does not exist - $columns = [ map { - { - cannot_be_toggled => exists $_->{cannot_be_toggled} ? $_->{cannot_be_toggled} : 0, - cannot_be_modified => exists $_->{cannot_be_modified} ? $_->{cannot_be_modified} : 0, - is_hidden => exists $_->{is_hidden} ? $_->{is_hidden} : 0, - columnname => $_->{columnname}, - } - } @$columns ]; + $columns = [ + map { + { + cannot_be_toggled => exists $_->{cannot_be_toggled} ? $_->{cannot_be_toggled} : 0, + cannot_be_modified => exists $_->{cannot_be_modified} ? $_->{cannot_be_modified} : 0, + is_hidden => exists $_->{is_hidden} ? $_->{is_hidden} : 0, + default_save_state => exists $_->{default_save_state} ? $_->{default_save_state} : 1, + columnname => $_->{columnname}, + } + } @$columns + ]; return $columns; } @@ -100,12 +103,15 @@ sub get_table_settings { )->next; return { - default_display_length => $rs ? $rs->default_display_length - : $list->{modules}{$module}{$page}{$tablename}{default_display_length}, - default_sort_order => $rs ? $rs->default_sort_order - : $list->{modules}{$module}{$page}{$tablename}{default_sort_order}, - default_save_state => $rs ? $rs->default_save_state - : $list->{modules}{$module}{$page}{$tablename}{default_save_state}, + default_display_length => $rs + ? $rs->default_display_length + : $list->{modules}{$module}{$page}{$tablename}{default_display_length}, + default_sort_order => $rs + ? $rs->default_sort_order + : $list->{modules}{$module}{$page}{$tablename}{default_sort_order}, + default_save_state => $rs + ? $rs->default_save_state + : 1, }; } diff --git a/installer/data/mysql/atomicupdate/bug_33484.pl b/installer/data/mysql/atomicupdate/bug_33484.pl index 6107368cb9..a99d3a55d1 100755 --- a/installer/data/mysql/atomicupdate/bug_33484.pl +++ b/installer/data/mysql/atomicupdate/bug_33484.pl @@ -9,7 +9,7 @@ return { if ( !column_exists( 'tables_settings', 'default_save_state' ) ) { $dbh->do(q{ ALTER TABLE tables_settings - ADD COLUMN default_save_state tinyint(1) DEFAULT NULL AFTER default_sort_order + ADD COLUMN default_save_state tinyint(1) DEFAULT 1 AFTER default_sort_order }); say $out "Added column 'tables_settings.default_save_state'"; } diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index df6f7a75ff..cf5eb79279 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -6296,7 +6296,7 @@ CREATE TABLE `tables_settings` ( `tablename` varchar(255) NOT NULL, `default_display_length` smallint(6) DEFAULT NULL, `default_sort_order` varchar(255) DEFAULT NULL, - `default_save_state` tinyint(1) DEFAULT NULL, + `default_save_state` tinyint(1) DEFAULT 1, PRIMARY KEY (`module`(191),`page`(191),`tablename`(191)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- 2.39.5