Fix display issue on step 4 of import in import.php.

The issue was only for custom module import as the entity was
initialised with the icone name i.e. filename@modulename.

Then the arrays entitytoicon and entitytolang where used. But by
definition custom modules do not have entries in these arrays.

So changed the assignement to proper object property when $entity is not
in these 2 tables. This is not changing behaviour of default object.

I have tested both with my custom objet and product object. So it should
be fine now.
This commit is contained in:
bgenere 2016-12-03 18:46:12 +01:00
parent 5e1ee7c812
commit 09baab1076

View File

@ -867,14 +867,14 @@ if ($step == 4 && $datatoimport)
print '<tr '.$bc[$var].' height="'.$height.'">';
$i++;
$entity=(! empty($objimport->array_import_entities[0][$code])?$objimport->array_import_entities[0][$code]:$objimport->array_import_label[0]);
$entity=(! empty($objimport->array_import_entities[0][$code])?$objimport->array_import_entities[0][$code]:$objimport->array_import_icon[0]);
$tablealias=preg_replace('/(\..*)$/i','',$code);
$tablename=$objimport->array_import_tables[0][$tablealias];
$entityicon=$entitytoicon[$entity]?$entitytoicon[$entity]:$entity;
$entitylang=$entitytolang[$entity]?$entitytolang[$entity]:$entity;
$entityicon=$entitytoicon[$entity]?$entitytoicon[$entity]:$objimport->array_import_icon[0];
$entitylang=$entitytolang[$entity]?$entitytolang[$entity]:$objimport->array_import_label[0];
print '<td class="nowrap" style="font-weight: normal">'.img_object('',$entityicon).' '.$langs->trans($entitylang).'</td>';
print '<td class="nowrap" style="font-weight: normal">=>'.img_object('',$entityicon).' '.$langs->trans($entitylang).'</td>';
print '<td style="font-weight: normal">';
$newlabel=preg_replace('/\*$/','',$label);
$text=$langs->trans($newlabel);