@@ -, +, @@ --- .../bug_24223-move-opacnav-to-news.pl | 26 +++---------------- 1 file changed, 3 insertions(+), 23 deletions(-) --- a/installer/data/mysql/atomicupdate/bug_24223-move-opacnav-to-news.pl +++ a/installer/data/mysql/atomicupdate/bug_24223-move-opacnav-to-news.pl @@ -7,35 +7,15 @@ return { my ($args) = @_; my ($dbh, $out) = @$args{qw(dbh out)}; - # get list of installed translations - require C4::Languages; - my @langs; - my $tlangs = C4::Languages::getTranslatedLanguages('opac','bootstrap'); - - foreach my $language ( @$tlangs ) { - foreach my $sublanguage ( @{$language->{'sublanguages_loop'}} ) { - push @langs, $sublanguage->{'rfc4646_subtag'}; - } - } - - # There must be a "default" entry in addition to language-specific ones - push @langs, "default"; - # Get any existing value from the OpacNav system preference my ($opacnav) = $dbh->selectrow_array( q| SELECT value FROM systempreferences WHERE variable='OpacNav'; |); if( $opacnav ){ # If there is a value in the OpacNav preference, insert it into additional_contents - my $code = ''; - foreach my $lang ( @langs ) { - say $out "Inserting OpacNav contents into $lang news item..."; - $dbh->do( "INSERT INTO additional_contents ( category, code, location, branchcode, title, content, lang, published_on ) VALUES ('html_customizations', '', 'OpacNav', NULL, ?, ?, ?, CAST(NOW() AS date) )", undef, "OpacNav $lang", $opacnav, $lang ); - my $idnew = $dbh->last_insert_id(undef, undef, 'additional_contents', undef); - if( $code eq '' ){ - $code = "News_$idnew"; - } - $dbh->do(q|UPDATE additional_contents SET code=? WHERE idnew = ?|, undef, $code, $idnew); + foreach my $lang ( 'default' ) { + say $out "Inserting OpacNav contents into default"; + $dbh->do( "INSERT INTO additional_contents ( category, code, location, branchcode, title, content, lang, published_on ) VALUES ('html_customizations', 'OpacNav', 'OpacNav', NULL, ?, ?, ?, CAST(NOW() AS date) )", undef, "OpacNav $lang", $opacnav, $lang ); } # Remove the OpacNav system preference --