Bug 14697: Update database

This patch introduces the new table and related sysprefs.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Kyle M Hall 2019-02-22 08:46:34 -05:00 committed by Martin Renvoize
parent c76c509d83
commit e2eaafd939
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
3 changed files with 77 additions and 0 deletions

View File

@ -0,0 +1,46 @@
$DBversion = 'XXX'; # will be replaced by the RM
if( CheckVersion( $DBversion ) ) {
if( !TableExists( 'return_claims' ) ) {
$dbh->do(q{
CREATE TABLE return_claims (
id int(11) auto_increment,
itemnumber int(11) NOT NULL,
issue_id int(11) NULL DEFAULT NULL,
borrowernumber int(11) NOT NULL,
notes MEDIUMTEXT DEFAULT NULL,
created_on TIMESTAMP NULL,
created_by int(11) NULL DEFAULT NULL,
updated_on TIMESTAMP NULL ON UPDATE CURRENT_TIMESTAMP,
updated_by int(11) NULL DEFAULT NULL,
resolution varchar(80) NULL DEFAULT NULL,
resolved_on TIMESTAMP NULL DEFAULT NULL,
resolved_by int(11) NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `itemnumber` (`itemnumber`),
UNIQUE( issue_id ),
CONSTRAINT `rc_items_ibfk` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `rc_borrowers_ibfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `rc_created_by_ibfk` FOREIGN KEY (`created_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `rc_updated_by_ibfk` FOREIGN KEY (`updated_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `rc_resolved_by_ibfk` FOREIGN KEY (`resolved_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
});
}
$dbh->do(q{
INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
('ClaimReturnedChargeFee', 'ask', 'ask|charge|no_charge', 'Controls whether or not a lost item fee is charged for return claims', 'Choice'),
('ClaimReturnedLostValue', '', '', 'Sets the LOST AV value that represents "Claims returned" as a lost value', 'Free'),
('ClaimReturnedWarningThreshold', '', '', 'Sets the number of return claims past which the librarian will be warned the patron has many return claims', 'Integer');
});
$dbh->do(q{
INSERT IGNORE INTO `authorised_values` ( category, authorised_value, lib )
VALUES
('RETURN_CLAIM_RESOLUTION', 'RET_BY_PATRON', 'Returned by patron'),
('RETURN_CLAIM_RESOLUTION', 'FOUND_IN_LIB', 'Found in library');
});
SetVersion( $DBversion );
print "Upgrade to $DBversion done (Bug 14697 - Extend and enhance 'Claims returned' lost status)\n";
}

View File

@ -4419,6 +4419,34 @@ CREATE TABLE itemtypes_branches( -- association table between authorised_values
FOREIGN KEY (branchcode) REFERENCES branches(branchcode) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `return_claims`
--
DROP TABLE IF EXISTS `return_claims`;
CREATE TABLE return_claims (
id int(11) auto_increment,
itemnumber int(11) NOT NULL,
issue_id int(11) NULL DEFAULT NULL,
borrowernumber int(11) NOT NULL,
notes MEDIUMTEXT DEFAULT NULL,
created_on TIMESTAMP NULL,
created_by int(11) NULL DEFAULT NULL,
updated_on TIMESTAMP NULL ON UPDATE CURRENT_TIMESTAMP,
updated_by int(11) NULL DEFAULT NULL,
resolution varchar(80) NULL DEFAULT NULL,
resolved_on TIMESTAMP NULL DEFAULT NULL,
resolved_by int(11) NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `itemnumber` (`itemnumber`),
UNIQUE( issue_id ),
CONSTRAINT `rc_items_ibfk` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `rc_borrowers_ibfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `rc_created_by_ibfk` FOREIGN KEY (`created_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `rc_updated_by_ibfk` FOREIGN KEY (`updated_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `rc_resolved_by_ibfk` FOREIGN KEY (`resolved_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;

View File

@ -120,6 +120,9 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('CircControl','ItemHomeLibrary','PickupLibrary|PatronLibrary|ItemHomeLibrary','Specify the agency that controls the circulation and fines policy','Choice'),
('CircSidebar','0',NULL,'Activate or deactivate the navigation sidebar on all Circulation pages','YesNo'),
('ClaimsBccCopy','0','','Bcc the ClaimAcquisition and ClaimIssues alerts','YesNo'),
('ClaimReturnedChargeFee', 'ask', 'ask|charge|no_charge', 'Controls whether or not a lost item fee is charged for return claims', 'Choice'),
('ClaimReturnedLostValue', '', '', 'Sets the LOST AV value that represents "Claims returned" as a lost value', 'Free'),
('ClaimReturnedWarningThreshold', '', '', 'Sets the number of return claims past which the librarian will be warned the patron has many return claims', 'Integer'),
('CoceHost', '', NULL, 'Coce server URL', 'Free'),
('CoceProviders', '', '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'),