From bc20f24d5afceb0fded48b88cc1067a7ae1ae651 Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Sun, 17 Mar 2024 16:46:26 +0000 Subject: [PATCH] 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 --- installer/data/mysql/atomicupdate/bug_35973.pl | 16 ++++++++++++++++ .../en/modules/admin/preferences/patrons.pref | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_35973.pl diff --git a/installer/data/mysql/atomicupdate/bug_35973.pl b/installer/data/mysql/atomicupdate/bug_35973.pl new file mode 100644 index 0000000000..e41cda31e0 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_35973.pl @@ -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'"; + }, +}; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref index dedb1db92a..7e7ebaf06c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -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 -- 2.30.2