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 opaccredits system preference
16 my ($opaccredits) = $dbh->selectrow_array( q|
17 SELECT value FROM systempreferences WHERE variable='opaccredits';
20 foreach my $lang ( @langs ) {
21 print "Inserting opaccredits contents into $lang news item...\n";
22 # If there is a value in the opaccredits preference, insert it into opac_news
23 $dbh->do("INSERT INTO opac_news (branchcode, lang, title, content ) VALUES (NULL, ?, '', ?)", undef, "opaccredits_$lang", $opaccredits);
26 # Remove the opaccredits system preference
27 $dbh->do("DELETE FROM systempreferences WHERE variable='opaccredits'");
28 SetVersion ($DBversion);
29 print "Upgrade to $DBversion done (Bug 23795: Convert OpacCredits system preference to news block)\n";