Bug 14783: Update atomicupdate syntax
[koha.git] / installer / data / mysql / atomicupdate / bug_14783.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         $dbh->do(q{
16             UPDATE systempreferences SET value = (SELECT CASE WHEN value = 1 THEN 'intransit' ELSE '' END
17             FROM systempreferences
18             WHERE variable = 'OPACInTransitHoldPickupLocationChange')
19         });
20
21         say $out "Added new system preference 'OPACAllowUserToChangeBranch'";
22
23         $dbh->do(q{
24             DELETE FROM systempreferences
25             WHERE variable = 'OPACInTransitHoldPickupLocationChange'
26         });
27
28         say $out "Removed system preference 'OPACInTransitHoldPickupLocationChange'";
29     },
30 };