Commit fdf8c10b authored by Elias Villiger's avatar Elias Villiger
Browse files

Feature #4922 - Excel import more stable

parent 6075fad6
Pipeline #876 passed with stage
in 1 minute and 50 seconds
......@@ -13,6 +13,7 @@ require_once(__DIR__ . '/store/Sip.php');
require_once(__DIR__ . '/Constants.php');
require_once(__DIR__ . '/Evaluate.php');
require_once(__DIR__ . '/helper/HelperFile.php');
require_once(__DIR__ . '/helper/OnArray.php');
//require_once(__DIR__ . '/../qfq/exceptions/UserException.php');
//require_once(__DIR__ . '/../qfq/exceptions/CodeException.php');
//require_once(__DIR__ . '/../qfq/exceptions/DbException.php');
......@@ -558,7 +559,7 @@ class Save {
return false;
}
if (isset($formElement[FE_IMPORT_TO_TABLE])) {
if (isset($formElement[FE_IMPORT_TO_TABLE]) && isset($statusUpload[FILES_TMP_NAME])) {
// Import
$tmpFile = Support::extendFilename($statusUpload[FILES_TMP_NAME], UPLOAD_CACHED);
$this->doImport($formElement, $tmpFile);
......@@ -634,13 +635,13 @@ class Save {
}
$tableName = $formElement[FE_IMPORT_TO_TABLE];
$regions = explode('|', $formElement[FE_IMPORT_REGION] ?? '');
$columnNames = explode(',', $formElement[FE_IMPORT_TO_COLUMNS]);
$regions = OnArray::trimArray(explode('|', $formElement[FE_IMPORT_REGION] ?? ''));
$columnNames = OnArray::trimArray(explode(',', $formElement[FE_IMPORT_TO_COLUMNS]));
$importMode = $formElement[FE_IMPORT_MODE] ?? FE_IMPORT_MODE_APPEND;
foreach ($regions as $region) {
// region: tab, startColumn, startRow, endColumn, endRow
$region = explode(',', $region);
$region = OnArray::trimArray(explode(',', $region));
$tab = 1;
if (!empty($region[0])) {
$tab = $region[0];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment