From b4ef5e071ba538a5095c51ded14ba4e7dd48964c Mon Sep 17 00:00:00 2001
From: Benjamin Ulrich <b.ulrich@adito.de>
Date: Tue, 18 Feb 2020 10:23:49 +0100
Subject: [PATCH] =?UTF-8?q?[Projekt:=20Entwicklung=20-=20Neon][TicketNr.:?=
 =?UTF-8?q?=201052262][Firmen=20und=20Personen=20k=C3=B6nnen=20nicht=20gel?=
 =?UTF-8?q?=C3=B6scht=20werden]=20[Projekt:=20Entwicklung=20-=20Neon][Tick?=
 =?UTF-8?q?etNr.:=201048420][Dublette/=20Kontakt:=20Fehlermeldung=20bei=20?=
 =?UTF-8?q?Integriere=20ausgew=C3=A4hlten=20in=20aktuellen=20Datensatz]?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../onActionProcess.js                         | 18 +++++++++---------
 process/Attribute_lib/process.js               |  2 ++
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/entity/Person_entity/entityfields/duplicateactions/children/integrateselectedintocurrentaction/onActionProcess.js b/entity/Person_entity/entityfields/duplicateactions/children/integrateselectedintocurrentaction/onActionProcess.js
index 851ada0af36..651c632fb29 100644
--- a/entity/Person_entity/entityfields/duplicateactions/children/integrateselectedintocurrentaction/onActionProcess.js
+++ b/entity/Person_entity/entityfields/duplicateactions/children/integrateselectedintocurrentaction/onActionProcess.js
@@ -2,24 +2,24 @@ import("system.db");
 import("Employee_lib");
 import("KeywordRegistry_basic");
 import("ActivityTask_lib");
-import("system.logging");
 import("system.vars");
 import("system.neon");
 import("DuplicateScanner_lib");
 
-let targetContactId = vars.get("$param.DuplicateCurrentContactId_param");
-let sourceContactId = vars.get("$sys.selection");
-logging.log("targetContactId -> " + targetContactId);
-logging.log("sourceContactId -> "+ sourceContactId);
+var targetContactId = vars.get("$param.DuplicateCurrentContactId_param");
+var sourceContactIdArray = vars.get("$sys.selection");
+var sourceContactId = sourceContactIdArray[0];
+
 //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);
+var mergeSuccess = DuplicateScannerUtils.MergePerson(sourceContactId, targetContactId);
 
 if(mergeSuccess)
 {
-    let currentContactId = EmployeeUtils.getCurrentContactId();
+    var currentContactId = EmployeeUtils.getCurrentContactId();
     if(currentContactId == null)
         currentContactId = "";
     DuplicateScannerUtils.CreateMergeSuccessActivity(sourceContactId, targetContactId, currentContactId, "Person");
-
-    neon.refreshAll();
+// openContext due to the fact, that openContext will lead to an error 'due'cause it's trying to load the already opened preview 
+// of the duplicateContact which just got deleted = nullpointException
+    neon.openContext("Person", null, [targetContactId], neon.OPERATINGSTATE_VIEW, null, null);
 }
\ No newline at end of file
diff --git a/process/Attribute_lib/process.js b/process/Attribute_lib/process.js
index 9c2bd2c0a44..a1e47d57583 100644
--- a/process/Attribute_lib/process.js
+++ b/process/Attribute_lib/process.js
@@ -468,6 +468,8 @@ AttributeRelationUtils.selectAttributeValue = function (pAttributeId, pValueMap,
     type[0] = type[0].trim();
     var field = AttributeTypeUtil.getDatabaseField(type[0]);
     var value = pValueMap[field];
+    if(value == undefined)
+        return "";
     if (pGetViewValue && type[0] == $AttributeTypes.COMBO)
     {
         value = newSelect("ATTRIBUTE_NAME")
-- 
GitLab