From 1de09a6294cbf2b68cf8f0b77dd927281c8bf297 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 27 Apr 2026 08:07:43 +0100 Subject: [PATCH] Bug 34353: (QA follow-up) Atomicupdate cleanup - Set the executable bit on the atomicupdate so it passes the QA file_permissions check. - Drop the unused 'say_info' import; only 'say_warning' and 'say_success' are now needed. - Capture the row count from the DELETE so we report 'say_warning' on a re-run (when the syspref is already gone) instead of falsely claiming to have deleted it again. - Add an inline comment explaining the conservative '(is_hidden OR VALUES(is_hidden))' conflict-resolution rule used when a table-settings row already exists alongside the old syspref value. Test plan: 1. Verify the atomicupdate file has the executable bit set. 2. On a database where the syspref is still present, run the atomicupdate. Confirm output reads "Deleted 'SpineLabelShowPrintOnBibDetails' syspref". 3. Run the atomicupdate a second time. Confirm output now reads "'SpineLabelShowPrintOnBibDetails' syspref already removed". 4. Confirm the columns_settings rows are unchanged on re-run. Signed-off-by: Martin Renvoize Signed-off-by: Lucas Gass --- ...move_spinelabelshowprintonbibdetails_syspref.pl | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) mode change 100644 => 100755 installer/data/mysql/atomicupdate/bug_34353-remove_spinelabelshowprintonbibdetails_syspref.pl diff --git a/installer/data/mysql/atomicupdate/bug_34353-remove_spinelabelshowprintonbibdetails_syspref.pl b/installer/data/mysql/atomicupdate/bug_34353-remove_spinelabelshowprintonbibdetails_syspref.pl old mode 100644 new mode 100755 index 183f10236f..e051d98c7c --- a/installer/data/mysql/atomicupdate/bug_34353-remove_spinelabelshowprintonbibdetails_syspref.pl +++ b/installer/data/mysql/atomicupdate/bug_34353-remove_spinelabelshowprintonbibdetails_syspref.pl @@ -1,5 +1,5 @@ use Modern::Perl; -use Koha::Installer::Output qw(say_warning say_success say_info); +use Koha::Installer::Output qw(say_warning say_success); return { bug_number => "34353", @@ -8,6 +8,10 @@ return { my ($args) = @_; my ( $dbh, $out ) = @$args{qw(dbh out)}; + # If a columns_settings row already exists, OR the migrated value into + # the existing is_hidden flag — when the previous syspref and an + # existing table-settings override disagree we err on the side of + # hiding the column (the old syspref's "Don't show" winning). for my $tablename (qw(holdings_table otherholdings_table)) { $dbh->do( q{INSERT INTO columns_settings @@ -22,8 +26,12 @@ return { ); } - $dbh->do(q{DELETE FROM systempreferences WHERE variable='SpineLabelShowPrintOnBibDetails'}); + my $deleted = $dbh->do(q{DELETE FROM systempreferences WHERE variable='SpineLabelShowPrintOnBibDetails'}); - say_success( $out, "Deleted 'SpineLabelShowPrintOnBibDetails' syspref" ); + if ( $deleted && $deleted > 0 ) { + say_success( $out, "Deleted 'SpineLabelShowPrintOnBibDetails' syspref" ); + } else { + say_warning( $out, "'SpineLabelShowPrintOnBibDetails' syspref already removed" ); + } }, };