From ab6494fc3de5fc4f325941baf1c65f67634b1c1b Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 9 Oct 2020 11:04:19 +0000 Subject: [PATCH] Bug 23420: DBRev 20.06.00.047 Signed-off-by: Jonathan Druart --- Koha.pm | 2 +- ..._OPACSuggestionUnwantedFields_syspref.perl | 23 -------------- installer/data/mysql/updatedatabase.pl | 30 +++++++++++++++++++ 3 files changed, 31 insertions(+), 24 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_23420_add_OPACSuggestionUnwantedFields_syspref.perl diff --git a/Koha.pm b/Koha.pm index 8a44e348e2..41d70e69a3 100644 --- a/Koha.pm +++ b/Koha.pm @@ -29,7 +29,7 @@ use vars qw{ $VERSION }; # - #4 : the developer version. The 4th number is the database subversion. # used by developers when the database changes. updatedatabase take care of the changes itself # and is automatically called by Auth.pm when needed. -$VERSION = "20.06.00.046"; +$VERSION = "20.06.00.047"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug_23420_add_OPACSuggestionUnwantedFields_syspref.perl b/installer/data/mysql/atomicupdate/bug_23420_add_OPACSuggestionUnwantedFields_syspref.perl deleted file mode 100644 index d715980774..0000000000 --- a/installer/data/mysql/atomicupdate/bug_23420_add_OPACSuggestionUnwantedFields_syspref.perl +++ /dev/null @@ -1,23 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - #Get value from AllowPurchaseSuggestionBranchChoice system preference - my ( $allowpurchasesuggestionbranchchoice ) = C4::Context->preference('AllowPurchaseSuggestionBranchChoice'); - if ( $allowpurchasesuggestionbranchchoice ) { - $dbh->do(q{ - INSERT IGNORE INTO systempreferences - (`variable`, `value`, `options`, `explanation`, `type`) - VALUES - ('OPACSuggestionUnwantedFields','branch', NULL,'Define the hidden fields for a patron purchase suggestions made via OPAC.','multiple'); - }); - } else { - $dbh->do(q{ - INSERT IGNORE INTO systempreferences - (`variable`, `value`, `options`, `explanation`, `type`) - VALUES - ('OPACSuggestionUnwantedFields','', NULL,'Define the hidden fields for a patron purchase suggestions made via OPAC.','multiple'); - }); - } - #Remove the AllowPurchaseSuggestionBranchChoice system preference - $dbh->do("DELETE FROM systempreferences WHERE variable='AllowPurchaseSuggestionBranchChoice'"); - NewVersion($DBversion, 23420, "Allow configuration of hidden fields on the suggestion form in OPAC"); -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 4464495575..1eaa420ff9 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -22969,6 +22969,36 @@ if( CheckVersion( $DBversion ) ) { NewVersion( $DBversion, 13535, "Add FK constraint on borrowernumber to alert table" ); } +$DBversion = '20.06.00.047'; +if ( CheckVersion($DBversion) ) { + + #Get value from AllowPurchaseSuggestionBranchChoice system preference + my ($allowpurchasesuggestionbranchchoice) = + C4::Context->preference('AllowPurchaseSuggestionBranchChoice'); + if ($allowpurchasesuggestionbranchchoice) { + $dbh->do(q{ + INSERT IGNORE INTO systempreferences + (`variable`, `value`, `options`, `explanation`, `type`) + VALUES + ('OPACSuggestionUnwantedFields','branch', NULL,'Define the hidden fields for a patron purchase suggestions made via OPAC.','multiple'); + }); + } + else { + $dbh->do(q{ + INSERT IGNORE INTO systempreferences + (`variable`, `value`, `options`, `explanation`, `type`) + VALUES + ('OPACSuggestionUnwantedFields','', NULL,'Define the hidden fields for a patron purchase suggestions made via OPAC.','multiple'); + }); + } + + #Remove the AllowPurchaseSuggestionBranchChoice system preference + $dbh->do( + "DELETE FROM systempreferences WHERE variable='AllowPurchaseSuggestionBranchChoice'" + ); + NewVersion( $DBversion, 23420, "Allow configuration of hidden fields on the suggestion form in OPAC" ); +} + # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. my $update_dir = C4::Context->config('intranetdir') . '/installer/data/mysql/atomicupdate/'; -- 2.39.5