diff --git a/entity/Document_entity/entityfields/downloadsinglefileaction/onActionProcess.js b/entity/Document_entity/entityfields/downloadsinglefileaction/onActionProcess.js index cb680339a304a772903d66b521a97809f90288f2..6fb7d7cd93ae311e233e542bc38778dc559e7882 100644 --- a/entity/Document_entity/entityfields/downloadsinglefileaction/onActionProcess.js +++ b/entity/Document_entity/entityfields/downloadsinglefileaction/onActionProcess.js @@ -1,2 +1,4 @@ +import("system.vars"); import("Document_lib"); -DocumentUtil.downloadSelectedDocuments(); + +DocumentUtil.downloadSelectedDocuments(vars.get("$param.AssignmentName_param")); diff --git a/entity/Leadimport_entity/recordcontainers/db/onDBInsert.js b/entity/Leadimport_entity/recordcontainers/db/onDBInsert.js index 1a9be3005379dd4286a0b861ed91c1ba374f189b..1f82f62e8044dcf276f7546ee8c3eb4c78dd4725 100644 --- a/entity/Leadimport_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Leadimport_entity/recordcontainers/db/onDBInsert.js @@ -19,7 +19,8 @@ var recordSep = ExportTemplateUtils.getSentenceSeparator(vars.get("$field.SENTEN if(bindata != '' && filename != '') { var mimeType = DocumentUtil.getMimeTypeFromUpload(vars.get("$field.bindata")); - if (mimeType == "application/vnd.ms-excel" || mimeType == "text/csv") + if (mimeType == "application/vnd.ms-excel" || mimeType == "text/csv" + || mimeType == "text/plain") //ToDo: remove this one, as soon as csv's get their correct mimetype #1057287 { var documentId = SingleBinaryUtils.insertMainDocument("LEADIMPORT", "IMPORTFILE", assignmentRowId, bindata, filename, "", SqlUtils.getBinariesAlias()); LeadImportUtils.loadImportFile(documentId, fieldSep, fieldLimit, recordSep, assignmentRowId, false, true); diff --git a/process/Document_lib/process.js b/process/Document_lib/process.js index 1fc5466aa2751bc671c6fdc20da3b1e025ec807a..6085c3f5eec1ff9f9c1954bfd29b490188c27751 100644 --- a/process/Document_lib/process.js +++ b/process/Document_lib/process.js @@ -19,23 +19,27 @@ function DocumentUtil(){ * Utility function to download all selected documents. * Selected documents will be checked with $sys.selectionRows * Documents will be downloaded with neon.download + * @param {String} pAssignmentName (optional) the name of the assignment, used to modify the filename + * */ -DocumentUtil.downloadSelectedDocuments = function() { +DocumentUtil.downloadSelectedDocuments = function(pAssignmentName) { var alias = SqlUtils.getBinariesAlias(); if(vars.exists("$sys.selectionRows") && vars.getString("$sys.selectionRows")) { var rows = vars.get("$sys.selectionRows"); var uids = vars.get("$sys.selection"); var binaryContents = db.getBinaryContents(uids, alias); - + // check if multiplie Files are selected. // files get packed into a zip archive before downloading if(binaryContents.length > 1) { var fileNames = rows.map(function(value) { return value["NAME"]; }); neon.downloadToZip(translate.text("Files") + ".zip", binaryContents, fileNames); - } else { - neon.download(binaryContents[0], rows[0]["NAME"]); } + else if(pAssignmentName == "ERRORLOG") + neon.download(binaryContents[0], rows[0]["NAME"] + ".txt"); + else + neon.download(binaryContents[0], rows[0]["NAME"]); } } diff --git a/process/Leadimport_lib/process.js b/process/Leadimport_lib/process.js index 282dfc8408152e9c99969a0b300e215229ef5dc3..12ee0883e8b9d49b2556cbf740a459580afaf2b3 100644 --- a/process/Leadimport_lib/process.js +++ b/process/Leadimport_lib/process.js @@ -1,3 +1,4 @@ +import("ExportTemplate_lib"); import("system.workflow"); import("system.project"); import("Util_lib"); @@ -93,6 +94,10 @@ LeadImportUtils.loadImportFile = function(pBinId, pFieldSep, pFieldLimit, pRecor var insertCols = ["IMPORTFIELDID", "FIELDNAME", "LEADIMPORT_ID", "DATE_NEW", "USER_NEW", "FIELDNUMBER"]; var insertTypes = db.getColumnTypes(insertTable, insertCols); var insertVals = []; + var sentenceSeparator = ExportTemplateUtils.getSentenceSeparator(pRecordSep); + var fieldSeparator = ExportTemplateUtils.getFieldSeparator(pFieldSep); + var fieldDeLimiter = ExportTemplateUtils.getFieldDeLimiter(pFieldLimit); + if (pUpdate == undefined) pUpdate = false; @@ -102,7 +107,7 @@ LeadImportUtils.loadImportFile = function(pBinId, pFieldSep, pFieldLimit, pRecor { var data = db.getBinaryContent(pBinId, SqlUtils.getBinariesAlias()); data = util.decodeBase64String(data, "UTF-8"); - var table = text.parseCSV(data.replace(/(^\s+)|(\s+$)/g,""), pRecordSep, pFieldSep, pFieldLimit.charAt(0)); + var table = text.parseCSV(data.replace(/(^\s+)|(\s+$)/g,""), sentenceSeparator, fieldSeparator, fieldDeLimiter); if (pNewFile) { if (pUpdate) {