|
Lines 5213-5464
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
Link Here
|
| 5213 |
SetVersion($DBversion); |
5213 |
SetVersion($DBversion); |
| 5214 |
} |
5214 |
} |
| 5215 |
|
5215 |
|
| 5216 |
$DBversion = "3.09.00.001"; |
|
|
| 5217 |
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { |
| 5218 |
$dbh->do("ALTER TABLE borrower_attribute_types MODIFY category_code VARCHAR( 1 ) NULL DEFAULT NULL"); |
| 5219 |
print "Upgrade to $DBversion done. (Bug 8002: Update patron attribute types table to allow NULL category_code)\n"; |
| 5220 |
SetVersion($DBversion); |
| 5221 |
} |
| 5222 |
|
| 5223 |
$DBversion = "3.09.00.002"; |
| 5224 |
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { |
| 5225 |
$dbh->do("ALTER TABLE saved_sql |
| 5226 |
ADD ( |
| 5227 |
cache_expiry INT NOT NULL DEFAULT 300, |
| 5228 |
public BOOLEAN NOT NULL DEFAULT FALSE |
| 5229 |
); |
| 5230 |
"); |
| 5231 |
print "Upgrade to $DBversion done (Added cache_expiry and public fields in |
| 5232 |
saved_reports table.)\n"; |
| 5233 |
SetVersion($DBversion); |
| 5234 |
} |
| 5235 |
|
| 5236 |
$DBversion = "3.09.00.003"; |
| 5237 |
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { |
| 5238 |
$dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('SvcMaxReportRows','10','Maximum number of rows to return via the report web service.',NULL,'Integer');"); |
| 5239 |
print "Upgrade to $DBversion done (Added SvcMaxReportRows syspref)\n"; |
| 5240 |
SetVersion($DBversion); |
| 5241 |
} |
| 5242 |
|
| 5243 |
$DBversion = "3.09.00.004"; |
| 5244 |
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { |
| 5245 |
$dbh->do("INSERT IGNORE INTO permissions (module_bit, code, description) VALUES('13', 'edit_patrons', 'Perform batch modifivation of patrons')"); |
| 5246 |
print "Upgrade to $DBversion done (Adds permissions flag for access to the patron modifications tool)\n"; |
| 5247 |
SetVersion($DBversion); |
| 5248 |
} |
| 5249 |
|
| 5250 |
$DBversion = "3.09.00.005"; |
| 5251 |
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { |
| 5252 |
unless (TableExists('quotes')) { |
| 5253 |
$dbh->do( qq{ |
| 5254 |
CREATE TABLE `quotes` ( |
| 5255 |
`id` int(11) NOT NULL AUTO_INCREMENT, |
| 5256 |
`source` text DEFAULT NULL, |
| 5257 |
`text` mediumtext NOT NULL, |
| 5258 |
`timestamp` datetime NOT NULL, |
| 5259 |
PRIMARY KEY (`id`) |
| 5260 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
| 5261 |
}); |
| 5262 |
} |
| 5263 |
$dbh->do( qq{ |
| 5264 |
INSERT IGNORE INTO permissions VALUES (13, "edit_quotes","Edit quotes for quote-of-the-day feature"); |
| 5265 |
}); |
| 5266 |
$dbh->do( qq{ |
| 5267 |
INSERT IGNORE INTO `systempreferences` (variable,value,explanation,options,type) VALUES('QuoteOfTheDay',0,'Enable or disable display of Quote of the Day on the OPAC home page',NULL,'YesNo'); |
| 5268 |
}); |
| 5269 |
print "Upgrade to $DBversion done (Adding Quote of the Day Option.)\n"; |
| 5270 |
SetVersion($DBversion); |
| 5271 |
} |
| 5272 |
|
| 5273 |
$DBversion = "3.09.00.006"; |
| 5274 |
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { |
| 5275 |
$dbh->do("UPDATE systempreferences SET |
| 5276 |
variable = 'OPACShowHoldQueueDetails', |
| 5277 |
value = CASE value WHEN '1' THEN 'priority' ELSE 'none' END, |
| 5278 |
options = 'none|priority|holds|holds_priority', |
| 5279 |
explanation = 'Show holds details in OPAC', |
| 5280 |
type = 'Choice' |
| 5281 |
WHERE variable = 'OPACDisplayRequestPriority'"); |
| 5282 |
print "Upgrade to $DBversion done (Changed system preference OPACDisplayRequestPriority -> OPACShowHoldQueueDetails)\n"; |
| 5283 |
SetVersion($DBversion); |
| 5284 |
} |
| 5285 |
|
| 5286 |
$DBversion = "3.09.00.007"; |
| 5287 |
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { |
| 5288 |
unless(C4::Context->preference('ReservesControlBranch')){ |
| 5289 |
$dbh->do("INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('ReservesControlBranch','PatronLibrary','ItemHomeLibrary|PatronLibrary','Branch checked for members reservations rights.','Choice')"); |
| 5290 |
} |
| 5291 |
print "Upgrade to $DBversion done (Insert ReservesControlBranch systempreference into systempreferences table )\n"; |
| 5292 |
SetVersion($DBversion); |
| 5293 |
} |
| 5294 |
|
| 5295 |
$DBversion = "3.09.00.008"; |
| 5296 |
if (C4::Context->preference("Version") < TransformToNum($DBversion)) { |
| 5297 |
$dbh->do("ALTER TABLE sessions ADD PRIMARY KEY (id);"); |
| 5298 |
$dbh->do("ALTER TABLE sessions DROP INDEX `id`;"); |
| 5299 |
print "Upgrade to $DBversion done (redefine the field id as PRIMARY KEY of sessions)\n"; |
| 5300 |
SetVersion($DBversion); |
| 5301 |
} |
| 5302 |
|
| 5303 |
$DBversion = "3.09.00.009"; |
| 5304 |
if (C4::Context->preference("Version") < TransformToNum($DBversion)) { |
| 5305 |
$dbh->do("ALTER TABLE branches ADD PRIMARY KEY (branchcode);"); |
| 5306 |
$dbh->do("ALTER TABLE branches DROP INDEX branchcode;"); |
| 5307 |
print "Upgrade to $DBversion done (redefine the field branchcode as PRIMARY KEY of branches)\n"; |
| 5308 |
SetVersion ($DBversion); |
| 5309 |
} |
| 5310 |
|
| 5311 |
$DBversion = "3.09.00.010"; |
| 5312 |
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { |
| 5313 |
$dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('IssueLostItem', 'alert', 'alert|confirm|nothing', 'Defines what should be done when an attempt is made to issue an item that has been marked as lost.', 'Choice')"); |
| 5314 |
print "Upgrade to $DBversion done (Add system preference issuelostitem ))\n"; |
| 5315 |
SetVersion($DBversion); |
| 5316 |
} |
| 5317 |
|
| 5318 |
$DBversion = "3.09.00.011"; |
| 5319 |
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { |
| 5320 |
$dbh->do("ALTER TABLE `biblioitems` ADD `ean` VARCHAR( 13 ) NULL AFTER issn"); |
| 5321 |
$dbh->do("CREATE INDEX `ean` ON biblioitems (`ean`) "); |
| 5322 |
$dbh->do("ALTER TABLE `deletedbiblioitems` ADD `ean` VARCHAR( 13 ) NULL AFTER issn"); |
| 5323 |
if (C4::Context->preference("marcflavour") eq 'UNIMARC') { |
| 5324 |
$dbh->do("UPDATE marc_subfield_structure SET kohafield='biblioitems.ean' WHERE tagfield='073' and tagsubfield='a'"); |
| 5325 |
} |
| 5326 |
print "Upgrade to $DBversion done (Adding ean in biblioitems and deletedbiblioitems)\n"; |
| 5327 |
print "If you have records with ean, please run misc/batchRebuildBiblioTables.pl to populate bibliotems.ean\n" if (C4::Context->preference("marcflavour") eq 'UNIMARC'); |
| 5328 |
SetVersion($DBversion); |
| 5329 |
} |
| 5330 |
|
| 5331 |
$DBversion = "3.09.00.012"; |
| 5332 |
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { |
| 5333 |
$dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('SuspendHoldsIntranet', '1', NULL , 'Allow holds to be suspended from the intranet.', 'YesNo')"); |
| 5334 |
$dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('SuspendHoldsOpac', '1', NULL , 'Allow holds to be suspended from the OPAC.', 'YesNo')"); |
| 5335 |
print "Upgrade to $DBversion done (Add system preference OpacBrowseResults ))\n"; |
| 5336 |
SetVersion($DBversion); |
| 5337 |
} |
| 5338 |
|
| 5339 |
$DBversion ="3.09.00.013"; |
| 5340 |
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { |
| 5341 |
$dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('DefaultLanguageField008','','Fill in the default language for field 008 Range 35-37 (e.g. eng, nor, ger, see www.loc.gov/marc/languages/language_code.html)','','Free');"); |
| 5342 |
print "Upgrade to $DBversion done (Add system preference DefaultLanguageField008))\n"; |
| 5343 |
SetVersion($DBversion); |
| 5344 |
} |
| 5345 |
|
| 5346 |
$DBversion ="3.09.00.014"; |
| 5347 |
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { |
| 5348 |
# add phone message transport type |
| 5349 |
$dbh->do("INSERT INTO message_transport_types (message_transport_type) VALUES ('phone')"); |
| 5350 |
|
| 5351 |
# adds HOLD_PHONE and PREDUE_PHONE letters (as placeholders) |
| 5352 |
$dbh->do("INSERT INTO letter (module, code, name, title, content) VALUES |
| 5353 |
('reserves', 'HOLD_PHONE', 'Item Available for Pick-up (phone notice)', 'Item Available for Pick-up (phone notice)', 'Your item is available for pickup'), |
| 5354 |
('circulation', 'PREDUE_PHONE', 'Advance Notice of Item Due (phone notice)', 'Advance Notice of Item Due (phone notice)', 'Your item is due soon'), |
| 5355 |
('circulation', 'OVERDUE_PHONE', 'Overdue Notice (phone notice)', 'Overdue Notice (phone notice)', 'Your item is overdue') |
| 5356 |
"); |
| 5357 |
|
| 5358 |
# add phone notifications to patron message preferences options |
| 5359 |
$dbh->do("INSERT INTO message_transports |
| 5360 |
(message_attribute_id, message_transport_type, is_digest, letter_module, letter_code) VALUES |
| 5361 |
(4, 'phone', 0, 'reserves', 'HOLD_PHONE'), |
| 5362 |
(2, 'phone', 0, 'circulation', 'PREDUE_PHONE') |
| 5363 |
"); |
| 5364 |
|
| 5365 |
# add TalkingTechItivaPhoneNotification syspref |
| 5366 |
$dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('TalkingTechItivaPhoneNotification',0,'If ON, enables Talking Tech I-tiva phone notifications',NULL,'YesNo');"); |
| 5367 |
|
| 5368 |
print "Upgrade done (Support for Talking Tech i-tiva phone notification system)\n"; |
| 5369 |
SetVersion($DBversion); |
| 5370 |
} |
| 5371 |
|
| 5372 |
$DBversion = "3.09.00.015"; |
| 5373 |
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { |
| 5374 |
$dbh->do(qq{ |
| 5375 |
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('StatisticsFields','location|itype|ccode','Define Fields (from the items table) used for statistics members','location|itype|ccode','free') |
| 5376 |
}); |
| 5377 |
print "Upgrade to $DBversion done (Add System preference StatisticsFields)\n"; |
| 5378 |
SetVersion($DBversion); |
| 5379 |
} |
| 5380 |
|
| 5381 |
$DBversion = "3.09.00.016"; |
| 5382 |
if (C4::Context->preference("Version") < TransformToNum($DBversion)) { |
| 5383 |
$dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACShowBarcode','0','Show items barcode in holding tab','','YesNo')"); |
| 5384 |
print "Upgrade to $DBversion done (Add syspref OPACShowBarcode)\n"; |
| 5385 |
SetVersion ($DBversion); |
| 5386 |
} |
| 5387 |
|
| 5388 |
$DBversion = "3.09.00.017"; |
| 5389 |
if (C4::Context->preference("Version") < TransformToNum($DBversion)) { |
| 5390 |
$dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('OpacNavRight', '', '70|10', 'Show the following HTML in the right hand column of the main page under the main login form', 'Textarea');"); |
| 5391 |
print "Upgrade to $DBversion done (Add customizable OpacNavRight region to the OPAC main page)\n"; |
| 5392 |
SetVersion ($DBversion); |
| 5393 |
} |
| 5394 |
|
| 5395 |
$DBversion = "3.09.00.018"; |
| 5396 |
if (C4::Context->preference("Version") < TransformToNum($DBversion)) { |
| 5397 |
$dbh->do("DROP TABLE IF EXISTS aqbudgetborrowers"); |
| 5398 |
$dbh->do(" |
| 5399 |
CREATE TABLE aqbudgetborrowers ( |
| 5400 |
budget_id int(11) NOT NULL, |
| 5401 |
borrowernumber int(11) NOT NULL, |
| 5402 |
PRIMARY KEY (budget_id, borrowernumber), |
| 5403 |
CONSTRAINT aqbudgetborrowers_ibfk_1 FOREIGN KEY (budget_id) |
| 5404 |
REFERENCES aqbudgets (budget_id) |
| 5405 |
ON DELETE CASCADE ON UPDATE CASCADE, |
| 5406 |
CONSTRAINT aqbudgetborrowers_ibfk_2 FOREIGN KEY (borrowernumber) |
| 5407 |
REFERENCES borrowers (borrowernumber) |
| 5408 |
ON DELETE CASCADE ON UPDATE CASCADE |
| 5409 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
| 5410 |
"); |
| 5411 |
$dbh->do(" |
| 5412 |
INSERT INTO permissions (module_bit, code, description) |
| 5413 |
VALUES (11, 'budget_manage_all', 'Manage all budgets') |
| 5414 |
"); |
| 5415 |
print "Upgrade to $DBversion done (Add aqbudgetborrowers table)\n"; |
| 5416 |
SetVersion($DBversion); |
| 5417 |
} |
| 5418 |
|
| 5419 |
$DBversion = "3.09.00.019"; |
| 5420 |
if (C4::Context->preference("Version") < TransformToNum($DBversion)) { |
| 5421 |
$dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('OPACShowUnusedAuthorities','1','','Show authorities that are not being used in the OPAC.','YesNo')"); |
| 5422 |
print "Upgrade to $DBversion done (Add OPACShowUnusedAuthorities system preference)\n"; |
| 5423 |
SetVersion ($DBversion); |
| 5424 |
} |
| 5425 |
|
| 5426 |
$DBversion = "3.09.00.020"; |
| 5427 |
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { |
| 5428 |
$dbh->do("INSERT INTO systempreferences (variable,value,explanation,type) VALUES('EnableBorrowerFiles','0','If enabled, allows librarians to upload and attach arbitrary files to a borrower record.','YesNo')"); |
| 5429 |
$dbh->do(" |
| 5430 |
CREATE TABLE IF NOT EXISTS borrower_files ( |
| 5431 |
file_id int(11) NOT NULL AUTO_INCREMENT, |
| 5432 |
borrowernumber int(11) NOT NULL, |
| 5433 |
file_name varchar(255) NOT NULL, |
| 5434 |
file_type varchar(255) NOT NULL, |
| 5435 |
file_description varchar(255) DEFAULT NULL, |
| 5436 |
file_content longblob NOT NULL, |
| 5437 |
date_uploaded timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, |
| 5438 |
PRIMARY KEY (file_id), |
| 5439 |
KEY borrowernumber (borrowernumber) |
| 5440 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
| 5441 |
"); |
| 5442 |
$dbh->do("ALTER TABLE borrower_files ADD CONSTRAINT borrower_files_ibfk_1 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE"); |
| 5443 |
|
| 5444 |
print "Upgrade to $DBversion done (Added borrow_files table, EnableBorrowerFiles syspref)\n"; |
| 5445 |
SetVersion($DBversion); |
| 5446 |
} |
| 5447 |
|
| 5448 |
$DBversion = "3.09.00.021"; |
| 5449 |
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { |
| 5450 |
$dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UpdateTotalIssuesOnCirc','0','Whether to update the totalissues field in the biblio on each circ.',NULL,'YesNo');"); |
| 5451 |
print "Upgrade to $DBversion done (Add syspref UpdateTotalIssuesOnCirc)\n"; |
| 5452 |
SetVersion($DBversion); |
| 5453 |
} |
| 5454 |
|
| 5455 |
$DBversion = "3.09.00.022"; |
| 5456 |
if (C4::Context->preference("Version") < TransformToNum($DBversion)) { |
| 5457 |
$dbh->do("ALTER TABLE search_history MODIFY COLUMN query_cgi text NOT NULL"); |
| 5458 |
print "Upgrade to $DBversion done (Change search_history.query_cgi type to text. bug 5981)\n"; |
| 5459 |
SetVersion($DBversion); |
| 5460 |
} |
| 5461 |
|
| 5462 |
=head1 FUNCTIONS |
5216 |
=head1 FUNCTIONS |
| 5463 |
|
5217 |
|
| 5464 |
=head2 TableExists($table) |
5218 |
=head2 TableExists($table) |