From 5d2ffd8ed886aa38ed0c505a83bac9a114e1fc00 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Wed, 8 Nov 2023 16:56:09 +0000 Subject: [PATCH] Bug 23798: (follow-up) Revise database update following Bug 31383 Signed-off-by: Tomas Cohen Arazi --- ...-OpacMaintenanceNotice-to-additional-contents.pl | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/installer/data/mysql/atomicupdate/bug-23798-move-OpacMaintenanceNotice-to-additional-contents.pl b/installer/data/mysql/atomicupdate/bug-23798-move-OpacMaintenanceNotice-to-additional-contents.pl index 3b3a151f0f..d964eba681 100755 --- a/installer/data/mysql/atomicupdate/bug-23798-move-OpacMaintenanceNotice-to-additional-contents.pl +++ b/installer/data/mysql/atomicupdate/bug-23798-move-OpacMaintenanceNotice-to-additional-contents.pl @@ -17,8 +17,17 @@ return { # Insert any values found from system preference into additional_contents $dbh->do( - "INSERT INTO additional_contents ( category, code, location, branchcode, title, content, lang, published_on ) VALUES ('html_customizations', 'OpacMaintenanceNotice', 'OpacMaintenanceNotice', NULL, 'OpacMaintenanceNotice default', ?, 'default', CAST(NOW() AS date) )", - undef, $opacmaintenancenotice + "INSERT INTO additional_contents ( category, code, location, branchcode, published_on ) VALUES ('html_customizations', 'OpacMaintenanceNotice', 'OpacMaintenanceNotice', NULL, CAST(NOW() AS date) )" + ); + + my ($insert_id) = $dbh->selectrow_array( + "SELECT id FROM additional_contents WHERE category = 'html_customizations' AND code = 'OpacMaintenanceNotice' AND location = 'OpacMaintenanceNotice' LIMIT 1", + {} + ); + + $dbh->do( + "INSERT INTO additional_contents_localizations ( additional_content_id, title, content, lang ) VALUES ( ?, 'OpacMaintenanceNotice default', ?, 'default' )", + undef, $insert_id, $opacmaintenancenotice ); # Remove old system preference -- 2.39.5