Bug 24223: (QA follow-up) Do not copy to other languages
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tue, 19 Oct 2021 11:36:11 +0000 (11:36 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 8 Nov 2021 10:33:15 +0000 (11:33 +0100)
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 <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
installer/data/mysql/atomicupdate/bug_24223-move-opacnav-to-news.pl

index e067387..45e0502 100755 (executable)
@@ -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