From af5a3cee41525bc266e79afc3a2903e4e17d3cda Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Thu, 30 Jul 2020 18:25:20 +0000 Subject: [PATCH] Bug 23796: DBRev 20.05.02.005 Signed-off-by: Lucas Gass --- Koha.pm | 2 +- ...g_23796-move-OpacCustomSearch-to-news.perl | 30 ------------------ installer/data/mysql/updatedatabase.pl | 31 +++++++++++++++++++ 3 files changed, 32 insertions(+), 31 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_23796-move-OpacCustomSearch-to-news.perl diff --git a/Koha.pm b/Koha.pm index 561287b318..fd08eab383 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 = "20.05.02.004"; +$VERSION = "20.05.02.005"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug_23796-move-OpacCustomSearch-to-news.perl b/installer/data/mysql/atomicupdate/bug_23796-move-OpacCustomSearch-to-news.perl deleted file mode 100644 index 0ae9e6e759..0000000000 --- a/installer/data/mysql/atomicupdate/bug_23796-move-OpacCustomSearch-to-news.perl +++ /dev/null @@ -1,30 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - - # get list of installed translations - require C4::Languages; - my @langs; - my $tlangs = C4::Languages::getTranslatedLanguages(); - - foreach my $language ( @$tlangs ) { - foreach my $sublanguage ( @{$language->{'sublanguages_loop'}} ) { - push @langs, $sublanguage->{'rfc4646_subtag'}; - } - } - - # Get any existing value from the OpacCustomSearch system preference - my ($OpacCustomSearch) = $dbh->selectrow_array( q| - SELECT value FROM systempreferences WHERE variable='OpacCustomSearch'; - |); - if( $OpacCustomSearch ){ - foreach my $lang ( @langs ) { - print "Inserting OpacCustomSearch contents into $lang news item...\n"; - # If there is a value in the OpacCustomSearch preference, insert it into opac_news - $dbh->do("INSERT INTO opac_news (branchcode, lang, title, content ) VALUES (NULL, ?, '', ?)", undef, "OpacCustomSearch_$lang", $OpacCustomSearch); - } - } - # Remove the OpacCustomSearch system preference - $dbh->do("DELETE FROM systempreferences WHERE variable='OpacCustomSearch'"); - SetVersion ($DBversion); - print "Upgrade to $DBversion done (Bug 23796: Convert OpacCustomSearch system preference to news block)\n"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 7f82861994..12291a49dc 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -22287,6 +22287,37 @@ if( CheckVersion( $DBversion ) ) { NewVersion ($DBversion, 23795, "Convert OpacCredits system preference to news block"); } +$DBversion = '20.05.02.005'; +if( CheckVersion( $DBversion ) ) { + + # get list of installed translations + require C4::Languages; + my @langs; + my $tlangs = C4::Languages::getTranslatedLanguages(); + + foreach my $language ( @$tlangs ) { + foreach my $sublanguage ( @{$language->{'sublanguages_loop'}} ) { + push @langs, $sublanguage->{'rfc4646_subtag'}; + } + } + + # Get any existing value from the OpacCustomSearch system preference + my ($OpacCustomSearch) = $dbh->selectrow_array( q| + SELECT value FROM systempreferences WHERE variable='OpacCustomSearch'; + |); + if( $OpacCustomSearch ){ + foreach my $lang ( @langs ) { + print "Inserting OpacCustomSearch contents into $lang news item...\n"; + # If there is a value in the OpacCustomSearch preference, insert it into opac_news + $dbh->do("INSERT INTO opac_news (branchcode, lang, title, content ) VALUES (NULL, ?, '', ?)", undef, "OpacCustomSearch_$lang", $OpacCustomSearch); + } + } + # Remove the OpacCustomSearch system preference + $dbh->do("DELETE FROM systempreferences WHERE variable='OpacCustomSearch'"); + + NewVersion ($DBversion, 23796, "Convert OpacCustomSearch system preference to news block"); +} + # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. my $update_dir = C4::Context->config('intranetdir') . '/installer/data/mysql/atomicupdate/'; -- 2.39.5