|);
if( $OpacNavRight ){
# If there is a value in the OpacNavRight preference, insert it into opac_news
- $dbh->do("INSERT INTO opac_news (branchcode, lang, title, content ) VALUES (NULL, 'OpacNavRight_$langs[0]', '', '$OpacNavRight')");
+ $dbh->do("INSERT INTO opac_news (branchcode, lang, title, content ) VALUES (NULL, ?, '', ?)", undef, "OpacNavRight_$langs[0]", $OpacNavRight);
}
# Remove the OpacNavRight system preference
$dbh->do("DELETE FROM systempreferences WHERE variable='OpacNavRight'");
$DBversion = '18.12.00.064';
if( CheckVersion( $DBversion ) ) {
$dbh->do(q{
- INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('UpdateItemLocationOnCheckin', 'PROC: _PERM_\n', 'NULL', 'This a list of value pairs.\n Examples:\n PROC: FIC - causes an item in the Processing Center location to be updated into the Fiction location on check in.\n FIC: GEN - causes an item in the Fiction location to be updated into the General stacks location on check in.\n _BLANK_:FIC - causes an item that has no location to be updated into the Fiction location on check in.\nFIC: _BLANK_ - causes an item in location FIC to be updated to a blank location on check in.\n_ALL_:FIC - causes all items to be updated into the Fiction location on check in.\nPROC: _PERM_ - causes an item that is in the Processing Center to be updated to it''s permanent location.\nGeneral rule: if the location value on the left matches the item''s current location, it will be updated to match the location value on the right.\nNote: PROC and CART are special values, for these locations only can location and permanent_location differ, in all other cases an update will affect both. Items in the CART location will be returned to their permanent location on checkout.\nThe special term _BLANK_ may be used on either side of a value pair to update or remove the location from items with no locaiton assigned. The special term _ALL_ is used on the left side of the colon (:) to affect all items.\nThe special term _PERM_ is used on the right side of the colon (:) to return items to their permanent location.', 'Free');
+ INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('UpdateItemLocationOnCheckin', 'PROC: _PERM_\n', 'NULL', 'This is a list of value pairs.\n Examples:\n PROC: FIC - causes an item in the Processing Center location to be updated into the Fiction location on check in.\n FIC: GEN - causes an item in the Fiction location to be updated into the General stacks location on check in.\n _BLANK_:FIC - causes an item that has no location to be updated into the Fiction location on check in.\nFIC: _BLANK_ - causes an item in location FIC to be updated to a blank location on check in.\n_ALL_:FIC - causes all items to be updated into the Fiction location on check in.\nPROC: _PERM_ - causes an item that is in the Processing Center to be updated to it''s permanent location.\nGeneral rule: if the location value on the left matches the item''s current location, it will be updated to match the location value on the right.\nNote: PROC and CART are special values, for these locations only can location and permanent_location differ, in all other cases an update will affect both. Items in the CART location will be returned to their permanent location on checkout.\nThe special term _BLANK_ may be used on either side of a value pair to update or remove the location from items with no location assigned. The special term _ALL_ is used on the left side of the colon (:) to affect all items.\nThe special term _PERM_ is used on the right side of the colon (:) to return items to their permanent location.', 'Free');
});
$dbh->do(q{
UPDATE systempreferences s1, (SELECT IF(value,'PROC: CART\n','') AS p2c FROM systempreferences WHERE variable='InProcessingToShelvingCart') s2 SET s1.value= CONCAT(s2.p2c, REPLACE(s1.value,'PROC: _PERM_\n','') ) WHERE s1.variable='UpdateItemLocationOnCheckin' AND s1.value NOT LIKE '%PROC: CART%';
$DBversion = '18.12.00.069';
if( CheckVersion( $DBversion ) ) {
- use Koha::Plugins;
-
- my @plugins = Koha::Plugins->new({ enable_plugins => 1 })->GetPlugins({ all => 1 });
- foreach my $plugin ( @plugins ) {
- $plugin->enable;
- }
+ $dbh->do(q{
+ INSERT INTO plugin_data
+ (plugin_class, plugin_key, plugin_value)
+ SELECT
+ plugin_class,
+ '__ENABLED__',
+ 1
+ FROM plugin_data
+ WHERE plugin_key='__INSTALLED_VERSION__'
+ });
# Always end with this (adjust the bug info)
SetVersion( $DBversion );
print "Upgrade to $DBversion done (Bug 22809 - Move 'INVOICE' from template to a slip)\n";
}
+$DBversion = '18.12.00.073';
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do( q{
+ INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES
+ ('EmailPurchaseSuggestions','0','0|EmailAddressForSuggestions|BranchEmailAddress|KohaAdminEmailAddress','Choose email address that will be sent new purchase suggestions','Choice'),
+ ('EmailAddressForSuggestions','','','If you choose EmailAddressForSuggestions you should enter a valid email address','free')
+ });
+
+ $dbh->do( q{
+ INSERT IGNORE INTO `letter` (module, code, name, title, content, is_html, message_transport_type) VALUES
+ ('suggestions','NEW_SUGGESTION','New suggestion','New suggestion','<h3>Suggestion pending approval</h3>
+ <p><h4>Suggested by</h4>
+ <ul>
+ <li><<borrowers.firstname>> <<borrowers.surname>></li>
+ <li><<borrowers.cardnumber>></li>
+ <li><<borrowers.phone>></li>
+ <li><<borrowers.email>></li>
+ </ul>
+ </p>
+ <p><h4>Title suggested</h4>
+ <ul>
+ <li><b>Library:</b> <<branches.branchname>></li>
+ <li><b>Title:</b> <<suggestions.title>></li>
+ <li><b>Author:</b> <<suggestions.author>></li>
+ <li><b>Copyright date:</b> <<suggestions.copyrightdate>></li>
+ <li><b>Standard number (ISBN, ISSN or other):</b> <<suggestions.isbn>></li>
+ <li><b>Publisher:</b> <<suggestions.publishercode>></li>
+ <li><b>Collection title:</b> <<suggestions.collectiontitle>></li>
+ <li><b>Publication place:</b> <<suggestions.place>></li>
+ <li><b>Quantity:</b> <<suggestions.quantity>></li>
+ <li><b>Item type:</b> <<suggestions.itemtype>></li>
+ <li><b>Reason for suggestion:</b> <<suggestions.patronreason>></li>
+ <li><b>Notes:</b> <<suggestions.note>></li>
+ </ul>
+ </p>',1, 'email')
+ });
+
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 5770 - Email librarian when purchase suggestion made)\n";
+}
+
+$DBversion = '18.12.00.074';
+if( CheckVersion( $DBversion ) ) {
+ unless ( TableExists( 'keyboard_shortcuts' ) ) {
+ $dbh->do(q|
+ CREATE TABLE keyboard_shortcuts (
+ shortcut_name varchar(80) NOT NULL,
+ shortcut_keys varchar(80) NOT NULL,
+ PRIMARY KEY (shortcut_name)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;|
+ );
+ }
+ $dbh->do(q|
+ INSERT IGNORE INTO keyboard_shortcuts (shortcut_name, shortcut_keys) VALUES
+ ("insert_copyright","Alt-C"),
+ ("insert_copyright_sound","Alt-P"),
+ ("insert_delimiter","Ctrl-D"),
+ ("subfield_help","Ctrl-H"),
+ ("link_authorities","Shift-Ctrl-L"),
+ ("delete_field","Ctrl-X"),
+ ("delete_subfield","Shift-Ctrl-X"),
+ ("new_line","Enter"),
+ ("line_break","Shift-Enter"),
+ ("next_position","Tab"),
+ ("prev_position","Shift-Tab")
+ ;|
+ );
+ $dbh->do(q|
+ INSERT IGNORE permissions (module_bit, code, description)
+ VALUES
+ (3,'manage_keyboard_shortcuts','Manage keyboard shortcuts for advanced cataloging editor')
+ ;|
+ );
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 21411 - Add keyboard_shortcuts table)\n";
+}
+
+$DBversion = '18.12.00.075';
+if( CheckVersion( $DBversion ) ) {
+ # you can use $dbh here like:
+ unless ( foreign_key_exists( 'tmp_holdsqueue', 'tmp_holdsqueue_ibfk_1' ) ) {
+ $dbh->do(q{
+ DELETE t FROM tmp_holdsqueue t
+ LEFT JOIN items i ON t.itemnumber=i.itemnumber
+ WHERE i.itemnumber IS NULL
+ });
+ $dbh->do(q{
+ ALTER TABLE tmp_holdsqueue
+ ADD CONSTRAINT `tmp_holdsqueue_ibfk_1` FOREIGN KEY (`itemnumber`)
+ REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE
+ });
+ }
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 22899 - Add items constraint to tmp_holdsqueue)\n";
+}
+
+$DBversion = '19.05.00.000';
+if( CheckVersion( $DBversion ) ) {
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (19.05.00 release)\n";
+}
+
+$DBversion = '19.06.00.000';
+if( CheckVersion( $DBversion ) ) {
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Wingardium Leviosa!)\n";
+}
+
+$DBversion = '19.06.00.001';
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do( q{
+ UPDATE systempreferences
+ SET explanation = 'This is a list of value pairs.\n Examples:\n PROC: FIC - causes an item in the Processing Center location to be updated into the Fiction location on check in.\n FIC: GEN - causes an item in the Fiction location to be updated into the General stacks location on check in.\n _BLANK_:FIC - causes an item that has no location to be updated into the Fiction location on check in.\nFIC: _BLANK_ - causes an item in location FIC to be updated to a blank location on check in.\n_ALL_:FIC - causes all items to be updated into the Fiction location on check in.\nPROC: _PERM_ - causes an item that is in the Processing Center to be updated to it''s permanent location.\nGeneral rule: if the location value on the left matches the item''s current location, it will be updated to match the location value on the right.\nNote: PROC and CART are special values, for these locations only can location and permanent_location differ, in all other cases an update will affect both. Items in the CART location will be returned to their permanent location on checkout.\nThe special term _BLANK_ may be used on either side of a value pair to update or remove the location from items with no location assigned. The special term _ALL_ is used on the left side of the colon (:) to affect all items.\nThe special term _PERM_ is used on the right side of the colon (:) to return items to their permanent location.'
+ WHERE variable = 'UpdateItemLocationOnCheckin'
+ });
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 22960: Fix typo in syspref description)\n";
+}
+
+$DBversion = '19.06.00.002';
+if ( CheckVersion($DBversion) ) {
+
+ $dbh->do(q{ALTER TABLE subscriptionhistory CHANGE opacnote opacnote LONGTEXT NULL});
+ $dbh->do(q{ALTER TABLE subscriptionhistory CHANGE librariannote librariannote LONGTEXT NULL});
+
+ $dbh->do(q{UPDATE subscriptionhistory SET opacnote = NULL WHERE opacnote = ''});
+ $dbh->do(q{UPDATE subscriptionhistory SET librariannote = NULL WHERE librariannote = ''});
+
+ SetVersion ($DBversion);
+ print "Upgrade to $DBversion done (Bug 10215 - Increase the size of opacnote and librariannote for table subscriptionhistory)\n";
+}
+
+$DBversion = '19.06.00.003';
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do(q{UPDATE systempreferences SET value = REPLACE( value, ' ', '|' ) WHERE variable = 'UniqueItemFields'; });
+
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 22867 - UniqueItemFields preference value should be pipe-delimited)\n";
+}
+
+$DBversion = '19.06.00.004';
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do( 'UPDATE language_descriptions SET description = "Griechisch (Modern 1453-)"
+ WHERE subtag = "el" and type = "language" and lang ="de"' );
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 22770 - Fix typo in language description for el in German)\n";
+}
+
+$DBversion = '19.06.00.005';
+if( CheckVersion( $DBversion ) ) {
+ unless ( column_exists( 'reserves', 'item_level_hold' ) ) {
+ $dbh->do( "ALTER TABLE reserves ADD COLUMN item_level_hold BOOLEAN NOT NULL DEFAULT 0 AFTER itemtype" );
+ }
+ unless ( column_exists( 'old_reserves', 'item_level_hold' ) ) {
+ $dbh->do( "ALTER TABLE old_reserves ADD COLUMN item_level_hold BOOLEAN NOT NULL DEFAULT 0 AFTER itemtype" );
+ }
+
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 9834 - Add the reserves.item_level_hold column)\n";
+}
+
+$DBversion = '19.06.00.006';
+if( CheckVersion( $DBversion ) ) {
+
+ unless ( TableExists('plugin_methods') ) {
+ $dbh->do(q{
+ CREATE TABLE plugin_methods (
+ plugin_class varchar(255) NOT NULL,
+ plugin_method varchar(255) NOT NULL,
+ PRIMARY KEY ( `plugin_class` (191), `plugin_method` (191) )
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+ });
+ }
+
+ require Koha::Plugins;
+ Koha::Plugins->new({ enable_plugins => 1 })->InstallPlugins;
+
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 21073 - Improve plugin performance)\n";
+}
+
+$DBversion = '19.06.00.007';
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do( "DELETE FROM systempreferences WHERE variable = 'RotationPreventTransfers'" );
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 22653 - Remove unimplemented RotationPreventTransfers system preference)\n";
+}
+
+$DBversion = '19.06.00.008';
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do( "UPDATE userflags SET flagdesc = 'Allow staff members to modify permissions and passwords for other staff members' WHERE flag = 'staffaccess'" );
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 23109 - Improve description of staffaccess permission)\n";
+}
+
+$DBversion = '19.06.00.009';
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do(q{
+ INSERT IGNORE INTO keyboard_shortcuts (shortcut_name, shortcut_keys)
+ VALUES ("toggle_keyboard", "Shift-Ctrl-K")
+ });
+
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 17178 - add shortcut to keyboard_shortcuts)\n";
+}
+
+$DBversion = '19.06.00.010';
+if( CheckVersion( $DBversion ) ) {
+
+ if ( TableExists('default_circ_rules') ) {
+ if ( column_exists( 'default_circ_rules', 'holdallowed' ) ) {
+ $dbh->do("
+ INSERT IGNORE INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
+ SELECT NULL, NULL, NULL, 'holdallowed', holdallowed
+ FROM default_circ_rules
+ ");
+ $dbh->do("
+ INSERT IGNORE INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
+ SELECT NULL, NULL, NULL, 'hold_fulfillment_policy', hold_fulfillment_policy
+ FROM default_circ_rules
+ ");
+ $dbh->do("
+ INSERT IGNORE INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
+ SELECT NULL, NULL, NULL, 'returnbranch', returnbranch
+ FROM default_circ_rules
+ ");
+ $dbh->do("DROP TABLE default_circ_rules");
+ }
+ }
+
+ if ( TableExists('default_branch_circ_rules') ) {
+ if ( column_exists( 'default_branch_circ_rules', 'holdallowed' ) ) {
+ $dbh->do("
+ INSERT IGNORE INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
+ SELECT NULL, branchcode, NULL, 'holdallowed', holdallowed
+ FROM default_branch_circ_rules
+ ");
+ $dbh->do("
+ INSERT IGNORE INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
+ SELECT NULL, branchcode, NULL, 'hold_fulfillment_policy', hold_fulfillment_policy
+ FROM default_branch_circ_rules
+ ");
+ $dbh->do("
+ INSERT IGNORE INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
+ SELECT NULL, branchcode, NULL, 'returnbranch', returnbranch
+ FROM default_branch_circ_rules
+ ");
+ $dbh->do("DROP TABLE default_branch_circ_rules");
+ }
+ }
+
+ if ( TableExists('branch_item_rules') ) {
+ if ( column_exists( 'branch_item_rules', 'holdallowed' ) ) {
+ $dbh->do("
+ INSERT IGNORE INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
+ SELECT NULL, branchcode, itemtype, 'holdallowed', holdallowed
+ FROM branch_item_rules
+ ");
+ $dbh->do("
+ INSERT IGNORE INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
+ SELECT NULL, branchcode, itemtype, 'hold_fulfillment_policy', hold_fulfillment_policy
+ FROM branch_item_rules
+ ");
+ $dbh->do("
+ INSERT IGNORE INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
+ SELECT NULL, branchcode, itemtype, 'returnbranch', returnbranch
+ FROM branch_item_rules
+ ");
+ $dbh->do("DROP TABLE branch_item_rules");
+ }
+ }
+
+ if ( TableExists('default_branch_item_rules') ) {
+ if ( column_exists( 'default_branch_item_rules', 'holdallowed' ) ) {
+ $dbh->do("
+ INSERT IGNORE INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
+ SELECT NULL, NULL, itemtype, 'holdallowed', holdallowed
+ FROM default_branch_item_rules
+ ");
+ $dbh->do("
+ INSERT IGNORE INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
+ SELECT NULL, NULL, itemtype, 'hold_fulfillment_policy', hold_fulfillment_policy
+ FROM default_branch_item_rules
+ ");
+ $dbh->do("
+ INSERT IGNORE INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
+ SELECT NULL, NULL, itemtype, 'returnbranch', returnbranch
+ FROM default_branch_item_rules
+ ");
+ $dbh->do("DROP TABLE default_branch_item_rules");
+ }
+ }
+
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 18928 - Move holdallowed, hold_fulfillment_policy, returnbranch to circulation_rules)\n";
+}
+
+$DBversion = '19.06.00.011';
+if( CheckVersion( $DBversion ) ) {
+
+ if ( TableExists('refund_lost_item_fee_rules') ) {
+ if ( column_exists( 'refund_lost_item_fee_rules', 'refund' ) ) {
+ $dbh->do("
+ INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
+ SELECT NULL, IF(branchcode='*', NULL, branchcode), NULL, 'refund', refund
+ FROM refund_lost_item_fee_rules
+ ");
+ $dbh->do("DROP TABLE refund_lost_item_fee_rules");
+ }
+ }
+
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 18930 - Move lost item refund rules to circulation_rules table)\n";
+}
+
+$DBversion = '19.06.00.012';
+if ( CheckVersion($DBversion) ) {
+
+ # Find and correct pathological cases of LR becoming a credit
+ my $sth = $dbh->prepare( "SELECT accountlines_id, issue_id, borrowernumber, itemnumber, amount, manager_id FROM accountlines WHERE accounttype = 'LR' AND amount < 0" );
+ $sth->execute();
+ while ( my $row = $sth->fetchrow_hashref ) {
+ $dbh->do(
+ "INSERT INTO accountlines (accounttype, issue_id, borrowernumber, itemnumber, amount, manager_id, interface) VALUES ( ?, ?, ?, ?, ?, ?, ? );",
+ {},
+ (
+ 'CR', $row->{issue_id},
+ $row->{borrowernumber}, $row->{itemnumber},
+ $row->{amount}, $row->{manager_id},
+ 'upgrade'
+ )
+ );
+ my $credit_id = $dbh->last_insert_id(undef, undef, 'accountlines', undef);
+ my $amount = $row->{amount} * -1;
+ $dbh->do("INSERT INTO account_offsets (credit_id, debit_id, type, amount) VALUES (?,?,?,?);",{},($credit_id, $row->{accountlines_id}, 'Lost Item', $amount));
+ $dbh->do("UPDATE accountlines SET amount = '$amount' WHERE accountlines_id = '$row->{accountlines_id}';");
+ }
+
+ $dbh->do(qq{
+ UPDATE
+ accountlines
+ SET
+ accounttype = 'LOST',
+ status = 'RETURNED'
+ WHERE
+ accounttype = 'LR';
+ });
+
+ # Find and correct pathalogical cases of L having been converted to W
+ $sth = $dbh->prepare( "SELECT accountlines_id, issue_id, borrowernumber, itemnumber, amount, manager_id FROM accountlines WHERE accounttype = 'W' AND itemnumber IS NOT NULL" );
+ $sth->execute();
+ while ( my $row = $sth->fetchrow_hashref ) {
+ my $amount = $row->{amount} * -1;
+ $dbh->do(
+ "INSERT INTO accountlines (accounttype, issue_id, borrowernumber, itemnumber, amount, manager_id, interface) VALUES ( ?, ?, ?, ?, ?, ?, ? );",
+ {},
+ (
+ 'LOST', $row->{issue_id}, $row->{borrowernumber},
+ $row->{itemnumber}, $amount, $row->{manager_id},
+ 'upgrade'
+ )
+ );
+ my $debit_id = $dbh->last_insert_id(undef, undef, 'accountlines', undef);
+ $dbh->do(
+ "INSERT INTO account_offsets (credit_id, debit_id, type, amount) VALUES (?,?,?,?);",
+ {},
+ (
+ $row->{accountlines_id}, $debit_id,
+ 'Lost Item', $amount
+ )
+ );
+ }
+
+ $dbh->do(qq{
+ UPDATE
+ accountlines
+ SET
+ accounttype = 'LOST'
+ WHERE
+ accounttype = 'L';
+ });
+
+ $dbh->do(qq{
+ UPDATE
+ accountlines
+ SET
+ accounttype = 'LOST_RETURNED'
+ WHERE
+ accounttype = 'CR';
+ });
+
+ SetVersion($DBversion);
+ print "Upgrade to $DBversion done (Bug 22563 - Fix accounttypes for 'L', 'LR' and 'CR')\n";
+}
+
# SEE bug 13068
# if there is anything in the atomicupdate, read and execute it.
-
my $update_dir = C4::Context->config('intranetdir') . '/installer/data/mysql/atomicupdate/';
opendir( my $dirh, $update_dir );
foreach my $file ( sort readdir $dirh ) {