From bf9110bb51675eb5d2aa5e29a7fbbf1f26e61dc4 Mon Sep 17 00:00:00 2001
From: Sebastian Pongratz <s.pongratz@adito.de>
Date: Mon, 25 May 2020 11:55:37 +0000
Subject: [PATCH] #1057201 beziehungen bearbeiten

---
 .../recordcontainers/jdito/contentProcess.js             | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/entity/ObjectTree_entity/recordcontainers/jdito/contentProcess.js b/entity/ObjectTree_entity/recordcontainers/jdito/contentProcess.js
index fa1caa6ca2..55ac5773b3 100644
--- a/entity/ObjectTree_entity/recordcontainers/jdito/contentProcess.js
+++ b/entity/ObjectTree_entity/recordcontainers/jdito/contentProcess.js
@@ -2,6 +2,7 @@ import("system.db");
 import("system.translate");
 import("system.result");
 import("system.vars");
+import("system.neon");
 import("ObjectRelation_lib");
 import("Context_lib");
 import("Sql_lib");
@@ -238,9 +239,15 @@ function _getEntryData(pObjectId, pDirection, pRelationType1, pRelationType2, pP
     onConditionForRelationTypeJoin = newWhere("AB_OBJECTRELATIONTYPEID = AB_OBJECTRELATIONTYPE" + myNum)
         .and("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE1", pRelationType1)
         .and("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE2", pRelationType2)
-        .and("AB_OBJECTRELATION.OBJECT" + myNum + "_ROWID", pObjectId)
         .andIfSet("AB_OBJECTRELATION.AB_OBJECTRELATIONID", pObjectRelationId || null); // set id to null, as only null works with .andIfSet
     
+    // wird benoetigt zum Bearbeiten 
+    if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT)
+        onConditionForRelationTypeJoin.and("AB_OBJECTRELATION.OBJECT" + otherNum + "_ROWID", pObjectId);
+    else
+        onConditionForRelationTypeJoin.and("AB_OBJECTRELATION.OBJECT" + myNum + "_ROWID", pObjectId);
+    
+    
     // exclude previous node
     if (!pPrevId)
         onConditionForRelationTypeJoin.and("AB_OBJECTRELATION.OBJECT" + otherNum + "_ROWID is not null");
-- 
GitLab