Koha/installer/data/mysql/atomicupdate/bug_35973.pl
Katrin Fischer 34c85d051d
Bug 35973: Correct wrong values for RedirectGuaranteeEmail system preference
The system preferences was added with 0/1 in sysprefs.sql is checked
as boolean. But the .pref file was added with yes/no which both
evaluate as strings to true.

This fixes the .pref file and includes a database update that sets
0 and 1 correctly for the value currently chosen in the pref.

To test:
* Make sure to update RedirectGuaranteeEmail to Enable/Don't enable
  before applying the patch
* Verify in the database, that the values was set to yes or no
  You can use a report like:
    SELECT * from systempreferences WHERE variable = "RedirectGuaranteeEmail";
* Apply patch and run database update
* Verify the value in the database was corrected:
  Yes = 1, No = 0
* Change the setting, verify the new value is stored correctly

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-04-19 18:06:34 +02:00

16 lines
583 B
Perl

use Modern::Perl;
return {
bug_number => "35973",
description => "Correct system preference 'RedirectGuaranteeEmail'",
up => sub {
my ($args) = @_;
my ( $dbh, $out ) = @$args{qw(dbh out)};
# Do you stuffs here
$dbh->do(q{UPDATE systempreferences SET value = 1 WHERE variable = "RedirectGuaranteeEmail" and value = "yes"});
$dbh->do(q{UPDATE systempreferences SET value = 0 WHERE variable = "RedirectGuaranteeEmail" and value = "no"});
say $out "Corrected system preference 'RedirectGuaranteeEmail'";
},
};