From 2efa78d23508dacb352d870c8f2d08fc4833ba98 Mon Sep 17 00:00:00 2001
From: Simon Leipold <s.leipold@adito.de>
Date: Fri, 10 Jan 2020 13:14:19 +0100
Subject: [PATCH] [Projekt: Entwicklung - Neon][TicketNr.: 1048147][Neuanlage
 von Rollen]

---
 entity/Role_entity/Role_entity.aod            |  1 +
 .../entityfields/uid/valueProcess.js          |  4 +++
 .../recordcontainers/jdito/contentProcess.js  | 25 ++++++++-----------
 3 files changed, 16 insertions(+), 14 deletions(-)
 create mode 100644 entity/Role_entity/entityfields/uid/valueProcess.js

diff --git a/entity/Role_entity/Role_entity.aod b/entity/Role_entity/Role_entity.aod
index d7ab4438873..39f6b5e727e 100644
--- a/entity/Role_entity/Role_entity.aod
+++ b/entity/Role_entity/Role_entity.aod
@@ -121,6 +121,7 @@
     </entityField>
     <entityField>
       <name>UID</name>
+      <valueProcess>%aditoprj%/entity/Role_entity/entityfields/uid/valueProcess.js</valueProcess>
     </entityField>
     <entityConsumer>
       <name>RoleChildrens</name>
diff --git a/entity/Role_entity/entityfields/uid/valueProcess.js b/entity/Role_entity/entityfields/uid/valueProcess.js
new file mode 100644
index 00000000000..4a9b27cc967
--- /dev/null
+++ b/entity/Role_entity/entityfields/uid/valueProcess.js
@@ -0,0 +1,4 @@
+import("system.vars");
+import("system.result");
+
+result.string("CUSTOM_" + vars.get("$field.ROLENAME"));
\ No newline at end of file
diff --git a/entity/Role_entity/recordcontainers/jdito/contentProcess.js b/entity/Role_entity/recordcontainers/jdito/contentProcess.js
index 0c6c46b70b1..9ebefcd2429 100644
--- a/entity/Role_entity/recordcontainers/jdito/contentProcess.js
+++ b/entity/Role_entity/recordcontainers/jdito/contentProcess.js
@@ -2,15 +2,17 @@ import("system.translate");
 import("system.vars");
 import("system.result");
 import("system.tools");
- 
+
+var res = []; 
+
 var lang = vars.get("$sys.clientlanguage");//e.g. "de"
 var country = vars.get("$sys.clientcountry");//e.g. "DE"
-locale =  country ? lang + "_" + country : lang;
+var locale =  country ? lang + "_" + country : lang;
+
 var selectedRole = vars.get("$local.idvalues");
 var allRoles = tools.getAllRoles();
-var res = [];
-
 var excludeRoles = {};
+
 if (vars.exists("$param.ExcludeRoles_param") && vars.get("$param.ExcludeRoles_param"))
 {
     JSON.parse(vars.getString("$param.ExcludeRoles_param")).forEach(function (e)
@@ -27,16 +29,11 @@ for each (let role in allRoles) {
     }
 }
 
-var ids = vars.get("$local.idvalues");
-if (ids != null)
-{
-    res = res.filter(function(resEntry) 
-    {
-        for (let i = 0; i < ids.length; i++)
-        {
-            if (resEntry[0] == ids[i])
-                return true;
-        }
+if (selectedRole != null) {
+    res = res.filter(function(resEntry) {
+        if (resEntry[0] == selectedRole) 
+            return true;
+        
         return false;
     });
 }
-- 
GitLab