From ee36f27745b3b7f1b6dae02a7af0b759ff4445c9 Mon Sep 17 00:00:00 2001 From: Jesse Weaver Date: Thu, 15 Jan 2009 15:26:15 -0600 Subject: [PATCH] Database updates for hold policies Signed-off-by: Galen Charlton Signed-off-by: Daniel Sweeney Signed-off-by: Galen Charlton --- installer/data/mysql/updatedatabase.pl | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index dc8a610ab6..a819f8fdb3 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -2150,6 +2150,40 @@ END_SQL SetVersion($DBversion); } +$DBversion = "3.01.00.012"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowHoldPolicyOverride', '0', 'Allow staff to override hold policies when placing holds',NULL,'YesNo')"); + $dbh->do(" + CREATE TABLE `branch_item_rules` ( + `branchcode` varchar(10) NOT NULL, + `itemtype` varchar(10) NOT NULL, + `holdallowed` tinyint(1) default NULL, + PRIMARY KEY (`itemtype`,`branchcode`), + KEY `branch_item_rules_ibfk_2` (`branchcode`), + CONSTRAINT `branch_item_rules_ibfk_1` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `branch_item_rules_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8 + "); + $dbh->do(" + CREATE TABLE `default_branch_item_rules` ( + `itemtype` varchar(10) NOT NULL, + `holdallowed` tinyint(1) default NULL, + PRIMARY KEY (`itemtype`), + CONSTRAINT `default_branch_item_rules_ibfk_1` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8 + "); + $dbh->do(" + ALTER TABLE default_branch_circ_rules + ADD COLUMN holdallowed tinyint(1) NULL + "); + $dbh->do(" + ALTER TABLE default_circ_rules + ADD COLUMN holdallowed tinyint(1) NULL + "); + print "Upgrade to $DBversion done (Add tables and system preferences for holds policies)\n"; + SetVersion ($DBversion); +} + =item DropAllForeignKeys($table) Drop all foreign keys of the table $table -- 2.39.5