Browse Source

FIX #22271

Laurent Destailleur 2 years ago
parent
commit
94fb344bd6
1 changed files with 6 additions and 2 deletions
  1. 6 2
      htdocs/imports/import.php

+ 6 - 2
htdocs/imports/import.php

@@ -815,18 +815,22 @@ if ($step == 4 && $datatoimport) {
 		$array_match_file_to_database = array();
 	}
 
-	// Load source fields in input file
+	// Load the source fields from input file into variable $arrayrecord
 	$fieldssource = array();
 	$result = $obj->import_open_file($conf->import->dir_temp.'/'.$filetoimport, $langs);
 	if ($result >= 0) {
 		// Read first line
 		$arrayrecord = $obj->import_read_record();
-		// Put into array fieldssource starting with 1.
+
+		// Create array $fieldssource starting with 1 with values found of first line.
 		$i = 1;
 		foreach ($arrayrecord as $key => $val) {
 			if ($val["type"] != -1) {
 				$fieldssource[$i]['example1'] = dol_trunc($val['val'], 128);
 				$i++;
+			} else {
+				$fieldssource[$i]['example1'] = $langs->trans('Empty');
+				$i++;
 			}
 		}
 		$obj->import_close_file();