Fix sort order of import profiles.

This commit is contained in:
Laurent Destailleur 2020-09-10 15:43:50 +02:00
parent 6a9cadd9d4
commit 753330e499
3 changed files with 15 additions and 68 deletions

View File

@ -171,7 +171,7 @@ class Import
// Sql request to run after import
$this->array_import_run_sql_after[$i] = (isset($module->import_run_sql_after_array[$r]) ? $module->import_run_sql_after_array[$r] : '');
// Module
$this->array_import_module[$i] = $module;
$this->array_import_module[$i] = array('position_of_profile'=>($module->module_position.'-'.$module->import_code[$r]), 'module'=>$module);
dol_syslog("Import loaded for module ".$modulename." with index ".$i.", dataset=".$module->import_code[$r].", nb of fields=".count($module->import_fields_array[$r]));
$i++;

View File

@ -346,17 +346,17 @@ if ($step == 1 || !$datatoimport)
if (count($objimport->array_import_module))
{
$sortedarrayofmodules = dol_sort_array($objimport->array_import_module, 'module_position', 'asc', 0, 0, 1);
$sortedarrayofmodules = dol_sort_array($objimport->array_import_module, 'position_of_profile', 'asc', 0, 0, 1);
foreach ($sortedarrayofmodules as $key => $value)
{
//var_dump($objimport->array_import_code[$key]);
//var_dump($key.' '.$value['position_of_profile'].' '.$value['import_code'].' '.$objimport->array_import_module[$key]['module']->getName().' '.$objimport->array_import_code[$key]);
print '<tr class="oddeven"><td>';
$titleofmodule = $objimport->array_import_module[$key]->getName();
$titleofmodule = $objimport->array_import_module[$key]['module']->getName();
// Special cas for import common to module/services
if (in_array($objimport->array_import_code[$key], array('produit_supplierprices', 'produit_multiprice', 'produit_languages'))) $titleofmodule = $langs->trans("ProductOrService");
print $titleofmodule;
print '</td><td>';
print img_object($objimport->array_import_module[$key]->getName(), $objimport->array_import_icon[$key]).' ';
print img_object($objimport->array_import_module[$key]['module']->getName(), $objimport->array_import_icon[$key]).' ';
print $objimport->array_import_label[$key];
print '</td><td style="text-align: right">';
if ($objimport->array_import_perms[$key])
@ -400,7 +400,7 @@ if ($step == 2 && $datatoimport)
// Module
print '<tr><td class="titlefield">'.$langs->trans("Module").'</td>';
print '<td>';
$titleofmodule = $objimport->array_import_module[0]->getName();
$titleofmodule = $objimport->array_import_module[0]['module']->getName();
// Special cas for import common to module/services
if (in_array($objimport->array_import_code[0], array('produit_supplierprices', 'produit_multiprice', 'produit_languages'))) $titleofmodule = $langs->trans("ProductOrService");
print $titleofmodule;
@ -409,7 +409,7 @@ if ($step == 2 && $datatoimport)
// Lot de donnees a importer
print '<tr><td>'.$langs->trans("DatasetToImport").'</td>';
print '<td>';
print img_object($objimport->array_import_module[0]->getName(), $objimport->array_import_icon[0]).' ';
print img_object($objimport->array_import_module[0]['module']->getName(), $objimport->array_import_icon[0]).' ';
print $objimport->array_import_label[0];
print '</td></tr>';
@ -490,7 +490,7 @@ if ($step == 3 && $datatoimport)
// Module
print '<tr><td class="titlefield">'.$langs->trans("Module").'</td>';
print '<td>';
$titleofmodule = $objimport->array_import_module[0]->getName();
$titleofmodule = $objimport->array_import_module[0]['module']->getName();
// Special cas for import common to module/services
if (in_array($objimport->array_import_code[0], array('produit_supplierprices', 'produit_multiprice', 'produit_languages'))) $titleofmodule = $langs->trans("ProductOrService");
print $titleofmodule;
@ -499,7 +499,7 @@ if ($step == 3 && $datatoimport)
// Lot de donnees a importer
print '<tr><td>'.$langs->trans("DatasetToImport").'</td>';
print '<td>';
print img_object($objimport->array_import_module[0]->getName(), $objimport->array_import_icon[0]).' ';
print img_object($objimport->array_import_module[0]['module']->getName(), $objimport->array_import_icon[0]).' ';
print $objimport->array_import_label[0];
print '</td></tr>';
@ -773,7 +773,7 @@ if ($step == 4 && $datatoimport)
// Module
print '<tr><td class="titlefield">'.$langs->trans("Module").'</td>';
print '<td>';
$titleofmodule = $objimport->array_import_module[0]->getName();
$titleofmodule = $objimport->array_import_module[0]['module']->getName();
// Special cas for import common to module/services
if (in_array($objimport->array_import_code[0], array('produit_supplierprices', 'produit_multiprice', 'produit_languages'))) $titleofmodule = $langs->trans("ProductOrService");
print $titleofmodule;
@ -782,7 +782,7 @@ if ($step == 4 && $datatoimport)
// Lot de donnees a importer
print '<tr><td>'.$langs->trans("DatasetToImport").'</td>';
print '<td>';
print img_object($objimport->array_import_module[0]->getName(), $objimport->array_import_icon[0]).' ';
print img_object($objimport->array_import_module[0]['module']->getName(), $objimport->array_import_icon[0]).' ';
print $objimport->array_import_label[0];
print '</td></tr>';
@ -1239,7 +1239,7 @@ if ($step == 5 && $datatoimport)
// Module
print '<tr><td class="titlefield">'.$langs->trans("Module").'</td>';
print '<td>';
$titleofmodule = $objimport->array_import_module[0]->getName();
$titleofmodule = $objimport->array_import_module[0]['module']->getName();
// Special cas for import common to module/services
if (in_array($objimport->array_import_code[0], array('produit_supplierprices', 'produit_multiprice', 'produit_languages'))) $titleofmodule = $langs->trans("ProductOrService");
print $titleofmodule;
@ -1248,7 +1248,7 @@ if ($step == 5 && $datatoimport)
// Lot de donnees a importer
print '<tr><td>'.$langs->trans("DatasetToImport").'</td>';
print '<td>';
print img_object($objimport->array_import_module[0]->getName(), $objimport->array_import_icon[0]).' ';
print img_object($objimport->array_import_module[0]['module']->getName(), $objimport->array_import_icon[0]).' ';
print $objimport->array_import_label[0];
print '</td></tr>';
@ -1662,7 +1662,7 @@ if ($step == 6 && $datatoimport)
// Module
print '<tr><td class="titlefield">'.$langs->trans("Module").'</td>';
print '<td>';
$titleofmodule = $objimport->array_import_module[0]->getName();
$titleofmodule = $objimport->array_import_module[0]['module']->getName();
// Special cas for import common to module/services
if (in_array($objimport->array_import_code[0], array('produit_supplierprices', 'produit_multiprice', 'produit_languages'))) $titleofmodule = $langs->trans("ProductOrService");
print $titleofmodule;
@ -1671,7 +1671,7 @@ if ($step == 6 && $datatoimport)
// Lot de donnees a importer
print '<tr><td>'.$langs->trans("DatasetToImport").'</td>';
print '<td>';
print img_object($objimport->array_import_module[0]->getName(), $objimport->array_import_icon[0]).' ';
print img_object($objimport->array_import_module[0]['module']->getName(), $objimport->array_import_icon[0]).' ';
print $objimport->array_import_label[0];
print '</td></tr>';

View File

@ -45,69 +45,18 @@ llxHeader('', $langs->trans("ImportArea"), 'EN:Module_Imports_En|FR:Module_Impor
print load_fiche_titre($langs->trans("ImportArea"));
print $langs->trans("FormatedImportDesc1").'<br>';
//print $langs->trans("FormatedImportDesc2").'<br>';
print '<br>';
//print '<div class="fichecenter"><div class="fichehalfleft">';
// List of import set
/*
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Module").'</td>';
print '<td>'.$langs->trans("ImportableDatas").'</td>';
//print '<td>&nbsp;</td>';
print '</tr>';
if (count($import->array_import_code))
{
foreach ($import->array_import_code as $key => $value)
{
print '<tr class="oddeven"><td>';
print img_object($import->array_import_module[$key]->getName(),$import->array_import_module[$key]->picto).' ';
print $import->array_import_module[$key]->getName();
print '</td><td>';
$string=$langs->trans($import->array_import_label[$key]);
print ($string!=$import->array_import_label[$key]?$string:$import->array_import_label[$key]);
print '</td>';
// print '<td width="24">';
// print '<a href="'.DOL_URL_ROOT.'/imports/import.php?step=2&amp;datatoimport='.$import->array_import_code[$key].'&amp;action=cleanselect">'.img_picto($langs->trans("NewImport"),'filenew').'</a>';
// print '</td>';
print '</tr>';
}
}
else
{
print '<tr><td '.$bc[false].' colspan="2">'.$langs->trans("NoImportableData").'</td></tr>';
}
print '</table>';
print '</div>';
print '<br>';
*/
print '<div class="center">';
if (count($import->array_import_code))
{
//if ($user->rights->import->run)
//{
print dolGetButtonTitle($langs->trans('NewImport'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/imports/import.php?leftmenu=import');
//}
//else
//{
// print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("NewImport").'</a>';
//}
}
print '</div>';
print '<br>';
//print '</div><div class="fichehalfright"><div class="ficheaddleft">';
// List of available import format
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
@ -136,8 +85,6 @@ print '</table>';
print '</div>';
//print '</div></div></div>';
// End of page
llxFooter();
$db->close();