diff --git a/htdocs/core/lib/import.lib.php b/htdocs/core/lib/import.lib.php index 8fa6a995331..385dee32a86 100644 --- a/htdocs/core/lib/import.lib.php +++ b/htdocs/core/lib/import.lib.php @@ -43,7 +43,11 @@ function import_prepare_head($param, $maxstep = 0) $i = 1; while ($i <= $maxstep) { - $head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step='.$i.$param; + if ($i < 6) { + $head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step='.$i.$param; + } else { + $head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step=5'.$param; // For step6, link is to step 5 + } $head[$h][1] = $langs->trans("Step")." ".$i; $head[$h][2] = 'step'.$i; $h++; diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 36dc3ca8f13..e7386f0b7e4 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -618,6 +618,7 @@ class ImportCsv extends ModeleImports if (!empty($objimport->array_import_regex[0][$val]) && ($newval != '')) { // If test is "Must exist in a field@table or field@table:..." + $reg = array(); if (preg_match('/^(.+)@([^:]+)(:.+)?$/', $objimport->array_import_regex[0][$val], $reg)) { $field = $reg[1]; @@ -844,7 +845,7 @@ class ImportCsv extends ModeleImports $sqlend .= ', '.$user->id; } $sql = $sqlstart.$sqlend.')'; - dol_syslog("import_csv.modules", LOG_DEBUG); + //dol_syslog("import_csv.modules", LOG_DEBUG); // Run insert request if ($sql) diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index c427e01a758..6c0bcc0f4b1 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -636,6 +636,7 @@ class ImportXlsx extends ModeleImports // Test regexp if (!empty($objimport->array_import_regex[0][$val]) && ($newval != '')) { // If test is "Must exist in a field@table or field@table:..." + $reg = array(); if (preg_match('/^(.+)@([^:]+)(:.+)?$/', $objimport->array_import_regex[0][$val], $reg)) { $field = $reg[1]; $table = $reg[2]; @@ -845,7 +846,7 @@ class ImportXlsx extends ModeleImports $sqlend .= ', ' . $user->id; } $sql = $sqlstart . $sqlend . ')'; - dol_syslog("import_xlsx.modules", LOG_DEBUG); + //dol_syslog("import_xlsx.modules", LOG_DEBUG); // Run insert request if ($sql) { diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 8814fa584fa..6921db8ce99 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -1255,6 +1255,14 @@ if ($step == 4 && $datatoimport) // STEP 5: Summary of choices and launch simulation if ($step == 5 && $datatoimport) { + $max_execution_time_for_importexport = (empty($conf->global->IMPORT_MAX_EXECUTION_TIME) ? 300 : $conf->global->IMPORT_MAX_EXECUTION_TIME); // 5mn if not defined + $max_time = @ini_get("max_execution_time"); + if ($max_time && $max_time < $max_execution_time_for_importexport) + { + dol_syslog("max_execution_time=".$max_time." is lower than max_execution_time_for_importexport=".$max_execution_time_for_importexport.". We try to increase it dynamically."); + @ini_set("max_execution_time", $max_execution_time_for_importexport); // This work only if safe mode is off. also web servers has timeout of 300 + } + $model = $format; $liste = $objmodelimport->liste_modeles($db); @@ -1518,14 +1526,6 @@ if ($step == 5 && $datatoimport) } print ''; } else { - $max_execution_time_for_importexport = (empty($conf->global->IMPORT_MAX_EXECUTION_TIME) ? 300 : $conf->global->IMPORT_MAX_EXECUTION_TIME); // 5mn if not defined - $max_time = @ini_get("max_execution_time"); - if ($max_time && $max_time < $max_execution_time_for_importexport) - { - dol_syslog("max_execution_time=".$max_time." is lower than max_execution_time_for_importexport=".$max_execution_time_for_importexport.". We try to increase it dynamically."); - @ini_set("max_execution_time", $max_execution_time_for_importexport); // This work only if safe mode is off. also web servers has timeout of 300 - } - // Launch import $arrayoferrors = array(); $arrayofwarnings = array(); @@ -1603,8 +1603,10 @@ if ($step == 5 && $datatoimport) // Show OK if (!count($arrayoferrors) && !count($arrayofwarnings)) { print '
'.img_picto($langs->trans("OK"), 'tick').' '.$langs->trans("NoError").'


'; + print '
'; print $langs->trans("NbInsert", $obj->nbinsert).'
'; print $langs->trans("NbUpdate", $obj->nbupdate).'

'; + print '
'; } else print $langs->trans("NbOfLinesOK", $nbok).'

'; // Show Errors @@ -1692,9 +1694,17 @@ if ($step == 5 && $datatoimport) // STEP 6: Real import if ($step == 6 && $datatoimport) { + $max_execution_time_for_importexport = (empty($conf->global->IMPORT_MAX_EXECUTION_TIME) ? 300 : $conf->global->IMPORT_MAX_EXECUTION_TIME); // 5mn if not defined + $max_time = @ini_get("max_execution_time"); + if ($max_time && $max_time < $max_execution_time_for_importexport) + { + dol_syslog("max_execution_time=".$max_time." is lower than max_execution_time_for_importexport=".$max_execution_time_for_importexport.". We try to increase it dynamically."); + @ini_set("max_execution_time", $max_execution_time_for_importexport); // This work only if safe mode is off. also web servers has timeout of 300 + } + $model = $format; $liste = $objmodelimport->liste_modeles($db); - $importid = $_REQUEST["importid"]; + $importid = GETPOST("importid", 'alphanohtml'); // Create classe to use for import @@ -1970,12 +1980,14 @@ if ($step == 6 && $datatoimport) // Show result print '
'; - print '
'; + print '
'; print $langs->trans("NbOfLinesImported", $nbok).'
'; print $langs->trans("NbInsert", $obj->nbinsert).'
'; print $langs->trans("NbUpdate", $obj->nbupdate).'

'; + print '
'; + print '
'; print $langs->trans("FileWasImported", $importid).'
'; - print $langs->trans("YouCanUseImportIdToFindRecord", $importid).'
'; + print ''.$langs->trans("YouCanUseImportIdToFindRecord", $importid).'
'; print '
'; }