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 <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

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 <katrin.fischer.83@web.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Fridolin Somers 2023-03-21 22:54:17 -10:00 committed by Tomas Cohen Arazi
parent 201d7f9ac6
commit eec4921552
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
2 changed files with 33 additions and 1 deletions

View file

@ -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";
}
},
};

View file

@ -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'),