diff --git a/process/Leadimport_lib/process.js b/process/Leadimport_lib/process.js index a32169803b3088ec95c3c67c1a0cc6ba446b1b91..1c28479c237c0fd89226a9fde7d16889d8307bcd 100644 --- a/process/Leadimport_lib/process.js +++ b/process/Leadimport_lib/process.js @@ -92,7 +92,7 @@ LeadImportUtils.loadImportFile = function(pBinId, pFieldSep, pFieldLimit, pRecor var insertTypes = db.getColumnTypes(insertTable, insertCols); var insertVals = []; - if(pUpdate == undefined) pUpdate = false; + if (pUpdate == undefined) pUpdate = false; if (pBinId) { @@ -101,9 +101,9 @@ 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)); - if(pNewFile != "true") + if (pNewFile != "true") { - if(pUpdate) { + if (pUpdate) { db.deleteData("IMPORTFIELD", newWhere("IMPORTFIELD.LEADIMPORT_ID", pLeadImportId).build()); } //insert the importfields @@ -169,7 +169,7 @@ LeadImportUtils.importData = function(pDataFields, pDataTypes, pFieldDef, pField orgContactId = orgRet[1]; orgsForDubCheck = orgRet[2]; - if(orgRet[3])//not a new organisation + if (orgRet[3])//not a new organisation { LeadImportUtils.insertAttr(pDataFields, pDataTypes, pFieldDef, LeadValues, orgContactId, orgObjID, pUser, pDate); LeadImportUtils.insertComm(pDataFields, pDataTypes, LeadValues, orgContactId, pUser, pDate); @@ -327,7 +327,7 @@ LeadImportUtils.getImportFieldDef = function(pID) { FieldDef[i] = new Array (ImportFieldDef[i][0], ImportFieldDef[i][1]) // TODO: this could be done using the Keyword Attributes instead of doing cracy substinging etc... - if(ImportFieldDef[i][1].substr(0, 9) == "ATTRIBUTE")//ATTRIBUTES are defined like ATTRIBUTE_Loyalty + if (ImportFieldDef[i][1].substr(0, 9) == "ATTRIBUTE")//ATTRIBUTES are defined like ATTRIBUTE_Loyalty { var attrName = ImportFieldDef[i][1].substr(10);// so cut the first 10 characters off to get the ATTRIBUTENAME "Loyalty" var attrdata = newSelect("AB_ATTRIBUTEID, ATTRIBUTE_TYPE") @@ -372,7 +372,7 @@ LeadImportUtils.insertAttr = function(pDataFields, pDataTypes, pFieldDef, pLeadV // Datenwerte setzen for (var i = 0; i < pFieldDef.length; i++) { - if(pFieldDef[i][1].substr(0, 9) == "ATTRIBUTE" && pFieldDef[i][2] != undefined)//if Attribute + if (pFieldDef[i][1].substr(0, 9) == "ATTRIBUTE" && pFieldDef[i][2] != undefined)//if Attribute { var attrdata = pFieldDef[i][2]; @@ -808,30 +808,30 @@ LeadImportUtils.scanLeadDups = function(pAllContactData) persObj = pAllContactData[pLeadID][0];//personData orgObj = pAllContactData[pLeadID][1];//organisationData - if(orgObj != undefined && Object.keys(orgObj).length > 0)//checks if there is an ORGANISATIONDUPLICATE + if (orgObj != undefined && Object.keys(orgObj).length > 0)//checks if there is an ORGANISATIONDUPLICATE { let scanResultsOrg = DuplicateScannerUtils.ScanForDuplicates("OrganisationDuplicates", "Organisation_entity", orgObj, null); - if(scanResultsOrg != null && scanResultsOrg.length > 0) + if (scanResultsOrg != null && scanResultsOrg.length > 0) { let insertCountOrg = DuplicateScannerUtils.CacheNewScanResults(orgObj["CONTACTID"], scanResultsOrg, "Organisation_entity"); dupOrg = true; } } - if(persObj != undefined && Object.keys(persObj).length > 0)//checks if there is an PERSONDUPLICATE + if (persObj != undefined && Object.keys(persObj).length > 0)//checks if there is an PERSONDUPLICATE { let scanResultsPers = DuplicateScannerUtils.ScanForDuplicates("PersonDuplicates", "Person_entity", persObj, null); - if(scanResultsPers != null && scanResultsPers.length > 0) + if (scanResultsPers != null && scanResultsPers.length > 0) { let insertCountPers = DuplicateScannerUtils.CacheNewScanResults(persObj["CONTACTID"], scanResultsPers, "Person_entity"); dupPers = true; } } - if(dupOrg && dupPers) + if (dupOrg && dupPers) dupStatus = "ORGPERSDUP";//organisation and person duplicate - else if(dupOrg) + else if (dupOrg) dupStatus = "ORGDUP";//organisation duplicate - else if(dupPers) + else if (dupPers) dupStatus = "PERSDUP";//person duplicate updDupVals = [dupStatus]; @@ -950,7 +950,7 @@ ContactInfoUtils.getContactDepartment = function(pLeadValues) for (let i = 0; i < department.length; i++) { - if(pLeadValues["DEPARTMENT"].trim() == department[i].trim()) + if (pLeadValues["DEPARTMENT"].trim() == department[i].trim()) return department[i]; } } @@ -972,7 +972,7 @@ ContactInfoUtils.getContactPosition = function(pLeadValues) for (let i = 0; i < position.length; i++) { - if(pLeadValues["CONTACTPOSITION"].trim() == position[i].trim()) + if (pLeadValues["CONTACTPOSITION"].trim() == position[i].trim()) return position[i]; } } @@ -994,7 +994,7 @@ ContactInfoUtils.getContactRole = function(pLeadValues) for (let i = 0; i < role.length; i++) { - if(pLeadValues["CONTACTROLE"].trim() == role[i].trim()) + if (pLeadValues["CONTACTROLE"].trim() == role[i].trim()) return role[i]; } } @@ -1016,7 +1016,7 @@ ContactInfoUtils.getGender = function(pLeadValues) for (let i = 0; i < gender.length; i++) { - if(pLeadValues["GENDER"].trim() == gender[i].trim()) + if (pLeadValues["GENDER"].trim() == gender[i].trim()) return gender[i]; } } @@ -1044,7 +1044,7 @@ ContactInfoUtils.getSalutation = function(pLeadValues, pIsoLanguage) for (let i = 0; i < salutation.length; i++) { - if(pLeadValues["SALUTATION"].trim() == salutation[i].trim()) + if (pLeadValues["SALUTATION"].trim() == salutation[i].trim()) return salutation[i]; } } @@ -1072,7 +1072,7 @@ ContactInfoUtils.getTitle = function(pLeadValues, pIsoLanguage) for (let i = 0; i < title.length; i++) { - if(pLeadValues["TITLE"].trim() == title[i].trim()) + if (pLeadValues["TITLE"].trim() == title[i].trim()) return title[i]; } }