Skip to content
Snippets Groups Projects
Commit 94182a7c authored by Johannes Hörmann's avatar Johannes Hörmann
Browse files

lead import bugfix: file upload

parent 6c8c4f22
No related branches found
No related tags found
No related merge requests found
......@@ -15,6 +15,7 @@ if (vars.get("$sys.recordstate") && vars.get("$sys.recordstate") != neon.OPERATI
// --> this is a marking that the field didn't change
result.string("FILE NOT CHANGED");
} else {
// "FILE MISSING" indicates that no file was uploaded. It is needed becaust the mandatory doesn't work correctly. So as work around we allow to not upload a file.
result.string("FILE MISSING");
}
}
\ No newline at end of file
......@@ -21,6 +21,6 @@ if(bindata != '' && filename != '')
if (mimeType == "application/vnd.ms-excel")
{
var documentId = SingleBinaryUtils.insertMainDocument("LEADIMPORT", "IMPORTFILE", assignmentRowId, bindata, filename, "", SqlUtils.getBinariesAlias());
LeadImportUtils.loadImportFile(documentId, fieldSep, fieldLimit, recordSep, assignmentRowId);
LeadImportUtils.loadImportFile(documentId, fieldSep, fieldLimit, recordSep, assignmentRowId, false, true);
}
}
\ No newline at end of file
......@@ -25,11 +25,17 @@ if (vars.get("$field.bindata") != "FILE NOT CHANGED")
var mimeType = DocumentUtil.getMimeTypeFromUpload(vars.get("$field.bindata"));
if (mimeType == "application/vnd.ms-excel")
{
var binMetadata = db.getBinaryMetadata("LEADIMPORT", "IMPORTFILE", assignmentRowId, false, SqlUtils.getBinariesAlias(), "");
if (binMetadata.length > 0) {
db.updateBinary(binMetadata[0].id, "", bindata, filename, "", "MAINDOCUMENT", SqlUtils.getBinariesAlias());
LeadImportUtils.loadImportFile(binMetadata[0].id, fieldSep, fieldLimit, recordSep, assignmentRowId, true, true);
}
else
{
var documentId = SingleBinaryUtils.insertMainDocument("LEADIMPORT", "IMPORTFILE", assignmentRowId, bindata, filename, "", SqlUtils.getBinariesAlias());
LeadImportUtils.loadImportFile(documentId, fieldSep, fieldLimit, recordSep, assignmentRowId, false, true);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment