From 3da8a25253248802e65e6d69af4b2bce4d2d9dee Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 17 Oct 2022 15:59:07 -0300 Subject: [PATCH] Bug 14783: Update atomicupdate syntax Signed-off-by: Tomas Cohen Arazi --- ...OpacAllowPickupLocationChange_syspref.perl | 10 ------- .../data/mysql/atomicupdate/bug_14783.pl | 30 +++++++++++++++++++ 2 files changed, 30 insertions(+), 10 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_14783-add_OpacAllowPickupLocationChange_syspref.perl create mode 100755 installer/data/mysql/atomicupdate/bug_14783.pl diff --git a/installer/data/mysql/atomicupdate/bug_14783-add_OpacAllowPickupLocationChange_syspref.perl b/installer/data/mysql/atomicupdate/bug_14783-add_OpacAllowPickupLocationChange_syspref.perl deleted file mode 100644 index 75d91c6533..0000000000 --- a/installer/data/mysql/atomicupdate/bug_14783-add_OpacAllowPickupLocationChange_syspref.perl +++ /dev/null @@ -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"); -} diff --git a/installer/data/mysql/atomicupdate/bug_14783.pl b/installer/data/mysql/atomicupdate/bug_14783.pl new file mode 100755 index 0000000000..fe5f7c04c4 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_14783.pl @@ -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'"; + }, +}; -- 2.39.5