Bug 11706: Typo fix for "efault" in old database update
[koha-ffzg.git] / installer / data / mysql / updatedatabase.pl
index ec4b51a..a0698ef 100755 (executable)
@@ -7205,7 +7205,7 @@ $DBversion = "3.13.00.029";
 if ( CheckVersion($DBversion) ) {
     $dbh->do(q{
         INSERT IGNORE INTO export_format( profile, description, content, csv_separator, type )
-        VALUES ( "issues to claim", "efault CSV export for serial issue claims",
+        VALUES ( "issues to claim", "Default CSV export for serial issue claims",
                 "SUPPLIER=aqbooksellers.name|TITLE=subscription.title|ISSUE NUMBER=serial.serialseq|LATE SINCE=serial.planneddate",
                 ",", "sql" )
     });
@@ -9439,7 +9439,7 @@ if ( CheckVersion($DBversion) ) {
 }
 
 $DBversion = "3.17.00.053";
-if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+if ( CheckVersion($DBversion) ) {
     $dbh->do(q{
         INSERT INTO permissions (module_bit, code, description) VALUES ('9', 'edit_items_restricted', 'Limit item modification to subfields defined in the SubfieldsToAllowForRestrictedEditing preference (please note that edit_item is still required)');
     });
@@ -9481,7 +9481,7 @@ if (CheckVersion($DBversion)) {
 }
 
 $DBversion = "3.17.00.055";
-if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+if ( CheckVersion($DBversion) ) {
     $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('NorwegianPatronDBEnable', '0', NULL, 'Enable communication with the Norwegian national patron database.', 'YesNo')");
     $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('NorwegianPatronDBEndpoint', '', NULL, 'Which NL endpoint to use.', 'Free')");
     $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('NorwegianPatronDBUsername', '', NULL, 'Username for communication with the Norwegian national patron database.', 'Free')");
@@ -9506,7 +9506,7 @@ CREATE TABLE borrower_sync (
 }
 
 $DBversion = "3.17.00.056";
-if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+if ( CheckVersion($DBversion) ) {
     $dbh->do(q{
         UPDATE systempreferences SET value = 'pubdate,itemtype,language,sorting,location' WHERE variable='OpacAdvSearchOptions'
     });
@@ -9519,6 +9519,72 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
     SetVersion($DBversion);
 }
 
+$DBversion = "3.17.00.057";
+if ( CheckVersion($DBversion) ) {
+    print "Upgrade to $DBversion done (Koha 3.18 beta)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.17.00.058";
+if( CheckVersion($DBversion) ){
+    $dbh->do("INSERT INTO systempreferences (variable, explanation, type) VALUES('DefaultLongOverdueChargeValue','Charge a lost item to the borrower account when the LOST value of the item changes to n',  'integer')");
+    $dbh->do("INSERT INTO systempreferences (variable, explanation, type) VALUES('DefaultLongOverdueLostValue', 'Set the LOST value of an item to n when the item has been overdue for more than defaultlongoverduedays days.', 'integer')");
+    $dbh->do("INSERT INTO systempreferences (variable, explanation, type) VALUES('DefaultLongOverdueDays', 'Set the LOST value of an item when the item has been overdue for more than n days.',  'integer')");
+    print "Upgrade to $DBversion done (Bug 8337: System preferences for longoverdue cron)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.17.00.059";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do(q{
+        UPDATE permissions SET description = "Add and delete budgets (but can't modifiy budgets)" WHERE description = "Add and delete budgets (but cant modify budgets)";
+    });
+    print "Upgrade to $DBversion done (Bug 10749: Fix typo in budget_add_del permission description)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.17.00.060";
+if ( CheckVersion($DBversion) ) {
+    my $count_l = $dbh->selectcol_arrayref(q|
+        SELECT COUNT(*) FROM letter WHERE message_transport_type='feed'
+    |);
+    my $count_mq = $dbh->selectcol_arrayref(q|
+        SELECT COUNT(*) FROM message_queue WHERE message_transport_type='feed'
+    |);
+    my $count_ott = $dbh->selectcol_arrayref(q|
+        SELECT COUNT(*) FROM overduerules_transport_types WHERE message_transport_type='feed'
+    |);
+    my $count_mt = $dbh->selectcol_arrayref(q|
+        SELECT COUNT(*) FROM message_transports WHERE message_transport_type='feed'
+    |);
+    my $count_bmtp = $dbh->selectcol_arrayref(q|
+        SELECT COUNT(*) FROM borrower_message_transport_preferences WHERE message_transport_type='feed'
+    |);
+
+    my $deleted = 0;
+    if ( $count_l->[0] == 0 and $count_mq->[0] == 0 and $count_ott->[0] == 0 and $count_mt->[0] == 0 and $count_bmtp->[0] == 0 ) {
+        $deleted = $dbh->do(q|
+            DELETE FROM message_transport_types where message_transport_type='feed'
+        |);
+        $deleted = $deleted ne '0E0' ? 1 : 0;
+    }
+
+    print "Upgrade to $DBversion done (Bug 12298: Delete the 'feed' message transport type " . ($deleted ? '(deleted!)' : '(not deleted)') . ")\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.18.00.000";
+if ( CheckVersion($DBversion) ) {
+    print "Upgrade to $DBversion done (3.18.0 release)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.19.00.000";
+if ( CheckVersion($DBversion) ) {
+    print "Upgrade to $DBversion done (there's life after 3.18)\n";
+    SetVersion ($DBversion);
+}
+
 =head1 FUNCTIONS
 
 =head2 TableExists($table)