Bug 14783: Update atomicupdate syntax

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Tomas Cohen Arazi 2022-10-17 15:59:07 -03:00
parent ef37acfb73
commit 3da8a25253
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
2 changed files with 30 additions and 10 deletions

View File

@ -1,10 +0,0 @@
$DBversion = 'XXX'; # will be replaced by the RM
if( CheckVersion( $DBversion ) ) {
$dbh->do( "INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES ('OPACAllowUserToChangeBranch','','Pending, In-Transit, Suspended','Allow users to change the library to pick up a hold for these statuses:','multiple');" );
$dbh->do( "UPDATE systempreferences set value = (SELECT CASE WHEN value = 1 THEN 'intransit' ELSE '' END FROM systempreferences WHERE variable = 'OPACInTransitHoldPickupLocationChange')");
$dbh->do( "DELETE FROM systempreferences WHERE variable = 'OPACInTransitHoldPickupLocationChange' ");
# Always end with this (adjust the bug info)
NewVersion( $DBversion, 14783, "Allow patrons to change pickup location for non-waiting holds");
}

View File

@ -0,0 +1,30 @@
use Modern::Perl;
return {
bug_number => "14783",
description => "Allow patrons to change pickup location for non-waiting holds",
up => sub {
my ($args) = @_;
my ($dbh, $out) = @$args{qw(dbh out)};
$dbh->do(q{
INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type)
VALUES ('OPACAllowUserToChangeBranch','','Pending, In-Transit, Suspended','Allow users to change the library to pick up a hold for these statuses:','multiple');
});
$dbh->do(q{
UPDATE systempreferences SET value = (SELECT CASE WHEN value = 1 THEN 'intransit' ELSE '' END
FROM systempreferences
WHERE variable = 'OPACInTransitHoldPickupLocationChange')
});
say $out "Added new system preference 'OPACAllowUserToChangeBranch'";
$dbh->do(q{
DELETE FROM systempreferences
WHERE variable = 'OPACInTransitHoldPickupLocationChange'
});
say $out "Removed system preference 'OPACInTransitHoldPickupLocationChange'";
},
};