From ebd9619ac6a6270e634449ed778ec0191619309a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 13 May 2015 16:51:49 +0200 Subject: [PATCH] [PASSED QA] 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 Signed-off-by: Katrin Fischer --- 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 6e75167..c36a792 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -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 diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 13639f0..1024a5e 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -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'), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index e6d4f9a..ef2f79a 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -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. 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 df72493..2e66328 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 @@ -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 -- 1.9.1