From 30906c8b4f5cabf7d2533cbbde1f3368c5e2915c Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 1 May 2020 08:19:27 +0100 Subject: [PATCH] Bug 23794: DBRev 19.12.082 Signed-off-by: Martin Renvoize --- Koha.pm | 2 +- ..._23794-move-opacmainuserblock-to-news.perl | 30 ------------------- installer/data/mysql/updatedatabase.pl | 30 +++++++++++++++++++ 3 files changed, 31 insertions(+), 31 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_23794-move-opacmainuserblock-to-news.perl diff --git a/Koha.pm b/Koha.pm index 5ecb7fe60e..2a4f761ed2 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 = "19.12.00.081"; +$VERSION = "19.12.00.082"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug_23794-move-opacmainuserblock-to-news.perl b/installer/data/mysql/atomicupdate/bug_23794-move-opacmainuserblock-to-news.perl deleted file mode 100644 index ac0389f2b9..0000000000 --- a/installer/data/mysql/atomicupdate/bug_23794-move-opacmainuserblock-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 OpacMainUserBlock system preference - my ($opacmainuserblock) = $dbh->selectrow_array( q| - SELECT value FROM systempreferences WHERE variable='OpacMainUserBlock'; - |); - 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); - } - } - # Remove the OpacMainUserBlock system preference - $dbh->do("DELETE FROM systempreferences WHERE variable='OpacMainUserBlock'"); - SetVersion ($DBversion); - print "Upgrade to $DBversion done (Bug 23794: Move contents of OpacMainUserBlock preference to Koha news system)\n"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index bd2c6efd21..303568d801 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -21907,6 +21907,36 @@ if (CheckVersion($DBversion)) { NewVersion( $DBversion, 22630, "Add course_items.homebranch"); } +$DBversion = '19.12.00.082'; +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 OpacMainUserBlock system preference + my ($opacmainuserblock) = $dbh->selectrow_array( q| + SELECT value FROM systempreferences WHERE variable='OpacMainUserBlock'; + |); + 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); + } + } + # 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"); +} + # 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