Bug 18925: Move existing rules
[koha.git] / installer / data / mysql / update22to30.pl
index 9d2b9ef..d38f080 100755 (executable)
@@ -4,7 +4,7 @@
 # Database Updater
 # This script checks for required updates to the database.
 
-# Part of the Koha Library Software www.koha.org
+# Part of the Koha Library Software www.koha-community.org
 # Licensed under the GPL.
 
 # Bugs/ToDo:
@@ -445,10 +445,10 @@ my $DBversion = "3.00.00.000";
         {
                 uniquefieldrequired => 'variable',
                 variable            => 'OpacTopissue',
-                value               => '1',
+                value               => '0',
                 forceupdate         => { 'explanation' => 1,
                                         'type' => 1},
-                explanation         => 'Enable / Disable the top issue link on OPAC',
+                explanation         => 'If ON, enables the \'most popular items\' link on OPAC. Warning, this is an EXPERIMENTAL feature, turning ON may overload your server',
                 type                => 'YesNo',
             },
         {
@@ -3021,7 +3021,7 @@ my $DBversion = "3.00.00.000";
         next if $table->{Name} eq 'auth_subfield_table';
         if ($table->{Engine} ne 'InnoDB') {
             print "moving $table->{Name} to InnoDB\n";
-            $dbh->do("ALTER TABLE $table->{Name} TYPE = innodb");
+            $dbh->do("ALTER TABLE $table->{Name} ENGINE = innodb");
         }
         unless ($table->{Collation} =~ /^utf8/) {
             print "moving $table->{Name} to utf8\n";
@@ -3442,7 +3442,7 @@ my $DBversion = "3.00.00.000";
                 $dbh->do($sql);
                 if ($dbh->err) {
                     print "====================
-    An error occured during :
+    An error occurred during :
     \t$sql
     It probably means there is something wrong in your DB : a row ($table.$row->{key}) refers to a value in $row->{foreigntable}.$row->{foreignkey} that does not exist. solve the problem and run updater again (or just the previous SQL statement).
     You can find those values with select
@@ -3500,7 +3500,7 @@ my $DBversion = "3.00.00.000";
     
     # at last, remove useless fields
     foreach $table ( keys %uselessfields ) {
-        my @fields = split /,/,$uselessfields{$table};
+        my @fields = split (/,/,$uselessfields{$table});
         my $fields;
         my $exists;
         foreach my $fieldtodrop (@fields) {
@@ -3526,20 +3526,23 @@ my $DBversion = "3.00.00.000";
     #
     $sth=$dbh->prepare("ALTER TABLE `aqbookfund` DROP PRIMARY KEY , ADD PRIMARY KEY ( `bookfundid` , `branchcode` ) ;");
     $sth->execute;
+    $sth->finish;
    
     # drop extra key on borrowers.borrowernumber
     $dbh->do("ALTER TABLE borrowers DROP KEY borrowernumber"); 
-
-    $sth->finish;
+    
+    # update enrolmentperiod
+    $dbh->do("UPDATE categories SET enrolmentperiod = enrolmentperiod * 12");
+    
     print "upgrade to Koha 3.0 done\n";
     SetVersion ($DBversion);
 
-
-=item GetDefaultClause
+=head1 GetDefaultClause
 
 Generate a default clause (for an ALTER TABLE command)
 
 =cut
+
 sub GetDefaultClause {
     my $default = shift;
 
@@ -3550,11 +3553,11 @@ sub GetDefaultClause {
     return "default " . $dbh->quote($default);
 }
 
-=item TransformToNum
+=head1 TransformToNum
+
+Transform the Koha version from a 4 parts string
+to a number, with just 1.
 
-  Transform the Koha version from a 4 parts string
-  to a number, with just 1 .
-  
 =cut
 
 sub TransformToNum {
@@ -3564,8 +3567,10 @@ sub TransformToNum {
     return $version;
 }
 
-=item SetVersion
-    set the DBversion in the systempreferences
+=head1 SetVersion
+
+set the DBversion in the systempreferences
+
 =cut
 
 sub SetVersion {