Bug 14045: DB Changes

This patch is the DB changes for the feature.
It adds 5 new columns named 'maxonsiteissueqty' to the following tables:
- branch_borrower_circ_rules
- default_borrower_circ_rules
- default_branch_circ_rules
- default_circ_rules
- issuingrules

It also adds the pref ConsiderOnSiteCheckoutsAsNormalCheckouts.

See main patch for more details.

Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Jonathan Druart 2015-05-13 16:51:49 +02:00 committed by Tomas Cohen Arazi
parent f1a1eb05df
commit 8bcbf137be
4 changed files with 56 additions and 0 deletions

View file

@ -634,6 +634,7 @@ CREATE TABLE `branch_borrower_circ_rules` ( -- includes default circulation rule
`branchcode` VARCHAR(10) NOT NULL, -- the branch this rule applies to (branches.branchcode)
`categorycode` VARCHAR(10) NOT NULL, -- the patron category this rule applies to (categories.categorycode)
`maxissueqty` int(4) default NULL, -- the maximum number of checkouts this patron category can have at this branch
`maxonsiteissueqty` int(4) default NULL, -- the maximum number of on-site checkouts this patron category can have at this branch
PRIMARY KEY (`categorycode`, `branchcode`),
CONSTRAINT `branch_borrower_circ_rules_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`)
ON DELETE CASCADE ON UPDATE CASCADE,
@ -649,6 +650,7 @@ DROP TABLE IF EXISTS `default_borrower_circ_rules`;
CREATE TABLE `default_borrower_circ_rules` ( -- default checkout rules found under "Default checkout, hold and return policy"
`categorycode` VARCHAR(10) NOT NULL, -- patron category this rul
`maxissueqty` int(4) default NULL,
`maxonsiteissueqty` int(4) default NULL,
PRIMARY KEY (`categorycode`),
CONSTRAINT `borrower_borrower_circ_rules_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`)
ON DELETE CASCADE ON UPDATE CASCADE
@ -662,6 +664,7 @@ DROP TABLE IF EXISTS `default_branch_circ_rules`;
CREATE TABLE `default_branch_circ_rules` (
`branchcode` VARCHAR(10) NOT NULL,
`maxissueqty` int(4) default NULL,
`maxonsiteissueqty` int(4) default NULL,
`holdallowed` tinyint(1) default NULL,
`returnbranch` varchar(15) default NULL,
PRIMARY KEY (`branchcode`),
@ -690,6 +693,7 @@ DROP TABLE IF EXISTS `default_circ_rules`;
CREATE TABLE `default_circ_rules` (
`singleton` enum('singleton') NOT NULL default 'singleton',
`maxissueqty` int(4) default NULL,
`maxonsiteissueqty` int(4) default NULL,
`holdallowed` int(1) default NULL,
`returnbranch` varchar(15) default NULL,
PRIMARY KEY (`singleton`)
@ -1171,6 +1175,7 @@ CREATE TABLE `issuingrules` ( -- circulation and fine rules
`accountsent` int(11) default NULL, -- not used? always NULL
`chargename` varchar(100) default NULL, -- not used? always NULL
`maxissueqty` int(4) default NULL, -- total number of checkouts allowed
`maxonsiteissueqty` int(4) default NULL, -- total number of on-site checkouts allowed
`issuelength` int(4) default NULL, -- length of checkout in the unit set in issuingrules.lengthunit
`lengthunit` varchar(10) default 'days', -- unit of checkout length (days, hours)
`hardduedate` date default NULL, -- hard due date

View file

@ -93,6 +93,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('CoceProviders', NULL, 'aws,gb,ol', 'Coce providers', 'multiple'),
('COinSinOPACResults','1','','If ON, use COinS in OPAC search results page. NOTE: this can slow down search response time significantly','YesNo'),
('ConfirmFutureHolds','0','','Number of days for confirming future holds','Integer'),
('ConsiderOnSiteCheckoutsAsNormalCheckouts','1',NULL,'Consider on-site checkouts as normal checkouts','YesNo'),
('CronjobLog','0',NULL,'If ON, log information from cron jobs.','YesNo'),
('CurrencyFormat','US','US|FR','Determines the display format of currencies. eg: \'36000\' is displayed as \'360 000,00\' in \'FR\' or \'360,000.00\' in \'US\'.','Choice'),
('dateformat','us','metric|us|iso','Define global date format (us mm/dd/yyyy, metric dd/mm/yyy, ISO yyyy-mm-dd)','Choice'),

View file

@ -11054,6 +11054,47 @@ if ( CheckVersion($DBversion) ) {
SetVersion($DBversion);
}
$DBversion = "XXX";
if ( CheckVersion($DBversion) ) {
$dbh->do(q|
ALTER TABLE branch_borrower_circ_rules ADD COLUMN maxonsiteissueqty int(4) DEFAULT NULL AFTER maxissueqty;
|);
$dbh->do(q|
UPDATE branch_borrower_circ_rules SET maxonsiteissueqty = maxissueqty;
|);
$dbh->do(q|
ALTER TABLE default_borrower_circ_rules ADD COLUMN maxonsiteissueqty int(4) DEFAULT NULL AFTER maxissueqty;
|);
$dbh->do(q|
UPDATE default_borrower_circ_rules SET maxonsiteissueqty = maxissueqty;
|);
$dbh->do(q|
ALTER TABLE default_branch_circ_rules ADD COLUMN maxonsiteissueqty int(4) DEFAULT NULL AFTER maxissueqty;
|);
$dbh->do(q|
UPDATE default_branch_circ_rules SET maxonsiteissueqty = maxissueqty;
|);
$dbh->do(q|
ALTER TABLE default_circ_rules ADD COLUMN maxonsiteissueqty int(4) DEFAULT NULL AFTER maxissueqty;
|);
$dbh->do(q|
UPDATE default_circ_rules SET maxonsiteissueqty = maxissueqty;
|);
$dbh->do(q|
ALTER TABLE issuingrules ADD COLUMN maxonsiteissueqty int(4) DEFAULT NULL AFTER maxissueqty;
|);
$dbh->do(q|
UPDATE issuingrules SET maxonsiteissueqty = maxissueqty;
|);
$dbh->do(q|
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type)
VALUES ('ConsiderOnSiteCheckoutsAsNormalCheckouts','1',NULL,'Consider on-site checkouts as normal checkouts','YesNo');
|);
print "Upgrade to $DBversion done (Bug 14045: Add DB fields maxonsiteissueqty and pref ConsiderOnSiteCheckoutsAsNormalCheckouts)\n";
SetVersion ($DBversion);
}
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
# SEE bug 13068
# if there is anything in the atomicupdate, read and execute it.

View file

@ -391,6 +391,15 @@ Circulation:
yes: Enable
no: Disable
- the on-site for all cases (Even if a user is debarred, etc.).
-
- pref: ConsiderOnSiteCheckoutsAsNormalCheckouts
choices:
yes: Consider
no: "Don't consider"
- on-site checkouts as normal checkouts.
- If enabled, the number of checkouts allowed will be normal checkouts + on-site checkouts.
- If disabled, both values will be checked separately.
Checkin Policy:
-
- pref: BlockReturnOfWithdrawnItems