From 9818b3bf8d08873328b64b72f27d799b428affd7 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 20 Mar 2026 11:21:16 +0000 Subject: [PATCH] Bug 41834: DBRev 25.12.00.029 Signed-off-by: Martin Renvoize --- Koha.pm | 2 +- .../data/mysql/atomicupdate/bug_41834.pl | 81 ------------------ installer/data/mysql/db_revs/211200029.pl | 82 ++++++++++++++++--- 3 files changed, 71 insertions(+), 94 deletions(-) delete mode 100755 installer/data/mysql/atomicupdate/bug_41834.pl diff --git a/Koha.pm b/Koha.pm index 2ba396f75d..651b205638 100644 --- a/Koha.pm +++ b/Koha.pm @@ -29,7 +29,7 @@ use vars qw{ $VERSION }; # - #4 : the developer version. The 4th number is the database subversion. # used by developers when the database changes. updatedatabase take care of the changes itself # and is automatically called by Auth.pm when needed. -$VERSION = "25.12.00.028"; +$VERSION = "25.12.00.029"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug_41834.pl b/installer/data/mysql/atomicupdate/bug_41834.pl deleted file mode 100755 index 892ff88985..0000000000 --- a/installer/data/mysql/atomicupdate/bug_41834.pl +++ /dev/null @@ -1,81 +0,0 @@ -use Modern::Perl; -use Koha::Installer::Output qw(say_warning say_success say_info); -use File::Slurp qw(read_file); - -return { - bug_number => "41834", - description => "NULL systempreferences's options, explanation and type", - up => sub { - my ($args) = @_; - my ( $dbh, $out ) = @$args{qw(dbh out)}; - - # First fix some discrepancies - - # from updatedatabase.pl 20.12.00.009 - # UseICUStyleQUotes vs UseICUStyleQuotes - $dbh->do( - q{ - UPDATE systempreferences - SET variable="UseICUStyleQuotes" - WHERE BINARY variable="UseICUStyleQUotes" - } - ); - - # from db_revs/211200012.pl - # Syspref was not deleted if no value set - $dbh->do( - q{ - DELETE FROM systempreferences WHERE variable='OpacMoreSearches' - } - ); - - # from db_revs/211200020.pl - # Syspref was not deleted if no value set - $dbh->do( - q{ - DELETE FROM systempreferences WHERE variable='OPACMySummaryNote' - } - ); - - # Then remove NULL the 3 columns for sysprefs listed in sysprefs.sql - my $sysprefs_filepath = sprintf "%s/installer/data/mysql/mandatory/sysprefs.sql", - C4::Context->config('intranetdir'); - my @lines = read_file($sysprefs_filepath) or die "Can't open $sysprefs_filepath: $!"; - my @sysprefs; - for my $line (@lines) { - chomp $line; - next if $line =~ /^INSERT INTO /; # first line - next if $line =~ /^;$/; # last line - next if $line =~ /^--/; # Comment line - if ( - $line =~ m/ - '(?[^'\\]*(?:\\.[^'\\]*)*)',\s* - /xms - ) - { - push @sysprefs, $+{variable}; - } else { - die "$line does not match"; - } - } - - my $updated = $dbh->do( - q{ - UPDATE systempreferences - SET options=NULL, explanation=NULL, type=NULL - WHERE variable IN (} . join( q{,}, map { q{?} } @sysprefs ) . q{)}, undef, @sysprefs - ); - - my $updated_last = $dbh->do( - q{ - UPDATE systempreferences - SET options=NULL, explanation=NULL, type=NULL - WHERE variable = 'marcflavour' - } - ); - - $updated = $updated + $updated_last; - - say $out sprintf "Updated %s system preferences", $updated; - }, -}; diff --git a/installer/data/mysql/db_revs/211200029.pl b/installer/data/mysql/db_revs/211200029.pl index 5df64f6cbc..892ff88985 100755 --- a/installer/data/mysql/db_revs/211200029.pl +++ b/installer/data/mysql/db_revs/211200029.pl @@ -1,23 +1,81 @@ use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_success say_info); +use File::Slurp qw(read_file); return { - bug_number => "30130", - description => "A standard to edi_account", + bug_number => "41834", + description => "NULL systempreferences's options, explanation and type", up => sub { my ($args) = @_; my ( $dbh, $out ) = @$args{qw(dbh out)}; - unless ( column_exists( 'vendor_edi_accounts', 'standard' ) ) { - $dbh->do( - q{ - ALTER TABLE vendor_edi_accounts ADD standard varchar(3) DEFAULT 'EUR' AFTER san - } - ); - $dbh->do( - q{ - UPDATE vendor_edi_accounts SET standard = 'BIC' WHERE san IN ( '5013546025065', '9377779308820', '5013546031839' ) + # First fix some discrepancies + + # from updatedatabase.pl 20.12.00.009 + # UseICUStyleQUotes vs UseICUStyleQuotes + $dbh->do( + q{ + UPDATE systempreferences + SET variable="UseICUStyleQuotes" + WHERE BINARY variable="UseICUStyleQUotes" } - ); + ); + + # from db_revs/211200012.pl + # Syspref was not deleted if no value set + $dbh->do( + q{ + DELETE FROM systempreferences WHERE variable='OpacMoreSearches' } + ); + + # from db_revs/211200020.pl + # Syspref was not deleted if no value set + $dbh->do( + q{ + DELETE FROM systempreferences WHERE variable='OPACMySummaryNote' + } + ); + + # Then remove NULL the 3 columns for sysprefs listed in sysprefs.sql + my $sysprefs_filepath = sprintf "%s/installer/data/mysql/mandatory/sysprefs.sql", + C4::Context->config('intranetdir'); + my @lines = read_file($sysprefs_filepath) or die "Can't open $sysprefs_filepath: $!"; + my @sysprefs; + for my $line (@lines) { + chomp $line; + next if $line =~ /^INSERT INTO /; # first line + next if $line =~ /^;$/; # last line + next if $line =~ /^--/; # Comment line + if ( + $line =~ m/ + '(?[^'\\]*(?:\\.[^'\\]*)*)',\s* + /xms + ) + { + push @sysprefs, $+{variable}; + } else { + die "$line does not match"; + } + } + + my $updated = $dbh->do( + q{ + UPDATE systempreferences + SET options=NULL, explanation=NULL, type=NULL + WHERE variable IN (} . join( q{,}, map { q{?} } @sysprefs ) . q{)}, undef, @sysprefs + ); + + my $updated_last = $dbh->do( + q{ + UPDATE systempreferences + SET options=NULL, explanation=NULL, type=NULL + WHERE variable = 'marcflavour' + } + ); + + $updated = $updated + $updated_last; + + say $out sprintf "Updated %s system preferences", $updated; }, };