Verkauf/Rechnungen/Massenerstellung: keine Zahlungsbedingungen
[kivitendo-erp.git] / SL / DBUpgrade2.pm
index 65d2fec..840a1dd 100644 (file)
@@ -26,7 +26,7 @@ sub init {
 
   $params{path_suffix} ||= '';
   $params{schema}      ||= '';
-  $params{path}          = "sql/Pg-upgrade2" . $params{path_suffix};
+  $params{path}        ||= "sql/Pg-upgrade2" . $params{path_suffix};
 
   map { $self->{$_} = $params{$_} } keys %params;
 
@@ -186,11 +186,13 @@ sub process_query {
             return $errstr // '<unknown database error>' if $self->{return_on_error};
             $sth->finish();
             $dbh->rollback();
-            $form->dberror("The database update/creation did not succeed. " .
-                           "The file ${filename} containing the following " .
-                           "query failed:<br>${query}<br>" .
-                           "The error message was: ${errstr}<br>" .
-                           "All changes in that file have been reverted.");
+            if (!ref $version_or_control || ref $version_or_control ne 'HASH' || !$version_or_control->{may_fail})  {
+              $form->dberror("The database update/creation did not succeed. " .
+                             "The file ${filename} containing the following " .
+                             "query failed:<br>${query}<br>" .
+                             "The error message was: ${errstr}<br>" .
+                             "All changes in that file have been reverted.")
+            }
           }
           $sth->finish();
 
@@ -234,7 +236,7 @@ sub process_perl_script {
 
   my ($self, $dbh, $filename, $version_or_control) = @_;
 
-  my %form_values = map { $_ => $::form->{$_} } qw(dbconnect dbdefault dbhost dbname dboptions dbpasswd dbport dbupdate dbuser login template_object version);
+  my %form_values = %$::form;
 
   $dbh->begin_work;