Bug 3150: DBRev 22.12.00.015
[koha.git] / installer / data / mysql / db_revs / 220600064.pl
1 use Modern::Perl;
2
3 return {
4     bug_number  => "14783",
5     description => "Allow patrons to change pickup location for non-waiting holds",
6     up => sub {
7         my ($args) = @_;
8         my ($dbh, $out) = @$args{qw(dbh out)};
9
10         $dbh->do(q{
11             INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type)
12             VALUES ('OPACAllowUserToChangeBranch','','Pending, In-Transit, Suspended','Allow users to change the library to pick up a hold for these statuses:','multiple');
13         });
14
15         say $out "Added new system preference 'OPACAllowUserToChangeBranch'";
16
17         my ($value) = $dbh->selectrow_array(q{
18             SELECT CASE WHEN value=1 THEN 'intransit' ELSE '' END
19             FROM systempreferences
20             WHERE variable='OPACInTransitHoldPickupLocationChange'
21         });
22
23         $dbh->do(q{
24             UPDATE systempreferences
25             SET value=(?)
26             WHERE variable='OPACAllowUserToChangeBranch'
27         }, undef, $value);
28
29         $dbh->do(q{
30             DELETE FROM systempreferences
31             WHERE variable = 'OPACInTransitHoldPickupLocationChange'
32         });
33
34         say $out "Removed system preference 'OPACInTransitHoldPickupLocationChange'";
35     },
36 };