diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php
index df05b3887765e707e0502cadc422140fd77e3ac0..9b8ce75afc41d87f0b73c9dcde12e8b1d04752cf 100644
--- a/htdocs/imports/import.php
+++ b/htdocs/imports/import.php
@@ -72,6 +72,7 @@ $step=isset($_GET["step"])? $_GET["step"] : (isset($_POST["step"])?$_POST["step"
 $import_name=isset($_POST["import_name"])? $_POST["import_name"] : '';
 $hexa=isset($_POST["hexa"])? $_POST["hexa"] : '';
 $importmodelid=isset($_POST["importmodelid"])? $_POST["importmodelid"] : '';
+$excludefirstline=isset($_GET["excludefirstline"])? $_GET["excludefirstline"] : (isset($_POST["excludefirstline"])?$_POST["excludefirstline"]:0);
 
 $objimport=new Import($db);
 $objimport->load_arrays($user,$datatoimport);
@@ -1040,8 +1041,6 @@ if ($step == 4 && $datatoimport)
 // STEP 5: Summary of choices
 if ($step == 5 && $datatoimport)
 {
-	if (empty($dontimportfirstline)) $dontimportfirstline=0;
-
 	$model=$format;
 	$liste=$objmodelimport->liste_modeles($db);
 
@@ -1072,7 +1071,8 @@ if ($step == 5 && $datatoimport)
 	$nboflines=dol_count_nb_of_line($conf->import->dir_temp.'/'.$filetoimport);
 
 	$param='&format='.$format.'&datatoimport='.$datatoimport.'&filetoimport='.urlencode($filetoimport).'&nboflines='.$nboflines;
-
+	if ($excludefirstline) $param.='&excludefirstline=1';
+	
 	llxHeader('',$langs->trans("NewImport"),'EN:Module_Imports_En|FR:Module_Imports|ES:Módulo_Importaciones');
 
 	$h = 0;
@@ -1149,7 +1149,9 @@ if ($step == 5 && $datatoimport)
 	print '<tr><td>';
 	print $langs->trans("DoNotImportFirstLine");
 	print '</td><td>';
-	print '<input type="checkbox" name="nofirstline" value='.$dontimportfirstline.'>';
+	print '<input type="checkbox" name="excludefirstline" value="1"';
+	print ($excludefirstline?' checked="true"':'');
+	print '>';
 	print '</td></tr>';
 
 	print '</table>';
@@ -1247,8 +1249,6 @@ if ($step == 5 && $datatoimport)
 // STEP 6: Result of simulation
 if ($step == 6 && $datatoimport)
 {
-	if (empty($dontimportfirstline)) $dontimportfirstline=0;
-
 	$model=$format;
 	$liste=$objmodelimport->liste_modeles($db);
 
@@ -1279,7 +1279,8 @@ if ($step == 6 && $datatoimport)
 	$nboflines=(! empty($_GET["nboflines"])?$_GET["nboflines"]:dol_count_nb_of_line($conf->import->dir_temp.'/'.$filetoimport));
 
 	$param='&format='.$format.'&datatoimport='.$datatoimport.'&filetoimport='.urlencode($filetoimport).'&nboflines='.$nboflines;
-
+	if ($excludefirstline) $param.='&excludefirstline=1';
+	
 	llxHeader('',$langs->trans("NewImport"),'EN:Module_Imports_En|FR:Module_Imports|ES:M&oacute;dulo_Importaciones');
 
 	$h = 0;
@@ -1360,7 +1361,9 @@ if ($step == 6 && $datatoimport)
 	print '<tr><td>';
 	print $langs->trans("DoNotImportFirstLine");
 	print '</td><td>';
-	print '<input type="checkbox" name="nofirstline" value='.$dontimportfirstline.'>';
+	print '<input type="checkbox" name="excludefirstline" value="1"';
+	print ($excludefirstline?' checked="true"':'');
+	print '>';
 	print '</td></tr>';
 
 	print '</table>';
@@ -1432,8 +1435,8 @@ if ($step == 6 && $datatoimport)
 	// Launch import
 	$arrayoferrors=array();
 	$arrayofwarnings=array();
-	$maxnboferrors=empty($conf->global->IMPORT_MAX_NB_OF_ERRORS)?100:$conf->global->IMPORT_MAX_NB_OF_ERRORS;
-	$maxnbofwarnings=empty($conf->global->IMPORT_MAX_NB_OF_WARNINGS)?100:$conf->global->IMPORT_MAX_NB_OF_WARNINGS;
+	$maxnboferrors=empty($conf->global->IMPORT_MAX_NB_OF_ERRORS)?50:$conf->global->IMPORT_MAX_NB_OF_ERRORS;
+	$maxnbofwarnings=empty($conf->global->IMPORT_MAX_NB_OF_WARNINGS)?50:$conf->global->IMPORT_MAX_NB_OF_WARNINGS;
 	$nboferrors=0;
 	$nbofwarnings=0;
 
@@ -1453,6 +1456,8 @@ if ($step == 6 && $datatoimport)
 		while ($arrayrecord=$obj->import_read_record())
 		{
 			$sourcelinenb++;
+			if ($excludefirstline && $sourcelinenb == 1) continue;
+			
 			$result=$obj->import_insert($arrayrecord,$array_match_file_to_database,$objimport,sizeof($fieldssource),$importid);
 			if (sizeof($obj->errors))
 			{
@@ -1473,13 +1478,54 @@ if ($step == 6 && $datatoimport)
 
 	$db->rollback();	// We force rollback because this was just a simulation.
 
-	var_dump($arrayoferrors);
-	// Print result $arrayoferrors
-	foreach ($arrayoferrors as $key => $val)
+	// Errors
+	//var_dump($arrayoferrors);
+	print '<b>'.$langs->trans("Errors").'</b>';
+	print '<hr>';
+	if (sizeof($arrayoferrors))
 	{
-		//print $langs->trans("Result".$key)." ".$arrayofresult[$key].'<br>';
+		foreach ($arrayoferrors as $key => $val)
+		{
+			$nboferrors++;
+			if ($nboferrors > $maxnboferrors)
+			{
+				print $langs->trans("TooMuchErrors",(sizeof($arrayoferrors)-$nboferrors))."<br>";
+				break;
+			}
+			print '* '.$langs->trans("Line").' '.$key.'<br>';
+			foreach($val as $i => $err)
+			{
+				print ' &nbsp; - '.$err['lib'].'<br>';
+			}
+		}
 	}
+	else print $langs->trans("None"); 
+	
+	print '<br>';
 
+	// Warnings
+	//var_dump($arrayoferrors);
+	print '<b>'.$langs->trans("Warnings").'</b>';
+	print '<hr>';
+	if (sizeof($arrayofwarnings))
+	{
+		foreach ($arrayofwarnings as $key => $val)
+		{
+			$nbofwarnings++;
+			if ($nbofwarnings > $maxnbofwarnings)
+			{
+				print $langs->trans("TooMuchWarnings",(sizeof($arrayofwarnings)-$nbofwarnings))."<br>";
+				break;
+			}
+			print ' * '.$langs->trans("Line").' '.$key.'<br>';
+			foreach($val as $i => $err)
+			{
+				print ' &nbsp; - '.$err['lib'].'<br>';
+			}
+		}
+	}
+	else print $langs->trans("None"); 
+	
 	$importid=dol_print_date(dol_now('tzserver'),'%Y%m%d%H%M%S');
 
 	print '<br>';
@@ -1492,7 +1538,14 @@ if ($step == 6 && $datatoimport)
 	print '<center>';
 	if ($user->rights->import->run)
 	{
-		print '<a class="butAction" href="'.DOL_URL_ROOT.'/imports/import.php?leftmenu=import&step=7&'.$param.'">'.$langs->trans("RunImportFile").'</a>';
+		if (empty($nboferrors))
+		{
+			print '<a class="butAction" href="'.DOL_URL_ROOT.'/imports/import.php?leftmenu=import&step=7&'.$param.'">'.$langs->trans("RunImportFile").'</a>';
+		}
+		else
+		{
+			print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("CorrectErrorBeforeRunningImport")).'">'.$langs->trans("RunImportFile").'</a>';
+		}
 	}
 	else
 	{
diff --git a/htdocs/includes/modules/import/import_csv.modules.php b/htdocs/includes/modules/import/import_csv.modules.php
index 52359f3a6b5be4573bb07505add46859585969d7..d473a8943706a3163b07c34e1524d8d8f370acd8 100644
--- a/htdocs/includes/modules/import/import_csv.modules.php
+++ b/htdocs/includes/modules/import/import_csv.modules.php
@@ -272,6 +272,8 @@ class ImportCsv extends ModeleImports
      */
     function import_insert($arrayrecord,$array_match_file_to_database,$objimport,$maxfields,$importid)
     {
+    	global $langs,$conf;
+    	
     	$error=0;
     	$warning=0;
     	$this->errors=array();
@@ -288,8 +290,8 @@ class ImportCsv extends ModeleImports
 		if (sizeof($arrayrecord) == 0 ||
 			(sizeof($arrayrecord) == 1 && empty($arrayrecord[0]['val'])))
 		{
-			print 'W';
-			$this->warnings[$warning]['lib']='Empty line';
+			//print 'W';
+			$this->warnings[$warning]['lib']=$langs->trans('EmptyLine');
 			$this->warnings[$warning]['type']='EMPTY';
 			$warning++;
 		}
@@ -310,7 +312,7 @@ class ImportCsv extends ModeleImports
 					if ($key <= $maxfields)
 					{
 						if ($listfields) { $listfields.=', '; $listvalues.=', '; }
-						$listfields.=$val;
+						$listfields.=eregi_replace('^.*\.','',$val);
 						$newval='';
 						if ($arrayrecord[($key-1)]['type'] < 0)
 						{
@@ -331,7 +333,7 @@ class ImportCsv extends ModeleImports
 						// Required field is ok
 						if (eregi('\*',$objimport->array_import_fields[0][$val]) && empty($newval))
 						{
-							$this->errors[$error]['lib']='ErrorMissingMandatoryValue field nb '.$key.' target='.$val;
+							$this->errors[$error]['lib']=$langs->trans('ErrorMissingMandatoryValue',$key);
 							$this->errors[$error]['type']='NOTNULL';
 							$errorforthistable++;
 							$error++;
@@ -349,7 +351,7 @@ class ImportCsv extends ModeleImports
 				{
 					if ($listfields)
 					{
-						$sql='INSERT INTO '.$tablename.'('.$listfields.') VALUES('.$listvalues.')';
+						$sql='INSERT INTO '.$tablename.'('.$listfields.',import_key) VALUES('.$listvalues.",'".$importid."')";
 		    			dol_syslog("import_csv.modules sql=".$sql);
 
 						//print '> '.join(',',$arrayrecord);
@@ -362,12 +364,13 @@ class ImportCsv extends ModeleImports
 							$resql=$this->db->query($sql);
 							if ($resql)
 							{
-								print '.';
+								//print '.';
 							}
 							else
 							{
-								print 'E';
-								$this->errors[$error]['lib']='ErrorSQL '.$this->db->lasterror();
+								//print 'E';
+print $sql;
+								$this->errors[$error]['lib']=$this->db->lasterror();
 								$this->errors[$error]['type']='SQL';
 								$error++;
 							}
diff --git a/htdocs/langs/en_US/exports.lang b/htdocs/langs/en_US/exports.lang
index f7a6d16e4c8c6120d862c516905b8641a0750343..531cd3f23fbd6e1dc076efbe0c39668c54e41e93 100644
--- a/htdocs/langs/en_US/exports.lang
+++ b/htdocs/langs/en_US/exports.lang
@@ -86,3 +86,8 @@ SelectFormat=Choose this import file format
 RunImportFile=Launch import file
 NowClickToRunTheImport=Check result of import simulation. If everything is ok, launch the definitive import.
 DataLoadedWithId=All data will be loaded with the following import id: <b>%s<b>
+ErrorMissingMandatoryValue=Mandatory data is empty in source file for field <b>%s</b>.
+TooMuchErrors=There is still <b>%s</b> other source lines with errors but output has been limited.
+TooMuchWarnings=There is still <b>%s</b> other source lines with warnings but output has been limited.
+EmptyLine=Empty line
+CorrectErrorBeforeRunningImport=You must first correct all errors before running definitive import.
\ No newline at end of file
diff --git a/htdocs/langs/fr_FR/exports.lang b/htdocs/langs/fr_FR/exports.lang
index 4e3df02047d1c9afd64b7b0d24cac36f4563c484..2a0df76793b45eae9ed9d76702dbbb39a08f5045 100644
--- a/htdocs/langs/fr_FR/exports.lang
+++ b/htdocs/langs/fr_FR/exports.lang
@@ -85,4 +85,9 @@ SelectAtLeastOneField=Basculer au moins un champ source dans la colonne des cham
 SelectFormat=Choisir ce format de fichier import
 RunImportFile=Lancer l'import en base
 NowClickToRunTheImport=Vérifiez le résultat de la simulation. Si tout est ok, lancer l'import définitif en base.
-DataLoadedWithId=Toutes les données seront importées avec l'id d'import suivant: <b>%s</b>
\ No newline at end of file
+DataLoadedWithId=Toutes les données seront importées avec l'id d'import suivant: <b>%s</b>
+ErrorMissingMandatoryValue=Donnée obligatoire non renseignées dans le fichier source, champ numéro <b>%s</b>.
+TooMuchErrors=Il y a encore <b>%s</b> autres lignes en erreur mais leur affichage a été limité.
+TooMuchWarnings=Il y a encore <b>%s</b> autres lignes en warnings mais leur affichage a été limité.
+EmptyLine=Ligne vide
+CorrectErrorBeforeRunningImport=Vous devez d'abord corriger toutes les erreurs avant de pouvoir lancer l'import définitif.