Bug 32470: (Bug 14783 follow-up) Fix mysql error in db_rev for 22.06.000.064

Fix MySQL error:
ERROR 1093 (HY000): You can't specify target table 'systempreferences' for
 update in FROM clause

introduced by db_rev 064 for bug 14783.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 42d60ad850)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Michael Hafen 2022-12-14 11:45:47 -07:00 committed by Martin Renvoize
parent 8b6a8e82b3
commit fe17e62308
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
1 changed files with 8 additions and 2 deletions

View File

@ -14,11 +14,17 @@ return {
say $out "Added new system preference 'OPACAllowUserToChangeBranch'";
my ($value) = $dbh->selectrow_array(q{
SELECT CASE WHEN value=1 THEN 'intransit' ELSE '' END
FROM systempreferences
WHERE variable='OPACInTransitHoldPickupLocationChange'
});
$dbh->do(q{
UPDATE systempreferences
SET value=(SELECT CASE WHEN value=1 THEN 'intransit' ELSE '' END FROM systempreferences WHERE variable='OPACInTransitHoldPickupLocationChange')
SET value=(?)
WHERE variable='OPACAllowUserToChangeBranch'
});
}, undef, $value);
$dbh->do(q{
DELETE FROM systempreferences