1 $DBversion = 'XXX'; # will be replaced by the RM
2 if( CheckVersion( $DBversion ) ) {
4 # get list of installed translations
7 my $tlangs = C4::Languages::getTranslatedLanguages();
9 foreach my $language ( @$tlangs ) {
10 foreach my $sublanguage ( @{$language->{'sublanguages_loop'}} ) {
11 push @langs, $sublanguage->{'rfc4646_subtag'};
15 # Get any existing value from the OpacMainUserBlock system preference
16 my ($opacmainuserblock) = $dbh->selectrow_array( q|
17 SELECT value FROM systempreferences WHERE variable='OpacMainUserBlock';
19 if( $opacmainuserblock ){
20 foreach my $lang ( @langs ) {
21 print "Inserting OpacMainUserBlock contents into $lang news item...\n";
22 # If there is a value in the OpacMainUserBlock preference, insert it into opac_news
23 $dbh->do("INSERT INTO opac_news (branchcode, lang, title, content ) VALUES (NULL, ?, '', ?)", undef, "OpacMainUserBlock_$lang", $opacmainuserblock);
26 # Remove the OpacMainUserBlock system preference
27 $dbh->do("DELETE FROM systempreferences WHERE variable='OpacMainUserBlock'");
28 SetVersion ($DBversion);
29 print "Upgrade to $DBversion done (Bug 23794: Move contents of OpacMainUserBlock preference to Koha news system)\n";