Bug 32110: Fixup to db_rev for non-english, multilingual Koha
authorBlou <blou@inlibro.com>
Tue, 25 Oct 2022 18:55:52 +0000 (14:55 -0400)
committerArthur Suzuki <arthur.suzuki@biblibre.com>
Tue, 15 Nov 2022 17:11:10 +0000 (18:11 +0100)
Without this patch, the update process duplicates all the news and
content entries when they were non-english to start with.

This patch keeps the same process, but new "default" "parent" entries are empty so there'
no duplication in the OPAC display, while still being editable/deletable
in the intranet.

We came through that through many iterations.  This was the least
invasive while still providing satisfying results.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 499de130067063e2c33339be58fffee1dce17297)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 0b57ab102bdbac9e47708ce66c49233a521993af)
Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
installer/data/mysql/db_revs/210600016.pl

index 8d66de8..7c9b067 100755 (executable)
@@ -111,8 +111,6 @@ return {
             # Now this is getting weird
             # We are adding an extra news with the same code when the lang is not "default" (/"en")
 
-            $new_lang = "default" if $new_lang eq 'en'; # Assume that "en" is "default"
-
             my $sth_update = $dbh->prepare(q|
                 UPDATE additional_contents
                 SET category=?, location=?, lang=?
@@ -124,7 +122,7 @@ return {
                 $dbh->do(q|
                     INSERT INTO additional_contents(category, code, location, branchcode, title, content, lang, published_on, updated_on, expirationdate, number, borrowernumber)
                     VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
-                |, undef, $category, 'tmp_code', $location, $c->{branchcode}, $c->{title}, $c->{content}, 'default', $c->{published_on}, $c->{updated_on}, $c->{expirationdate}, $c->{number}, $c->{borrowernumber});
+                |, undef, $category, 'tmp_code', $location, $c->{branchcode}, $c->{title}, '', 'default', $c->{published_on}, $c->{updated_on}, $c->{expirationdate}, $c->{number}, $c->{borrowernumber});
 
                 $parent_idnew = $dbh->last_insert_id(undef, undef, 'additional_contents', undef);
             }