diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php
index 82ecad62417..abf3ec45c7c 100644
--- a/htdocs/imports/import.php
+++ b/htdocs/imports/import.php
@@ -225,7 +225,7 @@ if ($step == 3 && $datatoimport)
$param='&datatoimport='.$datatoimport.'&format='.$format;
if ($excludefirstline) $param.='&excludefirstline='.$excludefirstline;
if ($endatlinenb) $param.='&endatlinenb='.$endatlinenb;
-
+
$file = $conf->import->dir_temp . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
$ret=dol_delete_file($file);
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
@@ -429,9 +429,9 @@ if ($step == 2 && $datatoimport)
print '';
print '
';
-
+
dol_fiche_end();
-
+
print '
';
@@ -1690,9 +1691,9 @@ if ($step == 6 && $datatoimport)
print '';
print '';
-
+
print '
';
-
+
print ''.$langs->trans("InformationOnSourceFile").'
';
print '';
print '
';
@@ -1848,11 +1849,11 @@ if ($step == 6 && $datatoimport)
continue;
}
if ($excludefirstline && ($sourcelinenb < $excludefirstline)) continue;
- if ($endatlinenb && ($sourcelinenb > $endatlinenb)) continue;
+ if ($endatlinenb && ($sourcelinenb > $endatlinenb)) break;
// Run import
$result=$obj->import_insert($arrayrecord,$array_match_file_to_database,$objimport,count($fieldssource),$importid,$updatekeys);
-
+
if (count($obj->errors)) $arrayoferrors[$sourcelinenb]=$obj->errors;
if (count($obj->warnings)) $arrayofwarnings[$sourcelinenb]=$obj->warnings;
if (! count($obj->errors) && ! count($obj->warnings)) $nbok++;
@@ -1866,10 +1867,10 @@ if ($step == 6 && $datatoimport)
}
if (count($arrayoferrors) > 0) $db->rollback(); // We force rollback because this was errors.
- else
+ else
{
$error=0;
-
+
// Run the sql after import if defined
//var_dump($objimport->array_import_run_sql_after[0]);
if (! empty($objimport->array_import_run_sql_after[0]) && is_array($objimport->array_import_run_sql_after[0]))
@@ -1879,18 +1880,18 @@ if ($step == 6 && $datatoimport)
{
$i++;
$resqlafterimport=$db->query($sqlafterimport);
- if (! $resqlafterimport)
+ if (! $resqlafterimport)
{
$arrayoferrors['none'][]=array('lib'=>$langs->trans("Error running final request: ".$sqlafterimport));
$error++;
}
}
}
-
+
if (! $error) $db->commit(); // We can commit if no errors.
else $db->rollback();
}
-
+
dol_fiche_end();
@@ -1930,7 +1931,7 @@ function show_elem($fieldssource,$pos,$key,$var,$nostyle='')
global $langs,$bc;
$height='24';
-
+
print "\n\n\n";
print ''."\n";