From 68425749246ef48f198f30f2d3416ae2ae7360e6 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 1 May 2020 17:27:52 +0100 Subject: [PATCH] Bug 23794: (RM follow-up) Make DB update consistent Signed-off-by: Martin Renvoize --- installer/data/mysql/updatedatabase.pl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 303568d801..a4b71847f3 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -20911,7 +20911,7 @@ if( CheckVersion( $DBversion ) ) { if( $opacheader ){ foreach my $lang ( @langs ) { # If there is a value in the opacheader preference, insert it into opac_news - $dbh->do("INSERT INTO opac_news (branchcode, lang, title, content ) VALUES (NULL, ?, '', ?)", undef, "opacheader_$langs[0]", $opacheader); + $dbh->do("INSERT INTO opac_news (branchcode, lang, title, content ) VALUES (NULL, ?, '', ?)", undef, "opacheader_$lang", $opacheader); push @detail, "Inserted opacheader contents into $lang news item...\n"; } } @@ -21925,16 +21925,20 @@ if( CheckVersion( $DBversion ) ) { my ($opacmainuserblock) = $dbh->selectrow_array( q| SELECT value FROM systempreferences WHERE variable='OpacMainUserBlock'; |); + + my @detail; if( $opacmainuserblock ){ foreach my $lang ( @langs ) { - print "Inserting OpacMainUserBlock contents into $lang news item...\n"; # If there is a value in the OpacMainUserBlock preference, insert it into opac_news $dbh->do("INSERT INTO opac_news (branchcode, lang, title, content ) VALUES (NULL, ?, '', ?)", undef, "OpacMainUserBlock_$lang", $opacmainuserblock); + push @detail, "Inserting OpacMainUserBlock contents into $lang news item...\n"; } } # Remove the OpacMainUserBlock system preference $dbh->do("DELETE FROM systempreferences WHERE variable='OpacMainUserBlock'"); - NewVersion( $DBversion, 23794, "Move contents of OpacMainUserBlock preference to Koha news system"); + + unshift @detail, "Move contents of OpacMainUserBlock preference to Koha news system"; + NewVersion( $DBversion, 23794, \@detail); } # SEE bug 13068 -- 2.39.5