From 6faf8aa99cb745a532800a7cc3c946732e030fe8 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 13 May 2015 16:51:49 +0200 Subject: [PATCH] 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 --- installer/data/mysql/kohastructure.sql | 5 +++ installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 41 ++++++++++++++++++++ .../en/modules/admin/preferences/circulation.pref | 9 +++++ 4 files changed, 56 insertions(+) diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index c41710c..4b0f375 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -633,6 +633,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, @@ -648,6 +649,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 @@ -661,6 +663,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`), @@ -689,6 +692,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`) @@ -1183,6 +1187,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 diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 9620d67..47e5450 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -92,6 +92,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'), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 9ee74c1..ed9ae86 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -10486,6 +10486,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. diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index a16f231..c33c3c4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -398,6 +398,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 -- 1.7.10.4