Bug 41834: DBRev 25.12.00.029

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
This commit is contained in:
Martin Renvoize 2026-03-20 11:21:16 +00:00
parent 8864c23f3d
commit 9818b3bf8d
No known key found for this signature in database
GPG Key ID: 2D86E0EAEC83711B
3 changed files with 71 additions and 94 deletions

View File

@ -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;

View File

@ -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/
'(?<variable>[^'\\]*(?:\\.[^'\\]*)*)',\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;
},
};

View File

@ -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/
'(?<variable>[^'\\]*(?:\\.[^'\\]*)*)',\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;
},
};