unless ( foreign_key_exists('aqorders', 'aqorders_created_by') ) {
$dbh->do( "ALTER TABLE aqorders ADD CONSTRAINT aqorders_created_by FOREIGN KEY (created_by) REFERENCES borrowers (borrowernumber) ON DELETE SET NULL ON UPDATE CASCADE;" );
}
- $dbh->do( "UPDATE aqorders, aqbasket SET aqorders.created_by = aqbasket.authorisedby WHERE aqorders.basketno = aqbasket.basketno AND aqorders.created_by IS NULL;" );
+ $dbh->do( "UPDATE aqbasket LEFT JOIN borrowers ON ( aqbasket.authorisedby = borrowers.borrowernumber ) SET aqbasket.authorisedby = NULL WHERE borrowers.borrowernumber IS NULL;" );
+ $dbh->do( "UPDATE aqorders LEFT JOIN aqbasket ON ( aqorders.basketno = aqbasket.basketno ) SET aqorders.created_by = aqbasket.authorisedby WHERE aqorders.created_by IS NULL;" );
}
SetVersion( $DBversion );
print "Upgrade to $DBversion done (Bug 12395 - Save order line's creator)\n";
ADD COLUMN class_split_rule varchar(10) NOT NULL default ''
AFTER class_sort_rule
|);
+
$dbh->do(q|
UPDATE class_sources
SET class_split_rule = class_sort_rule
|);
$dbh->do(q|
+ UPDATE class_sources
+ SET class_split_rule = 'generic'
+ WHERE class_split_rule NOT IN('dewey', 'generic', 'lcc')
+ |);
+
+ $dbh->do(q|
INSERT INTO class_split_rules(class_split_rule, description, split_routine)
VALUES
('dewey', 'Default sorting rules for DDC', 'Dewey'),
print "Upgrade to $DBversion done (Bug 18925 - Move maxissueqty and maxonsiteissueqty to circulation_rules)\n";
}
+$DBversion = '18.12.00.021';
+if ( CheckVersion($DBversion) ) {
+
+ if ( !column_exists( 'itemtypes', 'rentalcharge_daily' ) ) {
+ $dbh->do("ALTER TABLE `itemtypes` ADD COLUMN `rentalcharge_daily` decimal(28,6) default NULL AFTER `rentalcharge`");
+ }
+
+ if ( !column_exists( 'itemtypes', 'rentalcharge_hourly' ) ) {
+ $dbh->do("ALTER TABLE `itemtypes` ADD COLUMN `rentalcharge_hourly` decimal(28,6) default NULL AFTER `rentalcharge_daily`");
+ }
+
+ if ( column_exists( 'itemtypes', 'rental_charge_daily' ) ) {
+ $dbh->do("UPDATE `itemtypes` SET `rentalcharge_daily` = `rental_charge_daily`");
+ $dbh->do("ALTER TABLE `itemtypes` DROP COLUMN `rental_charge_daily`");
+ }
+
+ SetVersion($DBversion);
+ print "Upgrade to $DBversion done (Bug 20912 - Support granular rental charges)\n";
+}
+
+$DBversion = '18.12.00.022';
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do( q{
+ INSERT IGNORE INTO permissions (module_bit,code,description)
+ VALUES
+ (3,'manage_additional_fields','Add, edit, or delete additional custom fields for baskets or subscriptions (also requires order_manage or edit_subscription permissions)')
+ });
+ $dbh->do( q{
+ INSERT INTO user_permissions (borrowernumber, module_bit, code)
+ SELECT borrowernumber, 3, 'manage_additional_fields' FROM borrowers WHERE borrowernumber IN (SELECT DISTINCT borrowernumber FROM user_permissions WHERE code = 'order_manage' OR code = 'edit_subscription');
+ });
+ $dbh->do( q{
+ INSERT INTO user_permissions (borrowernumber, module_bit, code)
+ SELECT borrowernumber, 3, 'manage_additional_fields' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM borrowers WHERE MOD(flags DIV POWER(2,11),2)=1 OR MOD(flags DIV POWER(2,15),2) =1);
+ });
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 15774 - Add permission for managing additional fields)\n";
+}
+
+$DBversion = '18.12.00.023';
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do(q|
+ INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type)
+ VALUES ('ILLOpacbackends',NULL,NULL,'ILL backends to enabled for OPAC initiated requests','multiple');
+ |);
+
+ # Always end with this (adjust the bug info)
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 20639 - Add ILLOpacbackends syspref)\n";
+}
+
+$DBversion = '18.12.00.024';
+if ( CheckVersion($DBversion) ) {
+
+ # Add constraint for suggestedby
+ unless ( foreign_key_exists( 'suggestions', 'suggestions_ibfk_suggestedby' ) )
+ {
+ $dbh->do(
+"ALTER TABLE suggestions CHANGE COLUMN suggestedby suggestedby INT(11) NULL DEFAULT NULL;"
+ );
+ $dbh->do(
+"UPDATE suggestions LEFT JOIN borrowers ON (suggestions.suggestedby = borrowers.borrowernumber) SET suggestedby = null WHERE borrowernumber IS null"
+ );
+ $dbh->do(
+"ALTER TABLE suggestions ADD CONSTRAINT `suggestions_ibfk_suggestedby` FOREIGN KEY (`suggestedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE"
+ );
+ }
+
+ # Add constraint for managedby
+ unless ( foreign_key_exists( 'suggestions', 'suggestions_ibfk_managedby' ) )
+ {
+ $dbh->do(
+"UPDATE suggestions LEFT JOIN borrowers ON (suggestions.managedby = borrowers.borrowernumber) SET managedby = null WHERE borrowernumber IS NULL"
+ );
+ $dbh->do(
+"ALTER TABLE suggestions ADD CONSTRAINT `suggestions_ibfk_managedby` FOREIGN KEY (`managedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE"
+ );
+ }
+
+ # Add constraint for acceptedby
+ unless (
+ foreign_key_exists( 'suggestions', 'suggestions_ibfk_acceptedby' ) )
+ {
+ $dbh->do(
+"UPDATE suggestions LEFT JOIN borrowers ON (suggestions.acceptedby = borrowers.borrowernumber) SET acceptedby = null WHERE borrowernumber IS NULL"
+ );
+ $dbh->do(
+"ALTER TABLE suggestions ADD CONSTRAINT `suggestions_ibfk_acceptedby` FOREIGN KEY (`acceptedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE"
+ );
+ }
+
+ # Add constraint for rejectedby
+ unless (
+ foreign_key_exists( 'suggestions', 'suggestions_ibfk_rejectedby' ) )
+ {
+ $dbh->do(
+"UPDATE suggestions LEFT JOIN borrowers ON (suggestions.rejectedby = borrowers.borrowernumber) SET rejectedby = null WHERE borrowernumber IS null"
+ );
+ $dbh->do(
+"ALTER TABLE suggestions ADD CONSTRAINT `suggestions_ibfk_rejectedby` FOREIGN KEY (`rejectedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE"
+ );
+ }
+
+ # Add constraint for biblionumber
+ unless (
+ foreign_key_exists( 'suggestions', 'suggestions_ibfk_biblionumber' ) )
+ {
+ $dbh->do(
+"UPDATE suggestions s LEFT JOIN biblio b ON (s.biblionumber = b.biblionumber) SET s.biblionumber = null WHERE b.biblionumber IS null"
+ );
+ $dbh->do(
+"ALTER TABLE suggestions ADD CONSTRAINT `suggestions_ibfk_biblionumber` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE"
+ );
+ }
+
+ # Add constraint for branchcode
+ unless (
+ foreign_key_exists( 'suggestions', 'suggestions_ibfk_branchcode' ) )
+ {
+ $dbh->do(
+"UPDATE suggestions s LEFT JOIN branches b ON (s.branchcode = b.branchcode) SET s.branchcode = null WHERE b.branchcode IS null"
+ );
+ $dbh->do(
+"ALTER TABLE suggestions ADD CONSTRAINT `suggestions_ibfk_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE"
+ );
+ }
+
+ SetVersion($DBversion);
+ print
+"Upgrade to $DBversion done (Bug 22368 - Add missing constraints to suggestions)\n";
+}
+
+$DBversion = '18.12.00.025';
+if( CheckVersion( $DBversion ) ) {
+
+ $dbh->do('SET FOREIGN_KEY_CHECKS=0');
+
+ # Change columns accordingly
+ $dbh->do(q{
+ ALTER TABLE tags_index
+ MODIFY COLUMN term VARCHAR(191) COLLATE utf8mb4_bin NOT NULL;
+ });
+
+ $dbh->do(q{
+ ALTER TABLE tags_approval
+ MODIFY COLUMN term VARCHAR(191) COLLATE utf8mb4_bin NOT NULL;
+ });
+
+ $dbh->do(q{
+ ALTER TABLE tags_all
+ MODIFY COLUMN term VARCHAR(191) COLLATE utf8mb4_bin NOT NULL;
+ });
+
+ $dbh->do('SET FOREIGN_KEY_CHECKS=1');
+
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 21846 - Using emoji as tags has broken weights)\n";
+ my $maintenance_script = C4::Context->config("intranetdir") . "/misc/maintenance/fix_tags_weight.pl";
+ print "WARNING: (Bug 21846) You need to manually run $maintenance_script to fix possible issues with tags.\n";
+}
+
+$DBversion = '18.12.00.026';
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do( "INSERT IGNORE INTO systempreferences (variable, value, explanation, type) VALUES ('IllLog', 0, 'If ON, log information about ILL requests', 'YesNo')" );
+
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 20750 - Allow timestamped auditing of ILL request events)\n";
+}
+
+$DBversion = '18.12.00.027';
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do(q{
+INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES
+ ('ILLModuleUnmediated','0','','If enabled, try to immediately progress newly placed ILL requests.','YesNo');
+ });
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 18837: Add ILLModuleUnmediated Syspref)\n";
+}
+
+$DBversion = '18.12.00.028';
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do(q{
+ INSERT IGNORE INTO account_offset_types ( type ) VALUES ( 'Account Fee' );
+ });
+
+ $dbh->do(q{
+ INSERT IGNORE INTO account_offset_types ( type ) VALUES ( 'Hold Expired' );
+ });
+
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 21756 - Add 'Account Fee' and 'Hold Expired' to the account_offset_types table if missing)\n";
+}
+
+$DBversion = '18.12.00.029';
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do( "INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('OrderPriceRounding',NULL,'Local preference for rounding orders before calculations to ensure correct calculations','|nearest_cent','Choice')" );
+
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 18736 - Add syspref to control order rounding)\n";
+}
+
+$DBversion = '18.12.00.030';
+if( CheckVersion( $DBversion ) ) {
+ if( column_exists( 'accountlines', 'accountno' ) ) {
+ $dbh->do( "ALTER TABLE accountlines DROP COLUMN accountno" );
+ }
+ if( column_exists( 'statistics', 'proccode' ) ) {
+ $dbh->do( "ALTER TABLE statistics DROP COLUMN proccode" );
+ }
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 21683 - Remove accountlines.accountno and statistics.proccode fields)\n";
+}
+
+$DBversion = '18.12.00.031';
+if( CheckVersion( $DBversion ) ) {
+
+ # Add constraint for manager_id
+ unless( foreign_key_exists( 'accountlines', 'accountlines_ibfk_borrowers_2' ) ) {
+ $dbh->do("ALTER TABLE accountlines CHANGE COLUMN manager_id manager_id INT(11) NULL DEFAULT NULL");
+ $dbh->do("UPDATE accountlines a LEFT JOIN borrowers b ON ( a.manager_id = b.borrowernumber) SET a.manager_id = NULL WHERE b.borrowernumber IS NULL");
+ $dbh->do("ALTER TABLE accountlines ADD CONSTRAINT `accountlines_ibfk_borrowers_2` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE");
+ }
+
+ # Rename accountlines_ibfk_2 to accountlines_ibfk_items
+ if ( foreign_key_exists( 'accountlines', 'accountlines_ibfk_2' ) && !foreign_key_exists( 'accountlines', 'accountlines_ibfk_items' ) ) {
+ $dbh->do("ALTER TABLE accountlines DROP FOREIGN KEY accountlines_ibfk_2");
+ $dbh->do("ALTER TABLE accountlines ADD CONSTRAINT `accountlines_ibfk_items` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE CASCADE");
+ }
+
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 22008 - Add missing constraints for accountlines.manager_id)\n";
+}
+
+$DBversion = '18.12.00.032';
+if( CheckVersion( $DBversion ) ) {
+ if( !column_exists( 'search_field', 'facet_order' ) ) {
+ $dbh->do("ALTER TABLE search_field ADD COLUMN facet_order TINYINT(4) DEFAULT NULL AFTER weight");
+ }
+ $dbh->do("UPDATE search_field SET facet_order=1 WHERE name='author'");
+ $dbh->do("UPDATE search_field SET facet_order=2 WHERE name='itype'");
+ $dbh->do("UPDATE search_field SET facet_order=3 WHERE name='location'");
+ $dbh->do("UPDATE search_field SET facet_order=4 WHERE name='su-geo'");
+ $dbh->do("UPDATE search_field SET facet_order=5 WHERE name='title-series'");
+ $dbh->do("UPDATE search_field SET facet_order=6 WHERE name='subject'");
+ $dbh->do("UPDATE search_field SET facet_order=7 WHERE name='ccode'");
+ $dbh->do("UPDATE search_field SET facet_order=8 WHERE name='holdingbranch'");
+ $dbh->do("UPDATE search_field SET facet_order=9 WHERE name='homebranch'");
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 18235 - Elastic search - make facets configurable)\n";
+}
+
+$DBversion = '18.12.00.033';
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do( "UPDATE search_field SET facet_order=10 WHERE name='ln'" );
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 18213 - Add language facets to Elasticsearch)\n";
+}
+
+$DBversion = '18.12.00.034';
+if( CheckVersion( $DBversion ) ) {
+
+ if ( column_exists( 'accountlines', 'lastincrement' ) ) {
+ $dbh->do("ALTER TABLE `accountlines` DROP COLUMN `lastincrement`");
+ }
+
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 22516 - Drop deprecated accountlines.lastincrement field)\n";
+}
+
+$DBversion = '18.12.00.035';
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do( "INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type)
+ VALUES ('MaxItemsToDisplayForBatchMod','1000',NULL,'Display up to a given number of items in a single item modification batch.','Integer')"
+ );
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 19722 - Add a MaxItemsToDisplayForBatchMod preference)\n";
+}
+
+$DBversion = '18.12.00.036';
+if ( CheckVersion($DBversion) ) {
+
+ my $rows = $dbh->do(
+ qq{
+ UPDATE `accountlines`
+ SET
+ `accounttype` = 'FU'
+ WHERE
+ `accounttype` = 'O'
+ }
+ );
+
+ SetVersion($DBversion);
+ printf "Upgrade to $DBversion done (Bug 22518 - Fix accounttype 'O' to 'FU' - %d updated)\n", $rows;
+}
+
+$DBversion = '18.12.00.037';
+if( CheckVersion( $DBversion ) ) {
+
+ $dbh->do( "UPDATE issues SET renewals = 0 WHERE renewals IS NULL" );
+ $dbh->do( "UPDATE old_issues SET renewals = 0 WHERE renewals IS NULL" );
+
+ $dbh->do( "ALTER TABLE issues MODIFY COLUMN renewals tinyint(4) NOT NULL default 0");
+ $dbh->do( "ALTER TABLE old_issues MODIFY COLUMN renewals tinyint(4) NOT NULL default 0");
+
+ # Always end with this (adjust the bug info)
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 22607 - Set default value of issues.renewals to 0)\n";
+}
+
+$DBversion = '18.12.00.038';
+if ( CheckVersion($DBversion) ) {
+
+ if ( !column_exists( 'accountlines', 'status' ) ) {
+ $dbh->do(
+ qq{
+ ALTER TABLE `accountlines`
+ ADD
+ `status` varchar(16) DEFAULT NULL
+ AFTER
+ `accounttype`
+ }
+ );
+ }
+
+ SetVersion($DBversion);
+ print "Upgrade to $DBversion done (Bug 22512 - Add status to accountlines)\n";
+}
+
+$DBversion = '18.12.00.039';
+if ( CheckVersion($DBversion) ) {
+
+ if ( !column_exists( 'accountlines', 'interface' ) ) {
+ $dbh->do(
+ qq{
+ ALTER TABLE `accountlines`
+ ADD
+ `interface` varchar(16)
+ AFTER
+ `manager_id`;
+ }
+ );
+ }
+
+ $dbh->do(qq{
+ UPDATE
+ `accountlines`
+ SET
+ interface = 'opac'
+ WHERE
+ borrowernumber = manager_id;
+ });
+
+ $dbh->do(qq{
+ UPDATE
+ `accountlines`
+ SET
+ interface = 'cron'
+ WHERE
+ manager_id IS NULL
+ AND
+ branchcode IS NULL;
+ });
+
+ $dbh->do(qq{
+ UPDATE
+ `accountlines`
+ SET
+ interface = 'intranet'
+ WHERE
+ interface IS NULL;
+ });
+
+ $dbh->do(qq{
+ ALTER TABLE `accountlines`
+ MODIFY COLUMN `interface` varchar(16) NOT NULL;
+ });
+
+ SetVersion($DBversion);
+ print "Upgrade to $DBversion done (Bug 22600 - Add interface to accountlines)\n";
+}
+
+$DBversion = '18.12.00.040';
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do("UPDATE accountlines SET description = REPLACE(description, 'Reserve Charge - ', '') WHERE description LIKE 'Reserve Charge - %'");
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 12166 - Remove 'Reserve Charge' text from accountlines description)\n";
+}
+
+$DBversion = '18.12.00.041';
+if( CheckVersion( $DBversion ) ) {
+ my $table_sth = $dbh->prepare('SHOW CREATE TABLE `search_marc_map`');
+ $table_sth->execute();
+ my @table = $table_sth->fetchrow_array();
+ unless ( $table[1] =~ /`marc_field`.*COLLATE utf8mb4_bin/ ) { #catches utf8mb4 collated tables
+ $dbh->do("ALTER TABLE `search_marc_map` MODIFY `marc_field` VARCHAR(255) NOT NULL COLLATE utf8mb4_bin COMMENT 'the MARC specifier for this field'");
+ }
+
+ # Always end with this (adjust the bug info)
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 19670 - Change collation of marc_field to allow mixed case search field mappings)\n";
+}
+
+$DBversion = '18.12.00.042';
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do( "UPDATE systempreferences SET value = 'default' WHERE variable = 'XSLTDetailsDisplay' AND value = ''" );
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 29891 - Remove non-XSLT detail view in the staff client)\n";
+}
+
+$DBversion = '18.12.00.043';
+if ( CheckVersion($DBversion) ) {
+ $dbh->do("UPDATE accountlines SET description = REPLACE(description, 'Lost Item ', '') WHERE description LIKE 'Lost Item %'");
+ SetVersion($DBversion);
+ print "Upgrade to $DBversion done (Bug 21953 - Remove 'Lost Item' text from accountlines description)\n";
+}
+
+$DBversion = '18.12.00.044';
+if( CheckVersion( $DBversion ) ) {
+
+ if ( !column_exists( 'categories', 'reset_password' ) ) {
+ $dbh->do(q{
+ ALTER TABLE categories
+ ADD COLUMN reset_password TINYINT(1) NULL DEFAULT NULL
+ AFTER checkprevcheckout
+ });
+ }
+
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 21890 - Patron password reset by category)\n";
+}
+
+$DBversion = '18.12.00.045';
+if( CheckVersion( $DBversion ) ) {
+
+ if ( !column_exists( 'categories', 'change_password' ) ) {
+ $dbh->do(q{
+ ALTER TABLE categories
+ ADD COLUMN change_password TINYINT(1) NULL DEFAULT NULL
+ AFTER reset_password
+ });
+ }
+
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 10796 - Patron password change by category)\n";
+}
+
+$DBversion = '18.12.00.046';
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do( "UPDATE systempreferences SET value = 'default' WHERE variable = 'XSLTResultsDisplay' AND value = ''" );
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 22695 - Remove non-XSLT search results view from the staff client)\n";
+}
+
+$DBversion = '18.12.00.047';
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do(q|
+ INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('LibrisKey', '', 'This key must be obtained at http://api.libris.kb.se/. It is unique for the IP of the server.', NULL, 'Free');
+ |);
+ $dbh->do(q|
+ INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('LibrisURL', 'http://api.libris.kb.se/bibspell/', 'This is the base URL for the Libris spellchecking API.',NULL,'Free');
+ |);
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 14557: Add Libris spellchecking system preferences)\n";
+}
+
+$DBversion = '18.12.00.048';
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do( q{
+ INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type)
+ VALUES ('NoRenewalBeforePrecision', 'exact_time', 'Calculate "No renewal before" based on date or exact time. Only relevant for loans calculated in days, hourly loans are not affected.', 'date|exact_time', 'Choice');
+ });
+ $dbh->do("UPDATE systempreferences SET value='exact_time' WHERE variable='NoRenewalBeforePrecision' AND value IS NULL;" );
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 22044 - Set a default value for NoRenewalBeforePrecision)\n";
+}
+
+$DBversion = '18.12.00.049';
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do( "ALTER TABLE borrowers ADD COLUMN flgAnonymized tinyint DEFAULT 0" ) if !column_exists('borrowers', 'flgAnonymized');
+ $dbh->do( "ALTER TABLE deletedborrowers ADD COLUMN flgAnonymized tinyint DEFAULT 0" ) if !column_exists('deletedborrowers', 'flgAnonymized');
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 21336 - Add field flgAnonymized)\n";
+}
+
+$DBversion = '18.12.00.050';
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do( q|
+INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` )
+VALUES
+('UnsubscribeReflectionDelay','',NULL,'Delay for locking unsubscribers', 'Integer'),
+('PatronAnonymizeDelay','',NULL,'Delay for anonymizing patrons', 'Integer'),
+('PatronRemovalDelay','',NULL,'Delay for removing anonymized patrons', 'Integer')
+ |);
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 21336 - Add preferences)\n";
+}
+
+$DBversion = '18.12.00.051';
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do( "UPDATE borrowers SET login_attempts = ? WHERE login_attempts > ?", undef, C4::Context->preference('FailedLoginAttempts'), C4::Context->preference('FailedLoginAttempts') );
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 21336 - Reset login_attempts)\n";
+}
+
+$DBversion = '18.12.00.052';
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do(q{
+ INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
+ ('OpacMoreSearches', '', NULL, 'Add additional elements to the OPAC more searches bar', 'Textarea')
+ } );
+
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 22311 - Add a SysPref to allow adding content to the #moresearches div in the opac)\n";
+}
+
# SEE bug 13068
# if there is anything in the atomicupdate, read and execute it.
=head1 FUNCTIONS
-=head2 TableExists($table)
-
-=cut
-
-sub TableExists {
- my $table = shift;
- eval {
- local $dbh->{PrintError} = 0;
- local $dbh->{RaiseError} = 1;
- $dbh->do(qq{SELECT * FROM $table WHERE 1 = 0 });
- };
- return 1 unless $@;
- return 0;
-}
-
=head2 DropAllForeignKeys($table)
Drop all foreign keys of the table $table