Bug 11577: Add auto_renew flags to the database

- issues.auto_renew
- old_issues.auto_renew
- issuingrules.auto_renew

Default value is zero.

To test:

1) Run installer/data/mysql/updatedatabase.pl
2) Create SQL reports like:
   SELECT * FROM issues LIMIT 0,1
3) Confirm that a column auto_renew was added to each of the three tables.

Sponsored-by: Hochschule für Gesundheit (hsg), Germany
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Holger Meißner 2014-05-15 16:18:36 +02:00 committed by Tomas Cohen Arazi
parent 84b4ace746
commit 282aa8ffce
2 changed files with 18 additions and 0 deletions

View file

@ -1123,6 +1123,7 @@ CREATE TABLE `issues` ( -- information related to check outs or issues
`lastreneweddate` datetime default NULL, -- date the item was last renewed
`return` varchar(4) default NULL,
`renewals` tinyint(4) default NULL, -- lists the number of times the item was renewed
`auto_renew` BOOLEAN default FALSE, -- automatic renewal
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
`issuedate` datetime default NULL, -- date the item was checked out or issued
KEY `issuesborridx` (`borrowernumber`),
@ -1160,6 +1161,7 @@ CREATE TABLE `issuingrules` ( -- circulation and fine rules
`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
`auto_renew` BOOLEAN default FALSE, -- automatic renewal
`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
@ -1594,6 +1596,7 @@ CREATE TABLE `old_issues` ( -- lists items that were checked out and have been r
`lastreneweddate` datetime default NULL, -- date the item was last renewed
`return` varchar(4) default NULL,
`renewals` tinyint(4) default NULL, -- lists the number of times the item was renewed
`auto_renew` BOOLEAN default FALSE, -- automatic renewal
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
`issuedate` datetime default NULL, -- date the item was checked out or issued
KEY `old_issuesborridx` (`borrowernumber`),

View file

@ -8751,6 +8751,21 @@ if ( CheckVersion($DBversion) ) {
SetVersion($DBversion);
}
$DBversion = "3.17.00.XXX";
if(CheckVersion($DBversion)) {
$dbh->do(q{
ALTER TABLE issues ADD auto_renew BOOLEAN default FALSE AFTER renewals
});
$dbh->do(q{
ALTER TABLE old_issues ADD auto_renew BOOLEAN default FALSE AFTER renewals
});
$dbh->do(q{
ALTER TABLE issuingrules ADD auto_renew BOOLEAN default FALSE AFTER norenewalbefore
});
print "Upgrade to $DBversion done (Bug 11577: [ENH] Automatic renewal feature)\n";
SetVersion($DBversion);
}
=head1 FUNCTIONS
=head2 TableExists($table)