constrainttype, branchcode, notificationdate,
reminderdate, cancellationdate, reservenotes,
priority, found, timestamp, itemnumber,
- waitingdate, expirationdate, lowestPriority
+ waitingdate, expirationdate, lowestPriority,
+ suspend, suspend_until
) SELECT
borrowernumber, reservedate, biblionumber,
constrainttype, branchcode, notificationdate,
reminderdate, cancellationdate, reservenotes,
priority, found, timestamp, itemnumber,
- waitingdate, expirationdate, lowestPriority
+ waitingdate, expirationdate, lowestPriority,
+ suspend, suspend_until
FROM old_reserves ORDER BY reservedate
");
$dbh->do('SET @ai = ( SELECT MAX( reserve_id ) FROM tmp_reserves )');
constrainttype, branchcode, notificationdate,
reminderdate, cancellationdate, reservenotes,
priority, found, timestamp, itemnumber,
- waitingdate, expirationdate, lowestPriority
+ waitingdate, expirationdate, lowestPriority,
+ suspend, suspend_until
) SELECT
borrowernumber, reservedate, biblionumber,
constrainttype, branchcode, notificationdate,
reminderdate, cancellationdate, reservenotes,
priority, found, timestamp, itemnumber,
- waitingdate, expirationdate, lowestPriority
+ waitingdate, expirationdate, lowestPriority,
+ suspend, suspend_until
FROM reserves ORDER BY reservedate
");
$dbh->do('TRUNCATE reserves');
$dbh->do('ALTER TABLE reserves ADD reserve_id INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST');
- $dbh->do('INSERT INTO reserves SELECT * FROM tmp_reserves WHERE reserve_id > @ai');
+ $dbh->do('INSERT INTO reserves SELECT * FROM tmp_reserves WHERE reserve_id > COALESCE(@ai, 0)');
$dbh->do('DROP TABLE tmp_reserves');
$dbh->do('COMMIT');
SetVersion($DBversion);
}
-
$DBversion = "3.09.00.047";
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
# to preserve default behaviour as best as possible, set this new preference differently depending on whether IndependantBranches is set or not
SetVersion ($DBversion);
}
+$DBversion = "3.11.00.201";
+if ( CheckVersion($DBversion) ) {
+ $dbh->do("UPDATE z3950servers SET encoding = 'ISO_8859-1' WHERE name = 'BIBSYS' AND host LIKE 'z3950.bibsys.no'");
+ $dbh->do("UPDATE z3950servers SET encoding = 'ISO_8859-1' WHERE name = 'NORBOK' AND host LIKE 'z3950.nb.no'");
+ $dbh->do("UPDATE z3950servers SET encoding = 'ISO_8859-1' WHERE name = 'SAMBOK' AND host LIKE 'z3950.nb.no'");
+ $dbh->do("UPDATE z3950servers SET encoding = 'ISO_8859-1' WHERE name = 'DEICHMAN' AND host like 'z3950.deich.folkebibl.no'");
+ print "Upgrade to $DBversion done (Bug 9498 - Update encoding for Norwegian sample Z39.50 servers)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.11.00.202";
+if ( CheckVersion($DBversion) ) {
+ $dbh->do("INSERT INTO language_subtag_registry( subtag, type, description, added) VALUES ( 'ca', 'language', 'Catalan','2013-01-12' )");
+ $dbh->do("INSERT INTO language_rfc4646_to_iso639(rfc4646_subtag,iso639_2_code) VALUES( 'ca','cat')");
+ $dbh->do("INSERT INTO language_descriptions(subtag, type, lang, description) VALUES( 'ca', 'language', 'es', 'Catalán')");
+ $dbh->do("INSERT INTO language_descriptions(subtag, type, lang, description) VALUES( 'ca', 'language', 'en', 'Catalan')");
+ $dbh->do("INSERT INTO language_descriptions(subtag, type, lang, description) VALUES( 'ca', 'language', 'fr', 'Catalan')");
+ $dbh->do("INSERT INTO language_descriptions(subtag, type, lang, description) VALUES( 'ca', 'language', 'ca', 'CatalĂ ')");
+ $dbh->do("INSERT INTO language_descriptions(subtag, type, lang, description) VALUES( 'ca', 'language', 'de', 'Katalanisch')");
+ print "Upgrade to $DBversion done (Bug 9381: Add Catalan laguage)\n";
+ SetVersion ($DBversion);
+}
+
+$DBversion = "3.11.00.203";
+if ( CheckVersion($DBversion) ) {
+ $dbh->do(q{ALTER TABLE suggestions CHANGE COLUMN title title VARCHAR(255) DEFAULT NULL;});
+ print "Upgrade to $DBversion done (Bug 2046 - increasing title column length for suggestions)\n";
+ SetVersion ($DBversion);
+}
+
+$DBversion = "3.11.00.300";
+if ( CheckVersion($DBversion) ) {
+ print "Upgrade to $DBversion done (3.12-beta3 release)\n";
+ SetVersion ($DBversion);
+}
+
+$DBversion = "3.11.00.301";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ #issues
+ $dbh->do(q{
+ ALTER TABLE `issues`
+ ADD KEY `itemnumber_idx` (`itemnumber`),
+ ADD KEY `branchcode_idx` (`branchcode`),
+ ADD KEY `issuingbranch_idx` (`issuingbranch`)
+ });
+ $dbh->do(q{
+ ALTER TABLE `old_issues`
+ ADD KEY `branchcode_idx` (`branchcode`),
+ ADD KEY `issuingbranch_idx` (`issuingbranch`)
+ });
+ #items
+ $dbh->do(q{
+ ALTER TABLE `items` ADD KEY `itype_idx` (`itype`)
+ });
+ $dbh->do(q{
+ ALTER TABLE `deleteditems` ADD KEY `itype_idx` (`itype`)
+ });
+ # biblioitems
+ $dbh->do(q{
+ ALTER TABLE `biblioitems` ADD KEY `itemtype_idx` (`itemtype`)
+ });
+ $dbh->do(q{
+ ALTER TABLE `deletedbiblioitems` ADD KEY `itemtype_idx` (`itemtype`)
+ });
+ # statistics
+ $dbh->do(q{
+ ALTER TABLE `statistics`
+ ADD KEY `branch_idx` (`branch`),
+ ADD KEY `proccode_idx` (`proccode`),
+ ADD KEY `type_idx` (`type`),
+ ADD KEY `usercode_idx` (`usercode`),
+ ADD KEY `itemnumber_idx` (`itemnumber`),
+ ADD KEY `itemtype_idx` (`itemtype`),
+ ADD KEY `borrowernumber_idx` (`borrowernumber`),
+ ADD KEY `associatedborrower_idx` (`associatedborrower`),
+ ADD KEY `ccode_idx` (`ccode`)
+ });
+
+ print "Upgrade to $DBversion done (Bug 9681: Add some database indexes)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.12.00.000";
+if ( CheckVersion($DBversion) ) {
+ print "Upgrade to $DBversion done (3.12.0 release)\n";
+ SetVersion ($DBversion);
+}
+
+$DBversion = '3.13.00.000';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ print "Upgrade to $DBversion done (start the journey to Koha Pi)\n";
+ SetVersion ($DBversion);
+}
+
+$DBversion = "3.13.00.001";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+ $dbh->do("INSERT INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('UseCourseReserves', '0', NULL, 'Enable the course reserves feature.', 'YesNo')");
+ $dbh->do("INSERT INTO userflags (bit,flag,flagdesc,defaulton) VALUES ('18','coursereserves','Course Reserves','0')");
+ $dbh->do("
+CREATE TABLE `courses` (
+ `course_id` int(11) NOT NULL AUTO_INCREMENT,
+ `department` varchar(20) DEFAULT NULL,
+ `course_number` varchar(255) DEFAULT NULL,
+ `section` varchar(255) DEFAULT NULL,
+ `course_name` varchar(255) DEFAULT NULL,
+ `term` varchar(20) DEFAULT NULL,
+ `staff_note` mediumtext,
+ `public_note` mediumtext,
+ `students_count` varchar(20) DEFAULT NULL,
+ `enabled` enum('yes','no') NOT NULL DEFAULT 'yes',
+ `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`course_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+ ");
+
+ $dbh->do("
+CREATE TABLE `course_instructors` (
+ `course_id` int(11) NOT NULL,
+ `borrowernumber` int(11) NOT NULL,
+ PRIMARY KEY (`course_id`,`borrowernumber`),
+ KEY `borrowernumber` (`borrowernumber`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+ ");
+
+ $dbh->do("
+ALTER TABLE `course_instructors`
+ ADD CONSTRAINT `course_instructors_ibfk_2` FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`),
+ ADD CONSTRAINT `course_instructors_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE;
+ ");
+
+ $dbh->do("
+CREATE TABLE `course_items` (
+ `ci_id` int(11) NOT NULL AUTO_INCREMENT,
+ `itemnumber` int(11) NOT NULL,
+ `itype` varchar(10) DEFAULT NULL,
+ `ccode` varchar(10) DEFAULT NULL,
+ `holdingbranch` varchar(10) DEFAULT NULL,
+ `location` varchar(80) DEFAULT NULL,
+ `enabled` enum('yes','no') NOT NULL DEFAULT 'no',
+ `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`ci_id`),
+ UNIQUE KEY `itemnumber` (`itemnumber`),
+ KEY `holdingbranch` (`holdingbranch`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+ ");
+
+ $dbh->do("
+ALTER TABLE `course_items`
+ ADD CONSTRAINT `course_items_ibfk_2` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
+ ADD CONSTRAINT `course_items_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE;
+");
+
+ $dbh->do("
+CREATE TABLE `course_reserves` (
+ `cr_id` int(11) NOT NULL AUTO_INCREMENT,
+ `course_id` int(11) NOT NULL,
+ `ci_id` int(11) NOT NULL,
+ `staff_note` mediumtext,
+ `public_note` mediumtext,
+ `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`cr_id`),
+ UNIQUE KEY `pseudo_key` (`course_id`,`ci_id`),
+ KEY `course_id` (`course_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+");
+
+ $dbh->do("
+ALTER TABLE `course_reserves`
+ ADD CONSTRAINT `course_reserves_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`);
+ ");
+
+ $dbh->do("
+INSERT INTO permissions (module_bit, code, description) VALUES
+ (18, 'manage_courses', 'Add, edit and delete courses'),
+ (18, 'add_reserves', 'Add course reserves'),
+ (18, 'delete_reserves', 'Remove course reserves')
+;
+ ");
+
+
+ print "Upgrade to $DBversion done (Add Course Reserves ( system preference UseCourseReserves ))\n";
+ SetVersion($DBversion);
+}
=head1 FUNCTIONS