From 1b6ed8097e28b090206aab2c41bcc7d546750aaf Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Tue, 21 Sep 2021 15:15:15 +0000 Subject: [PATCH] Bug 29073: Use 0 and 1 as values for DefaultHoldExpirationdate DefaultHldexpirationDate is set in the pref screen to 'yes/no' The code checks if the preference is 'true', 'no' is true We should instead use 1/0 To test: 0 - Have a fresh devbox 1 - With syspref disabled, place a hold 2 - Note no expiration date set 3 - Enable the preference 4 - Place a hold and note the expiration date is set, good 5 - Disable the pref 6 - Place a hold and note the expiration date is set, bad 7 - Apply patch 8 - Update database 9 - Repeat 1-8, date not set when pref disabled Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart --- installer/data/mysql/atomicupdate/bug_29073.pl | 17 +++++++++++++++++ .../modules/admin/preferences/circulation.pref | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug_29073.pl diff --git a/installer/data/mysql/atomicupdate/bug_29073.pl b/installer/data/mysql/atomicupdate/bug_29073.pl new file mode 100755 index 0000000000..ef06a3e8f0 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_29073.pl @@ -0,0 +1,17 @@ +use Modern::Perl; + +return { + bug_number => "29073", + description => "Make DefaultHoldExpirationdate use 1/0 values", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + # Do you stuffs here + $dbh->do(q{ + UPDATE systempreferences SET value = IF(value = 'yes',1,0) + WHERE variable = 'DefaultHoldExpirationdate'; + }); + # Print useful stuff here + say $out "DefaultHoldExpirationdate values updated"; + }, +} diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index fc07ec1ed6..8a3cfc4dc7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -901,8 +901,8 @@ Circulation: - pref: DefaultHoldExpirationdate default: 0 choices: - yes: Set - no: Don't set + 1: Set + 0: Don't set - default expiration date for holds automatically. - If enabled, set expiration date - pref: DefaultHoldExpirationdatePeriod -- 2.39.5