diff --git a/entity/Leadimport_entity/entityfields/bindata/valueProcess.js b/entity/Leadimport_entity/entityfields/bindata/valueProcess.js index b26be7ad4df799fc7479293b26d3c25c628b6efe..8ecb6ed51bb6ae52ab5efaf88702f575d1cd0857 100644 --- a/entity/Leadimport_entity/entityfields/bindata/valueProcess.js +++ b/entity/Leadimport_entity/entityfields/bindata/valueProcess.js @@ -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 diff --git a/entity/Leadimport_entity/recordcontainers/db/onDBInsert.js b/entity/Leadimport_entity/recordcontainers/db/onDBInsert.js index c64451acb8eb094e4fbbac23fdc4b2265c65b13f..ad5f344cc799f1a7ffd16953f3fbf1c4c2ea6438 100644 --- a/entity/Leadimport_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Leadimport_entity/recordcontainers/db/onDBInsert.js @@ -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 diff --git a/entity/Leadimport_entity/recordcontainers/db/onDBUpdate.js b/entity/Leadimport_entity/recordcontainers/db/onDBUpdate.js index 07d9801b3fda42f8bf2cf55245b8e466cfe2463a..481cabfc13853e6be912cac7b29c4831bf3fb116 100644 --- a/entity/Leadimport_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/Leadimport_entity/recordcontainers/db/onDBUpdate.js @@ -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); + } } } diff --git a/process/Leadimport_lib/process.js b/process/Leadimport_lib/process.js index f5a26ce830c78020f83d6f49043620bcf76fbfc0..6e77633b83e2ddc1b483201aab703cea758d8eca 100644 --- a/process/Leadimport_lib/process.js +++ b/process/Leadimport_lib/process.js @@ -637,7 +637,7 @@ LeadImportUtils.insertLeadAttr = function(pAttrObject, orgid, persid, pUser, pD .and("CONTACT.PERSON_ID is null") .cell(); - sqlInsertAttr(pAttrObject, AttrValues, pUser, pDate); + LeadImportUtils.sqlInsertAttr(pAttrObject, AttrValues, pUser, pDate); } // Attribute für the Person if (persid != "") @@ -650,7 +650,7 @@ LeadImportUtils.insertLeadAttr = function(pAttrObject, orgid, persid, pUser, pD .and("CONTACT.PERSON_ID", persid) .cell(); - sqlInsertAttr(pAttrObject, AttrValues, pUser, pDate); + LeadImportUtils.sqlInsertAttr(pAttrObject, AttrValues, pUser, pDate); } } } @@ -862,10 +862,16 @@ LeadImportUtils.checkOrgDup = function(pLeadValues) for (var i = 0; i < fields.length; i++) { - query.and(fields[i], pLeadValues[ fields[i].split(".")[1] ].replace(new RegExp("'", "g"),"''")); - query.and(fields[i] + " is not null"); + var fieldVal = pLeadValues[fields[i].split(".")[1]]; + if (fieldVal !== undefined) { + query.and(fields[i], fieldVal); + query.and(fields[i] + " is not null"); + } + else + { + query.and(fields[i] + " is null"); + } } - return query.arrayRow(); }