diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php
index da917c31044..069f39d66e3 100644
--- a/htdocs/imports/import.php
+++ b/htdocs/imports/import.php
@@ -1002,7 +1002,7 @@ if ($step == 4 && $datatoimport) {
print $s;
print ' ';
$htmlother->select_import_model($importmodelid, 'importmodelid', $datatoimport, 1, $user->id);
- print ' ';
+ print ' ';
print '';
print '';
@@ -1016,7 +1016,7 @@ if ($step == 4 && $datatoimport) {
//var_dump($array_match_file_to_database);
- print '
';
+ print ' ';
$fieldsplaced = array();
$valforsourcefieldnb = array();
@@ -1034,7 +1034,6 @@ if ($step == 4 && $datatoimport) {
foreach ($fieldssource as $key => $val) {
$var = !$var;
show_elem($fieldssource, $key, $val, $var); // key is field number in source file
- //print '> '.$lefti.'-'.$key.'-'.$val;
$listofkeys[$key] = 1;
$fieldsplaced[$key] = 1;
$valforsourcefieldnb[$lefti] = $key;
@@ -1046,39 +1045,26 @@ if ($step == 4 && $datatoimport) {
}
//var_dump($valforsourcefieldnb);
- // Complete source fields from count($fieldssource)+1 to count($fieldstarget)
- /*
- $more = 1;
- $num = count($fieldssource);
- while ($lefti <= $num) {
- $var = !$var;
- $newkey = getnewkey($fieldssource, $listofkeys);
- show_elem($fieldssource, $newkey, '', $var); // key start after field number in source file
- //print '> '.$lefti.'-'.$newkey;
- $listofkeys[$key] = 1;
- $lefti++;
- $more++;
- }
- */
-
print "\n";
print "\n";
- print ' ';
+ print ' ';
// List of target fields
$optionsnotused = "";
+ $optionsall = array();
foreach ($fieldstarget as $code => $line) {
+ $text = '';
+ $text .= $langs->trans($line["label"]);
+ if ($line["required"]) {
+ $text .= "*";
+ }
+ $text .= ' ';
if (!$line["imported"]) {
- $text = '';
- $text .= $langs->trans($line["label"]);
- if ($line["required"]) {
- $text .= "*";
- }
- $text .= ' ';
$optionsnotused .= $text;
}
+ $optionsall[$code] = array('label'=>$langs->trans($line["label"]), 'required'=>(empty($line["required"]) ? 0 : 1));
}
$height = '32px'; //needs px for css height attribute below
@@ -1099,39 +1085,46 @@ if ($step == 4 && $datatoimport) {
$entityicon = !empty($entitytoicon[$entity]) ? $entitytoicon[$entity] : $entity; // $entityicon must string name of picto of the field like 'project', 'company', 'contact', 'modulename', ...
$entitylang = $entitytolang[$entity] ? $entitytolang[$entity] : $objimport->array_import_label[0]; // $entitylang must be a translation key to describe object the field is related to, like 'Company', 'Contact', 'MyModyle', ...
- print ' => '.img_object('', $entityicon).' '.$langs->trans($entitylang).' ';
+ //print '=> '.img_object('', $entityicon).' '.$langs->trans($entitylang).' ';
+ print '=> ';
print '';
print '';
if ($line["imported"]) {
print ' ';
- print '';
} else {
print ' ';
- print '';
}
- $more = '';
- $text = $langs->trans($line["label"]);
- if ($line["required"]) {
- print ''.$text.'* ';
- } else {
- print $text;
+
+ $j = 0;
+ foreach ($optionsall as $code => $val) {
+ $label = $val['required'] ? '' : '';
+ $label .= $val['label'];
+ $label .= $val['required'] ? '* ' : '';
+
+ print ' ';
+ print $label;
+ print '';
+ $j++;
}
- print ' ';
- print $optionsnotused;
print ' ';
//print ajax_combobox('selectorderimport_'.($i+1));
print " ";
print '';
- $filecolumn = !empty($array_match_database_to_file[$code])?$array_match_database_to_file[$code]:0;
+ $filecolumn = ($i + 1);
// Source field info
$htmltext = ''.$langs->trans("FieldSource").' ';
if ($filecolumn > count($fieldssource)) {
$htmltext .= $langs->trans("DataComeFromNoWhere").' ';
} else {
if (empty($objimport->array_import_convertvalue[0][$code])) { // If source file does not need convertion
- $filecolumntoshow = $filecolumn;
+ $filecolumntoshow = $i + 1;
$htmltext .= $langs->trans("DataComeFromFileFieldNb", $filecolumntoshow).' ';
} else {
if ($objimport->array_import_convertvalue[0][$code]['rule'] == 'fetchidfromref') {
@@ -1143,7 +1136,6 @@ if ($step == 4 && $datatoimport) {
}
}
// Source required
- $htmltext .= $langs->trans("SourceRequired").': '.yn($line["label"]).' ';
$example = !empty($objimport->array_import_examplevalues[0][$code])?$objimport->array_import_examplevalues[0][$code]:"";
// Example
if (empty($objimport->array_import_convertvalue[0][$code])) { // If source file does not need convertion
@@ -1166,6 +1158,7 @@ if ($step == 4 && $datatoimport) {
$htmltext .= ' ';
// Target field info
$htmltext .= ''.$langs->trans("FieldTarget").' ';
+ //$htmltext .= $langs->trans("SourceRequired").': '.yn($line["label"]).' ';
if (empty($objimport->array_import_convertvalue[0][$code])) { // If source file does not need convertion
$htmltext .= $langs->trans("DataIsInsertedInto").' ';
} else {
@@ -1236,49 +1229,87 @@ if ($step == 4 && $datatoimport) {
print ''."\n";
}
@@ -1315,6 +1346,7 @@ if ($step == 4 && $datatoimport) {
print ' ';
print ' ';
print ' ';
+ print ' ';
print ' ';
print ' ';
@@ -1333,7 +1365,7 @@ if ($step == 4 && $datatoimport) {
print $form->selectarray('visibility', $arrayvisibility, 'private');
print ' ';
print '';
- print ' ';
+ print ' ';
print ' ';
// List of existing import profils
@@ -2201,14 +2233,15 @@ function show_elem($fieldssource, $pos, $key, $var, $nostyle = '')
}
if (($pos && $pos > count($fieldssource)) && (!isset($fieldssource[$pos]["imported"]))) { // No fields
+ /*
print '';
print '';
- //print img_picto(($pos > 0 ? $langs->trans("MoveField", $pos) : ''), 'grip_title', 'class="boxhandle" style="cursor:move;"');
print ' ';
print '';
print $langs->trans("NoFields");
print ' ';
print ' ';
+ */
} elseif ($key == 'none') { // Empty line
print '';
print '';
@@ -2224,6 +2257,7 @@ function show_elem($fieldssource, $pos, $key, $var, $nostyle = '')
print ' ';
// The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object
//print img_picto($langs->trans("MoveField", $pos), 'grip_title', 'class="boxhandle" style="cursor:move;"');
+ print img_picto($langs->trans("Field").' '.$pos, 'file', 'class="pictofixedwith"');
print ' ';
if (isset($fieldssource[$pos]['imported']) && $fieldssource[$pos]['imported'] == false) {
print '';
@@ -2240,7 +2274,9 @@ function show_elem($fieldssource, $pos, $key, $var, $nostyle = '')
if (!utf8_check($example)) {
$example = utf8_encode($example);
}
- print ' ('.$example.' )';
+ print ' - ';
+ //print ''.$langs->trans("ExampleOnFirstLine").': ';
+ print ''.$example.' ';
}
print ' ';
print ' ';