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 <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Nick Clemens 2021-09-21 15:15:15 +00:00 committed by Kyle M Hall
parent cdc623dbf4
commit 881c687fea
2 changed files with 19 additions and 2 deletions

View file

@ -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";
},
}

View file

@ -900,8 +900,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