From 7a8860e8abdd3c0728ab7920c3f619bf773b3c0b Mon Sep 17 00:00:00 2001
From: Johannes Hoermann <j.hoermann@adito.de>
Date: Thu, 10 Oct 2019 13:56:24 +0200
Subject: [PATCH] fix object relation

---
 process/ObjectRelation_lib/process.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/process/ObjectRelation_lib/process.js b/process/ObjectRelation_lib/process.js
index badb2f5ff0..330272e687 100644
--- a/process/ObjectRelation_lib/process.js
+++ b/process/ObjectRelation_lib/process.js
@@ -81,7 +81,8 @@ ObjectRelationUtils.getPossibleRelationTypes = function(pObjectTypes, pFullInfo,
              else 'reverse'\n\
         end direction,\n\
         main.HIERARCHY, \n\
-        type2.OBJECT_TYPE destObjectType, \n\
+        ( case when type2.AB_OBJECTRELATIONTYPEID is null then main.OBJECT_TYPE " + // if type is 'same' (type2.AB_OBJECTRELATIONTYPEID is null) then use the same object type for dest as for source
+        "    else type2.OBJECT_TYPE end ) destObjectType, \n\
         main.OBJECT_TYPE sourceObjectType, \n\
         -- typeId of Object2\n\
         case when main.SIDE = 1 then main.AB_OBJECTRELATIONTYPEID\n\
-- 
GitLab