Bug 22318: (QA follow-up) Correct name of atomicupdate
[koha-equinox.git] / installer / data / mysql / atomicupdate / bug_22318-move-opacnavright-to-news.perl
1 $DBversion = 'XXX'; # will be replaced by the RM
2 if( CheckVersion( $DBversion ) ) {
3     my $opaclang = C4::Context->preference("opaclanguages");
4     my @langs;
5     push @langs, split ( '\,', $opaclang );
6     # Get any existing value from the OpacNavRight system preference
7     my ($OpacNavRight) = $dbh->selectrow_array( q|
8         SELECT value FROM systempreferences WHERE variable='OpacNavRight';
9     |);
10     if( $OpacNavRight ){
11         # If there is a value in the OpacNavRight preference, insert it into opac_news
12         $dbh->do("INSERT INTO opac_news (branchcode, lang, title, content ) VALUES (NULL, 'OpacNavRight_$langs[0]', '', '$OpacNavRight')");
13     }
14     # Remove the OpacNavRight system preference
15     $dbh->do("DELETE FROM systempreferences WHERE variable='OpacNavRight'");
16     SetVersion ($DBversion);
17     print "Upgrade to $DBversion done (Bug 22318: Move contents of OpacNavRight preference to Koha news system)\n";
18 }