From 39cbd7629f685afd25064ab7f81c545445aa46ea Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Thu, 27 Aug 2015 23:49:25 +0200
Subject: [PATCH] Fix error message during import

---
 htdocs/compta/facture/fiche-rec.php   |  2 +-
 htdocs/core/class/translate.class.php | 17 +++++++++++++++--
 htdocs/imports/import.php             |  4 ++--
 htdocs/langs/en_US/errors.lang        |  2 +-
 htdocs/langs/fr_FR/errors.lang        |  2 +-
 5 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php
index eefedcdcc6e..460c0bffcab 100644
--- a/htdocs/compta/facture/fiche-rec.php
+++ b/htdocs/compta/facture/fiche-rec.php
@@ -636,7 +636,7 @@ else
 					$i++;
 				}
 			}
-			else print '<tr><td>'.$langs->trans("NoneF").'</td></tr>';
+			else print '<tr '.$bc[false].'><td colspan="6">'.$langs->trans("NoneF").'</td></tr>';
 
 			print "</table>";
 			$db->free($resql);
diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php
index 37846bf2421..100af13af5d 100644
--- a/htdocs/core/class/translate.class.php
+++ b/htdocs/core/class/translate.class.php
@@ -421,7 +421,11 @@ class Translate
                 }
             }
 
-            if (! preg_match('/^Format/',$key)) $str=sprintf($str,$param1,$param2,$param3,$param4);	// Replace %s and %d except for FormatXXX strings.
+            if (! preg_match('/^Format/',$key)) 
+            {
+            	//print $str;
+            	$str=sprintf($str,$param1,$param2,$param3,$param4);	// Replace %s and %d except for FormatXXX strings.
+            }
 
 			if ($maxsize) $str=dol_trunc($str,$maxsize);
 
@@ -497,7 +501,11 @@ class Translate
                 }
             }
 
-            if (! preg_match('/^Format/',$key)) $str=sprintf($str,$param1,$param2,$param3,$param4);	// Replace %s and %d except for FormatXXX strings.
+            if (! preg_match('/^Format/',$key)) 
+            {
+            	//print $str;
+           		$str=sprintf($str,$param1,$param2,$param3,$param4);	// Replace %s and %d except for FormatXXX strings.
+            }
 
             return $str;
 		}
@@ -819,3 +827,8 @@ class Translate
 	}
 }
 
+
+function warning_handler($errno, $errstr, $errfile, $errline, array $errcontext) {
+	global $str;
+	print 'str='.$str;
+}
diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php
index 9c48c680c3f..a103a304630 100644
--- a/htdocs/imports/import.php
+++ b/htdocs/imports/import.php
@@ -1335,10 +1335,10 @@ if ($step == 5 && $datatoimport)
                 	continue;
                 }
                 if ($excludefirstline && $sourcelinenb == 1) continue;
-
+                
                 //
                 $result=$obj->import_insert($arrayrecord,$array_match_file_to_database,$objimport,count($fieldssource),$importid);
-
+                
                 if (count($obj->errors))   $arrayoferrors[$sourcelinenb]=$obj->errors;
                 if (count($obj->warnings)) $arrayofwarnings[$sourcelinenb]=$obj->warnings;
                 if (! count($obj->errors) && ! count($obj->warnings)) $nbok++;
diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang
index 93047c8199f..e01acb3ea0e 100755
--- a/htdocs/langs/en_US/errors.lang
+++ b/htdocs/langs/en_US/errors.lang
@@ -79,7 +79,7 @@ ErrorModuleRequireJavascript=Javascript must not be disabled to have this featur
 ErrorPasswordsMustMatch=Both typed passwords must match each other
 ErrorContactEMail=A technical error occured. Please, contact administrator to following email <b>%s</b> en provide the error code <b>%s</b> in your message, or even better by adding a screen copy of this page.
 ErrorWrongValueForField=Wrong value for field number <b>%s</b> (value '<b>%s</b>' does not match regex rule <b>%s</b>)
-ErrorFieldValueNotIn=Wrong value for field number <b>%s</b> (value '<b>%s</b>' is not a value available into field <b>%s</b> of table <b>%s</b> = <b>%s</b>)
+ErrorFieldValueNotIn=Wrong value for field number <b>%s</b> (value '<b>%s</b>' is not a value available into field <b>%s</b> of table <b>%s</b>)
 ErrorFieldRefNotIn=Wrong value for field number <b>%s</b> (value '<b>%s</b>' is not a <b>%s</b> existing ref)
 ErrorsOnXLines=Errors on <b>%s</b> source record(s)
 ErrorFileIsInfectedWithAVirus=The antivirus program was not able to validate the file (file might be infected by a virus)
diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang
index d4ad8f2fb0d..83f4abf3fd8 100644
--- a/htdocs/langs/fr_FR/errors.lang
+++ b/htdocs/langs/fr_FR/errors.lang
@@ -79,7 +79,7 @@ ErrorModuleRequireJavascript=Le javascript ne doit pas être désactivé pour qu
 ErrorPasswordsMustMatch=Les 2 mots de passe saisis doivent correspondre
 ErrorContactEMail=Une erreur technique est apparue. Merci de contacter l'administrateur à l'email suivant <b>%s</b> en lui indiquant le code erreur <b>%s</b> dans votre message ou mieux en fournissant une copie d'écran de cette page.
 ErrorWrongValueForField=Mauvaise valeur pour le champ numéro <b>%s</b> (la valeur '<b>%s</b>' ne respecte pas la règle <b>%s</b>)
-ErrorFieldValueNotIn=Mauvaise valeur pour le champ numéro <b>%s</b> (la valeur '<b>%s</b>' n'est pas une valeur présente dans le champ <b>%s</b> de la table <b>%s</b> = <b>%s</b>)
+ErrorFieldValueNotIn=Mauvaise valeur pour le champ numéro <b>%s</b> (la valeur '<b>%s</b>' n'est pas une valeur présente dans le champ <b>%s</b> de la table <b>%s</b>)
 ErrorFieldRefNotIn=Mauvaise valeur pour le champ numéro <b>%s</b> (la valeur '<b>%s</b>' n'est pas une référence existante comme <b>%s</b>)
 ErrorsOnXLines=Erreurs sur <b>%s</b> enregistrement(s) source
 ErrorFileIsInfectedWithAVirus=L'antivirus n'a pas pu valider ce fichier (il est probablement infecté par un virus) !
-- 
GitLab