From 7a12e83cb82f93a5e9bb07735c87427f400d71ec Mon Sep 17 00:00:00 2001
From: "d.buechler" <d.buechler@adito.de>
Date: Wed, 14 Aug 2019 11:22:40 +0200
Subject: [PATCH] Update/Delete Anweisungen wurden falsch kombiniert

---
 .../integrateselectedintocurrentaction/onActionProcess.js | 4 +++-
 process/DuplicateScanner_lib/process.js                   | 8 ++++----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/entity/Person_entity/entityfields/duplicateactions/children/integrateselectedintocurrentaction/onActionProcess.js b/entity/Person_entity/entityfields/duplicateactions/children/integrateselectedintocurrentaction/onActionProcess.js
index c11899143d..ca0b259195 100644
--- a/entity/Person_entity/entityfields/duplicateactions/children/integrateselectedintocurrentaction/onActionProcess.js
+++ b/entity/Person_entity/entityfields/duplicateactions/children/integrateselectedintocurrentaction/onActionProcess.js
@@ -1,10 +1,12 @@
+import("system.logging");
 import("system.vars");
 import("system.neon");
 import("DuplicateScanner_lib");
 
 let targetContactId = vars.get("$field.CONTACTID");
 let sourceContactId = vars.get("$sys.selection");
-
+logging.log("targetContactId -> " + targetContactId);
+logging.log("sourceContactId -> "+ sourceContactId);
 //todo the actual merge ought to happen in a separate view where the contact infos can be merged manually by the user.
 let mergeSuccess = DuplicateScannerUtils.MergePerson(sourceContactId, targetContactId);
 
diff --git a/process/DuplicateScanner_lib/process.js b/process/DuplicateScanner_lib/process.js
index bda26e666f..a17329adff 100644
--- a/process/DuplicateScanner_lib/process.js
+++ b/process/DuplicateScanner_lib/process.js
@@ -183,13 +183,13 @@ DuplicateScannerUtils.MergePerson = function(pSourceContactId, pTargetContactId)
     var sourcePersonId = db.cell("select PERSON_ID from CONTACT where CONTACTID = '" + pSourceContactId + "'");
     var tableInfos = _DuplicateScannerUtils._getMergeUpdateTableInfos();
     
-    updateStatements.push(_DuplicateScannerUtils._buildUpdateContactIdStatements(tableInfos, pSourceContactId, pTargetContactId));
-    updateStatements.push(_DuplicateScannerUtils._buildUpdateAttachParticipantsToNewContactQuery("CAMPAIGNPARTICIPANT", "CONTACT_ID", "CAMPAIGN_ID", pSourceContactId, pTargetContactId));
+    updateStatements.concat(_DuplicateScannerUtils._buildUpdateContactIdStatements(tableInfos, pSourceContactId, pTargetContactId));
+    updateStatements.concat(_DuplicateScannerUtils._buildUpdateAttachParticipantsToNewContactQuery("CAMPAIGNPARTICIPANT", "CONTACT_ID", "CAMPAIGN_ID", pSourceContactId, pTargetContactId));
     
-    deleteStatements.push(_DuplicateScannerUtils._buildDeleteRemoveObsoleteParticipantsRecordsQuery("CAMPAIGNPARTICIPANT", "CONTACT_ID", "CAMPAIGN_ID", pSourceContactId, pTargetContactId));
+    deleteStatements.concat(_DuplicateScannerUtils._buildDeleteRemoveObsoleteParticipantsRecordsQuery("CAMPAIGNPARTICIPANT", "CONTACT_ID", "CAMPAIGN_ID", pSourceContactId, pTargetContactId));
     deleteStatements = deleteStatements.concat(_DuplicateScannerUtils._buildDeletePersonAndContactQuery(sourcePersonId, pSourceContactId));
 
-    logging.log("updateStatements -> " + JSON.stringify(updateStatements));
+    //logging.log("updateStatements -> " + JSON.stringify(updateStatements));
     logging.log("deleteStatements -> " + JSON.stringify(deleteStatements));
     //let affectedRows = db.updates(updateStatements);
     //let deletedRows = db.deletes(deleteStatements)
-- 
GitLab