print_options: fieses refkonstrukt umgeschrieben.
[kivitendo-erp.git] / sql / Pg-upgrade2 / USTVA_abstraction.pl
index 9c21718..83dffc6 100644 (file)
@@ -8,8 +8,13 @@
 
 ###################
 
+use strict;
+
 die("This script cannot be run from the command line.") unless ($main::form);
 
+# import vars from caller
+our ($dbup_locale, $dbup_myconfig, $dbh, $iconv);
+
 sub mydberror {
   my ($msg) = @_;
   die($dbup_locale->text("Database update error:") .
@@ -147,7 +152,7 @@ sub do_copy {
     my $query = $iconv->convert($copy_statements[$statement]);
     my $sth   = $dbh->prepare($query) || mydberror($query);
 
-    for my $copy_line ( 1 .. $#{$copy_data[$statement]} ) {
+    for my $copy_line ( 0 .. $#{$copy_data[$statement]} ) {
       #print $copy_data[$statement][$copy_line] . "<br />"
       $sth->execute(split m/;/, $iconv->convert($copy_data[$statement][$copy_line]), -1) || mydberror($query);
     }