|
Line 0
Link Here
|
|
|
1 |
$DBversion = 'XXX'; |
| 2 |
if( CheckVersion( $DBversion ) ) { |
| 3 |
|
| 4 |
if ( !TableExists( 'illrequests' ) ) { |
| 5 |
$dbh->do(q{ |
| 6 |
CREATE TABLE illrequests ( |
| 7 |
illrequest_id serial PRIMARY KEY, -- ILL request number |
| 8 |
borrowernumber integer DEFAULT NULL, -- Patron associated with request |
| 9 |
biblio_id integer DEFAULT NULL, -- Potential bib linked to request |
| 10 |
branchcode varchar(50) NOT NULL, -- The branch associated with the request |
| 11 |
status varchar(50) DEFAULT NULL, -- Current Koha status of request |
| 12 |
placed date DEFAULT NULL, -- Date the request was placed |
| 13 |
replied date DEFAULT NULL, -- Last API response |
| 14 |
updated timestamp DEFAULT CURRENT_TIMESTAMP -- Last modification to request |
| 15 |
ON UPDATE CURRENT_TIMESTAMP, |
| 16 |
completed date DEFAULT NULL, -- Date the request was completed |
| 17 |
medium varchar(30) DEFAULT NULL, -- The Koha request type |
| 18 |
accessurl varchar(500) DEFAULT NULL, -- Potential URL for accessing item |
| 19 |
cost varchar(20) DEFAULT NULL, -- Cost of request |
| 20 |
notesopac text DEFAULT NULL, -- Patron notes attached to request |
| 21 |
notesstaff text DEFAULT NULL, -- Staff notes attached to request |
| 22 |
orderid varchar(50) DEFAULT NULL, -- Backend id attached to request |
| 23 |
backend varchar(20) DEFAULT NULL, -- The backend used to create request |
| 24 |
CONSTRAINT `illrequests_bnfk` |
| 25 |
FOREIGN KEY (`borrowernumber`) |
| 26 |
REFERENCES `borrowers` (`borrowernumber`) |
| 27 |
ON UPDATE CASCADE ON DELETE CASCADE, |
| 28 |
CONSTRAINT `illrequests_bcfk_2` |
| 29 |
FOREIGN KEY (`branchcode`) |
| 30 |
REFERENCES `branches` (`branchcode`) |
| 31 |
ON UPDATE CASCADE ON DELETE CASCADE |
| 32 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; |
| 33 |
}); |
| 34 |
} |
| 35 |
|
| 36 |
if ( !TableExists( 'illrequestattributes' ) ) { |
| 37 |
$dbh->do(q{ |
| 38 |
CREATE TABLE illrequestattributes ( |
| 39 |
illrequest_id bigint(20) unsigned NOT NULL, -- ILL request number |
| 40 |
type varchar(200) NOT NULL, -- API ILL property name |
| 41 |
value text NOT NULL, -- API ILL property value |
| 42 |
PRIMARY KEY (`illrequest_id`,`type`), |
| 43 |
CONSTRAINT `illrequestattributes_ifk` |
| 44 |
FOREIGN KEY (illrequest_id) |
| 45 |
REFERENCES `illrequests` (`illrequest_id`) |
| 46 |
ON UPDATE CASCADE ON DELETE CASCADE |
| 47 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; |
| 48 |
}); |
| 49 |
} |
| 50 |
|
| 51 |
# System preferences |
| 52 |
$dbh->do(q{ |
| 53 |
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES |
| 54 |
('ILLModule','0','If ON, enables the interlibrary loans module.','','YesNo'); |
| 55 |
}); |
| 56 |
|
| 57 |
$dbh->do(q{ |
| 58 |
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES |
| 59 |
('ILLModuleCopyrightClearance','','70|10','Enter text to enable the copyright clearance stage of request creation. Text will be displayed','Textarea'); |
| 60 |
}); |
| 61 |
# userflags |
| 62 |
$dbh->do(q{ |
| 63 |
INSERT IGNORE INTO userflags (bit,flag,flagdesc,defaulton) VALUES |
| 64 |
(22,'ill','The Interlibrary Loans Module',0); |
| 65 |
}); |
| 66 |
|
| 67 |
SetVersion( $DBversion ); |
| 68 |
print "Upgrade to $DBversion done (Bug 7317 - Add an Interlibrary Loan Module to Circulation and OPAC)\n"; |
| 69 |
} |