Bug 18925: Move existing rules

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2019-03-02 13:45:14 -03:00 committed by Nick Clemens
parent 05a2c58f79
commit 13faff1250

View file

@ -60,6 +60,28 @@ if( CheckVersion( $DBversion ) ) {
$dbh->do("ALTER TABLE default_branch_circ_rules DROP COLUMN maxissueqty, DROP COLUMN maxonsiteissueqty"); $dbh->do("ALTER TABLE default_branch_circ_rules DROP COLUMN maxissueqty, DROP COLUMN maxonsiteissueqty");
} }
if ( column_exists( 'issuingrules', 'maxissueqty' ) ) {
$dbh->do("
INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
SELECT IF(categorycode='*', NULL, categorycode),
IF(branchcode='*', NULL, branchcode),
IF(itemtype='*', NULL, itemtype),
'maxissueqty',
COALESCE( maxissueqty, '' )
FROM issuingrules
");
$dbh->do("
INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
SELECT IF(categorycode='*', NULL, categorycode),
IF(branchcode='*', NULL, branchcode),
IF(itemtype='*', NULL, itemtype),
'maxonsiteissueqty',
COALESCE( maxonsiteissueqty, '' )
FROM issuingrules
");
$dbh->do("ALTER TABLE issuingrules DROP COLUMN maxissueqty, DROP COLUMN maxonsiteissueqty");
}
SetVersion( $DBversion ); SetVersion( $DBversion );
print "Upgrade to $DBversion done (Bug 18925 - Move maxissueqty and maxonsiteissueqty to circulation_rules)\n"; print "Upgrade to $DBversion done (Bug 18925 - Move maxissueqty and maxonsiteissueqty to circulation_rules)\n";
} }