From e0b5ff426789e97ef4bdce188dc08966ad9514ed Mon Sep 17 00:00:00 2001 From: "s.pongratz" <s.pongratz@adito.de> Date: Thu, 6 Aug 2020 11:55:44 +0200 Subject: [PATCH] #1063252-Eigenschaften_leer --- process/Leadimport_lib/process.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/process/Leadimport_lib/process.js b/process/Leadimport_lib/process.js index 9e8c67db43..e5ee4080fb 100644 --- a/process/Leadimport_lib/process.js +++ b/process/Leadimport_lib/process.js @@ -381,8 +381,14 @@ LeadImportUtils.insertAttr = function(pDataFields, pDataTypes, pFieldDef, pLeadV if (pFieldDef[i][1].substr(0, 9) == "ATTRIBUTE" && pFieldDef[i][2] != undefined)//if Attribute { var attrdata = pFieldDef[i][2]; + + let countAttributes = newSelect("count(*)") + .from("AB_ATTRIBUTERELATION") + .where("AB_ATTRIBUTERELATION.OBJECT_ROWID", pContactId) + .and("AB_ATTRIBUTERELATION.AB_ATTRIBUTE_ID", attrdata[1][0]) + .cell(); - if (attrdata[2][pObjectID] != undefined)//e. g. if attrdata[2]["Organisation"] != undefined + if (attrdata[2][pObjectID] != undefined && countAttributes == 0)//e. g. if attrdata[2]["Organisation"] != undefined { var DataValues = new Object(); var value = pLeadValues[pFieldDef[i][1]]; @@ -694,7 +700,15 @@ LeadImportUtils.sqlInsertAttr = function(pAttrObject, pAttrValues, pUser, pDate) pAttrValues[9] = pUser; pAttrValues[10] = pDate; - db.insertData("AB_ATTRIBUTERELATION", pAttrObject["Fields"] , pAttrObject["Types"], pAttrValues); + let countAttributes = newSelect("count(*)") + .from("AB_ATTRIBUTERELATION") + .where("AB_ATTRIBUTERELATION.OBJECT_ROWID", AttrValues[7]) + .and("AB_ATTRIBUTERELATION.AB_ATTRIBUTE_ID", attrdata[1][0]) + .cell(); + if (countAttributes == 0) { + db.insertData("AB_ATTRIBUTERELATION", pAttrObject["Fields"] , pAttrObject["Types"], pAttrValues); + } + } /** -- GitLab