From 2e29442a762eba24d29507bd99c405b0f73b820b Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Wed, 25 Oct 2023 14:33:05 +0000 Subject: [PATCH] Bug 34869: (follow-up) Revise database update following Bug 31383 Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- ...acresultssidebar-to-additional-contents.pl | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/installer/data/mysql/atomicupdate/bug-34869-move-opacresultssidebar-to-additional-contents.pl b/installer/data/mysql/atomicupdate/bug-34869-move-opacresultssidebar-to-additional-contents.pl index 2003962bed..a6662e41e3 100755 --- a/installer/data/mysql/atomicupdate/bug-34869-move-opacresultssidebar-to-additional-contents.pl +++ b/installer/data/mysql/atomicupdate/bug-34869-move-opacresultssidebar-to-additional-contents.pl @@ -16,12 +16,19 @@ return { if ($opacresultssidebar) { # Insert any values found from system preference into additional_contents - foreach my $lang ('default') { - $dbh->do( - "INSERT INTO additional_contents ( category, code, location, branchcode, title, content, lang, published_on ) VALUES ('html_customizations', 'OPACResultsSidebar', 'OPACResultsSidebar', NULL, ?, ?, ?, CAST(NOW() AS date) )", - undef, "OPACResultsSidebar $lang", $opacresultssidebar, $lang - ); - } + $dbh->do( + "INSERT INTO additional_contents ( category, code, location, branchcode, published_on ) VALUES ('html_customizations', 'OPACResultsSidebar', 'OPACResultsSidebar', NULL, CAST(NOW() AS date) )" + ); + + my ($insert_id) = $dbh->selectrow_array( + "SELECT id FROM additional_contents WHERE category = 'html_customizations' AND code = 'OPACResultsSidebar' AND location = 'OPACResultsSidebar' LIMIT 1", + {} + ); + + $dbh->do( + "INSERT INTO additional_contents_localizations ( additional_content_id, title, content, lang ) VALUES ( ?, 'OPACResultsSidebar default', ?, 'default' )", + undef, $insert_id, $opacresultssidebar + ); # Remove old system preference $dbh->do("DELETE FROM systempreferences WHERE variable='OPACResultsSidebar'"); -- 2.39.5