From 34c85d051d330210227eccf76dd835d6b35b3e60 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 Signed-off-by: David Nind Signed-off-by: Katrin Fischer --- 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 4bbdcb4fea..968f81dc8b 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 @@ -377,8 +377,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.39.5