From 7fe2c9147b6dd7a53969204586ca7b7460e30a05 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 31 Mar 2020 14:45:14 +0200 Subject: [PATCH] Bug 4944: Do not rely on the values from cache during the update DB process We never know, as we insert values direcly to the DB, the cache may not be correct. Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize --- .../mysql/atomicupdate/bug_4944_OpacNoItemTypeImages.perl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/installer/data/mysql/atomicupdate/bug_4944_OpacNoItemTypeImages.perl b/installer/data/mysql/atomicupdate/bug_4944_OpacNoItemTypeImages.perl index 77c2a5eebb..768d72d731 100644 --- a/installer/data/mysql/atomicupdate/bug_4944_OpacNoItemTypeImages.perl +++ b/installer/data/mysql/atomicupdate/bug_4944_OpacNoItemTypeImages.perl @@ -1,9 +1,11 @@ $DBversion = 'XXX'; # will be replaced by the RM if( CheckVersion( $DBversion ) ) { - my $noItemTypeImages = C4::Context->preference('noItemTypeImages'); - $dbh->do( "INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) - VALUES('OpacNoItemTypeImages',$noItemTypeImages,NULL,'If ON, disables itemtype images in the OPAC','YesNo')" ); + $dbh->do( q| + INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) + SELECT 'OpacNoItemTypeImages', value, NULL, 'If ON, disables itemtype images in the OPAC','YesNo' + FROM (SELECT value FROM systempreferences WHERE variable="NoItemTypeImages") tmp + | ); $dbh->do( "UPDATE systempreferences SET explanation = 'If ON, disables itemtype images in the staff interface' WHERE variable = 'noItemTypeImages' "); -- 2.39.2