From f6bec8f04894a08641665d662ad0e5ea1ba80307 Mon Sep 17 00:00:00 2001 From: Sascha Schmidt <s.schmidt@adito.de> Date: Wed, 20 Oct 2021 15:15:14 +0200 Subject: [PATCH] =?UTF-8?q?[Projekt:=20xRM-ContactManagement][TicketNr.:?= =?UTF-8?q?=202001172][Importer:=20iComm=20wurde=20nicht=20komplett=20auf?= =?UTF-8?q?=20ObjectType,=20ObjectRowid=20umgestellt=20und=20legt=20ung?= =?UTF-8?q?=C3=BCltige=20Daten=20an]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../documentation.adoc | 4 +- .../ImporterMappingFunctions_lib/process.js | 50 +++++++++++++++---- process/Importer_test/process.js | 2 +- 3 files changed, 45 insertions(+), 11 deletions(-) diff --git a/process/ImporterMappingFunctions_lib/documentation.adoc b/process/ImporterMappingFunctions_lib/documentation.adoc index a84498b944..512eac55c6 100644 --- a/process/ImporterMappingFunctions_lib/documentation.adoc +++ b/process/ImporterMappingFunctions_lib/documentation.adoc @@ -180,7 +180,9 @@ Properties for iComm |Address | The address for the communication entry. |Medium | The medium ID. (It can also be a flexible value like "{2}" or "{TEMP.MED}"). -|ContactID | The ID of the entry in the contact table. +|ContactID | The ID of the entry in the contact table. @deprecated It should be used ObjectRowid and ObjectType +|ObjectRowid | The UID of the entry from a context. +|ObjectType | The type of the entry from a context. |Standard (opt.)| If this address should be set to standard (boolean). |====== diff --git a/process/ImporterMappingFunctions_lib/process.js b/process/ImporterMappingFunctions_lib/process.js index 97f5f2f5fa..0d00cb8f1b 100644 --- a/process/ImporterMappingFunctions_lib/process.js +++ b/process/ImporterMappingFunctions_lib/process.js @@ -474,7 +474,9 @@ function iKeywordAttribute (pObject) * Values of the mapping line: * Address req -- the address for the communication entry * Medium req -- the medium id - * ContactID req -- the id of the entry in the contact table + * ContactID req -- the id of the entry in the contact table @deprecated It should be used ObjectRowid and ObjectType + * ObjectRowid req -- the UID of the entry from a context. + * ObjectType req -- the type of the entry from a context. * Standard opt -- the standard value (boolean) * * @name iComm @@ -485,23 +487,53 @@ function iKeywordAttribute (pObject) function iComm (pObject) { if (!this.doIfCheck(pObject)) + { return true; + } + var address = this.InputRecord[pObject.Address]; var medium = this.InputRecord[pObject.Medium]; - var contact = this.InputRecord[pObject.ContactID]; + var objectRowId = this.InputRecord[pObject.ObjectRowid]; + var objectType = this.InputRecord[pObject.ObjectType]; var standard = "0"; + //@deprecated It should be used ObjectRowid and ObjectType + var contactId = this.InputRecord[pObject.ContactID]; + if (address == undefined) + { address = this.resolveSymbol(pObject, pObject.Address); + } if (medium == undefined) + { medium = this.resolveSymbol(pObject, pObject.Medium); - if (contact == undefined) - contact = this.resolveSymbol(pObject, pObject.ContactID); + } + if (objectRowId == undefined) + { + objectRowId = this.resolveSymbol(pObject, pObject.ObjectRowid); + } + if (objectType == undefined) + { + objectType = this.resolveSymbol(pObject, pObject.ObjectType); + } + //@deprecated It should be used ObjectRowid and ObjectType + if (contactId == undefined) + { + contactId = this.resolveSymbol(pObject, pObject.ContactID); + } if (pObject.Standard) + { standard = "1"; + } - if (!address || !medium || !contact) + if (!address || !medium || !objectRowId) + { return true; + } + + //@deprecated It should be used ObjectRowid and ObjectType + objectRowId = objectRowId || contactId; + objectType = objectType || "Contact"; const COMMUNICATION = this.getTableCase("communication"); const COMMUNICATIONID = this.getColumnCase("communicationid"); @@ -523,8 +555,8 @@ function iComm (pObject) var sql = new SqlBuilder(this.Config.AliasTo) .select([COMMUNICATIONID, ADDR, MEDIUM_ID, ISSTANDARD]) .from(COMMUNICATION) - .where(COMMUNICATION + "." + OBJECT_ROWID, contact) - .and(COMMUNICATION + "." + OBJECT_TYPE, "Contact") + .where(COMMUNICATION + "." + OBJECT_ROWID, objectRowId) + .and(COMMUNICATION + "." + OBJECT_TYPE, objectType) .and(COMMUNICATION + "." + MEDIUM_ID, CommUtil.getMediumIdsByCategory(mediumCategory), SqlBuilder.IN()); var existingData = sql.table(null, null, this.getConfiguredTimeout()); @@ -544,8 +576,8 @@ function iComm (pObject) if (!existingComm) { - var columns = [COMMUNICATIONID, ADDR, MEDIUM_ID, OBJECT_ROWID, ISSTANDARD]; - this.insertData(COMMUNICATION, columns, null, [util.getNewUUID(), address, medium, contact, standard], this.Config.AliasTo); + var columns = [COMMUNICATIONID, ADDR, MEDIUM_ID, OBJECT_ROWID, OBJECT_TYPE, ISSTANDARD]; + this.insertData(COMMUNICATION, columns, null, [util.getNewUUID(), address, medium, objectRowId, objectType, standard], this.Config.AliasTo); } else { diff --git a/process/Importer_test/process.js b/process/Importer_test/process.js index ae87faf6a2..e6f3b8e285 100644 --- a/process/Importer_test/process.js +++ b/process/Importer_test/process.js @@ -165,7 +165,7 @@ var testfunctions = { return this.fixtures; }.bind(this), ImportCommand: "insert+update", - Mapping: [[iComm, {Address: 0, Medium: 1, ContactID: 2}]] + Mapping: [[iComm, {Address: 0, Medium: 1, ObjectRowid: 2, ObjectType: 3}]] } return runFn(config); }, -- GitLab