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>
(cherry picked from commit 34c85d051d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Katrin Fischer 2024-03-17 16:46:26 +00:00 committed by Fridolin Somers
parent 40bd96aa82
commit fc05305694
2 changed files with 18 additions and 2 deletions

View file

@ -0,0 +1,16 @@
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'";
},
};

View file

@ -373,8 +373,8 @@ Patrons:
-
- pref: RedirectGuaranteeEmail
choices:
yes: Enable
no: Disable
1: Enable
0: Disable
- sending emails to both guarantees and their guarantor. This does not affect patrons without guarantors.
-
- pref: AllowStaffToSetFinesVisibilityForGuarantor