Bug 7413: Add issuingrules.norenewalbefore to database
authorHolger Meißner <h.meissner.82@web.de>
Wed, 12 Feb 2014 15:53:06 +0000 (16:53 +0100)
committerGalen Charlton <gmc@esilibrary.com>
Mon, 7 Apr 2014 18:28:53 +0000 (18:28 +0000)
Currently multiple renewals can be done in immediate succsession.
To optionally prevent this, a new parameter "No renewal before"
is introduced.

This patch adds issuingrules.norenewalbefore to the database.
Default value is NULL.

To test:
1) Run installer/data/mysql/updatedatabase.pl
2) Create a SQL report like:
   SELECT * FROM issuingrules
3) Confirm that norenewalbefore was added after renewalperiod.

Sponsored-by: Hochschule für Gesundheit (hsg), Germany
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
installer/data/mysql/kohastructure.sql
installer/data/mysql/updatedatabase.pl

index 5facb65..57cc3b8 100644 (file)
@@ -1155,6 +1155,7 @@ CREATE TABLE `issuingrules` ( -- circulation and fine rules
   `hardduedatecompare` tinyint NOT NULL default "0", -- type of hard due date (1 = after, 0 = on, -1 = before)
   `renewalsallowed` smallint(6) NOT NULL default "0", -- how many renewals are allowed
   `renewalperiod` int(4) default NULL, -- renewal period in the unit set in issuingrules.lengthunit
+  `norenewalbefore` int(4) default NULL, -- no renewal allowed until X days or hours before due date. In the unit set in issuingrules.lengthunit
   `reservesallowed` smallint(6) NOT NULL default "0", -- how many holds are allowed
   `branchcode` varchar(10) NOT NULL default '', -- the branch this rule is for (branches.branchcode)
   overduefinescap decimal(28,6) default NULL, -- the maximum amount of an overdue fine
index 70db070..81ffab6 100755 (executable)
@@ -8097,6 +8097,14 @@ if (CheckVersion($DBversion)) {
     SetVersion($DBversion);
 }
 
+$DBversion = "3.15.00.XXX";
+if(CheckVersion($DBversion)) {
+    $dbh->do(q{
+        ALTER TABLE issuingrules ADD norenewalbefore int(4) default NULL AFTER renewalperiod
+    });
+    print "Upgrade to $DBversion done (Bug 7413: Allow OPAC renewal x days before due date)\n";
+    SetVersion($DBversion);
+}
 
 =head1 FUNCTIONS