From 441d3d436f4f34e6ff8fd63fdb2e9e38c7e16e4f Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Tue, 19 Oct 2021 11:36:11 +0000 Subject: [PATCH] Bug 24223: (QA follow-up) Do not copy to other languages By majority on Bugzilla, we dont want to have the existing text in all translatable languages. Note: Removing the news_123 as code here, switching to OpacNav now. Another report should handle/improve the use of code, assuming that it is meant to provide some form of grouping. There is now confusion between the fields code and location. Signed-off-by: Marcel de Rooy --- .../bug_24223-move-opacnav-to-news.pl | 26 +++---------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/installer/data/mysql/atomicupdate/bug_24223-move-opacnav-to-news.pl b/installer/data/mysql/atomicupdate/bug_24223-move-opacnav-to-news.pl index e0673876d58..45e0502fb5c 100755 --- a/installer/data/mysql/atomicupdate/bug_24223-move-opacnav-to-news.pl +++ b/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 -- 2.25.1