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 beebd27a6f..d536fa7dc4 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'),