From eec4921552411817acba4588694ed7511c604e0d Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Tue, 21 Mar 2023 22:54:17 -1000 Subject: [PATCH] Bug 33300: Wrong system preference name AutomaticWrongTransfer Bug 29792 added a DBRev with new system preference 'AutomaticConfirmTransfer'. But name in installer/data/mysql/mandatory/sysprefs.sql is wrong 'AutomaticWrongTransfer' Test plan : Create a new database and check there is in table systempreferences an entry with variable='AutomaticConfirmTransfer' Signed-off-by: David Nind Signed-off-by: Marcel de Rooy Bug 33300: (follow-up) DBRev for existing databases Test plan : 1.1) Start from a Koha 22.05 1.2) Upgrade to master => Check the upgrade says : Wrong system preference 'AutomaticWrongTransfer' renamed 'AutomaticConfirmTransfer' 2.1) Start from a Koha 22.05 2.2) Upgrade to 22.11 2.3) Via interface change system preference 'AutomaticConfirmTransfer' and save 2.4) Upgrade to master => Check the upgrade says : Wrong system preference 'AutomaticWrongTransfer' deleted Signed-off-by: Katrin Fischer Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi --- .../data/mysql/atomicupdate/bug_33300.pl | 32 +++++++++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100755 installer/data/mysql/atomicupdate/bug_33300.pl diff --git a/installer/data/mysql/atomicupdate/bug_33300.pl b/installer/data/mysql/atomicupdate/bug_33300.pl new file mode 100755 index 0000000000..01b36b2c61 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_33300.pl @@ -0,0 +1,32 @@ +use Modern::Perl; + +return { + bug_number => "33300", + description => "Fix missing wrong system preference 'AutomaticWrongTransfer'", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + my ($wrong_syspref_exists) = $dbh->selectrow_array(q{ + SELECT COUNT(*) FROM systempreferences WHERE variable='AutomaticWrongTransfer' + }); + if ($wrong_syspref_exists) { + # Correct preference may have been generated via interface + my ($correct_syspref_exists) = $dbh->selectrow_array(q{ + SELECT COUNT(*) FROM systempreferences WHERE variable='AutomaticConfirmTransfer' + }); + if ( $correct_syspref_exists ) { + $dbh->do(q{ + DELETE FROM systempreferences WHERE variable='AutomaticWrongTransfer' + }); + say $out "Wrong system preference 'AutomaticWrongTransfer' deleted"; + } else { + $dbh->do(q{ + UPDATE systempreferences SET variable='AutomaticConfirmTransfer' WHERE variable='AutomaticWrongTransfer' + }); + say $out "Wrong system preference 'AutomaticWrongTransfer' renamed 'AutomaticConfirmTransfer'"; + } + } else { + say $out "Wrong system preference 'AutomaticWrongTransfer' does not exist"; + } + }, +}; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index e899c44ba5..f8fd314f2c 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -84,7 +84,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('AutoLocation','0',NULL,'If ON, IP authentication is enabled, blocking access to the staff interface from unauthorized IP addresses','YesNo'), ('AutomaticItemReturn','1',NULL,'If ON, Koha will automatically set up a transfer of this item to its homebranch','YesNo'), ('AutoLinkBiblios','0',NULL,'If enabled, link biblio to authorities on creation and edit','YesNo'), -('AutomaticWrongTransfer','0',NULL,'Defines whether transfers should be automatically confirmed at checkin if modal dismissed','YesNo'), +('AutomaticConfirmTransfer','0',NULL,'Defines whether transfers should be automatically confirmed at checkin if modal dismissed','YesNo'), ('autoMemberNum','0','','If ON, patron number is auto-calculated','YesNo'), ('AutoRemoveOverduesRestrictions','0',NULL,'Defines whether an OVERDUES debarment should be lifted automatically if all overdue items are returned by the patron.','YesNo'), ('AutoRenewalNotices','cron','cron|preferences|never','How should Koha determine whether to end autorenewal notices','Choice'), -- 2.39.5