From eaeadec61c033f0b4189981d356b60642f3e3a13 Mon Sep 17 00:00:00 2001
From: Simon Leipold <s.leipold@adito.de>
Date: Thu, 14 Nov 2019 12:27:44 +0100
Subject: [PATCH] #1046553 - Permissions: Kombination von zwei Rollen
 funktioniert nicht - fixed in person entity

---
 .../organisations/filterConditionProcess.js               | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/entity/Person_entity/recordcontainers/db/recordfieldmappings/organisations/filterConditionProcess.js b/entity/Person_entity/recordcontainers/db/recordfieldmappings/organisations/filterConditionProcess.js
index c1b50e3da94..b2c8e025af0 100644
--- a/entity/Person_entity/recordcontainers/db/recordfieldmappings/organisations/filterConditionProcess.js
+++ b/entity/Person_entity/recordcontainers/db/recordfieldmappings/organisations/filterConditionProcess.js
@@ -1,6 +1,10 @@
 import("system.vars");
 import("system.result");
 
-var from = "CONTACT join ORGANISATION on (ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID)";
+var sqlStr = "select PERSON_ID from CONTACT where ORGANISATION_ID in " +
+    " (select CONTACT.ORGANISATION_ID from CONTACT " +
+    " join ORGANISATION on (ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID) " +
+    " where PERSON_ID is null and " + vars.get("$local.condition") + ")" +
+    " and PERSON_ID is not null";
 
-result.string("PERSONID in (select CONTACT.PERSON_ID from " + from + " where " + vars.get("$local.condition")+ ")");
\ No newline at end of file
+result.string("PERSONID in (" + sqlStr + ")");
\ No newline at end of file
-- 
GitLab