From d9d2c1ad3a28de04733fe194726dc5e2411693da Mon Sep 17 00:00:00 2001
From: Johannes Hoermann <j.hoermann@adito.de>
Date: Wed, 21 Aug 2019 09:33:43 +0200
Subject: [PATCH] fix salesproject phase stepper

---
 .../recordcontainers/jdito/contentProcess.js  | 20 +++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/entity/SalesprojectPhase_entity/recordcontainers/jdito/contentProcess.js b/entity/SalesprojectPhase_entity/recordcontainers/jdito/contentProcess.js
index 686167534b..a961d29c05 100644
--- a/entity/SalesprojectPhase_entity/recordcontainers/jdito/contentProcess.js
+++ b/entity/SalesprojectPhase_entity/recordcontainers/jdito/contentProcess.js
@@ -6,19 +6,31 @@ import("system.result");
 import("system.vars");
 
 var steps = KeywordUtils.getEntryNamesAndIdsByContainer($KeywordRegistry.salesprojectPhase());
-var selection = vars.get("$sys.selection");
+var ids = vars.get("$local.idvalues");
 var selected = vars.exists("$param.CurrentPhase_param") && vars.get("$param.CurrentPhase_param");
 
+// filter only for steps reqested by the system
+if (ids)
+{
+    steps = steps.filter(function(pStep) 
+    {
+        for (let i = 0; i < ids.length; i++) 
+        {
+            if (ids[i] == pStep[0])
+                return true
+        }
+        return false
+    })
+}
 
 var res = [];
 steps.forEach(function ([stepId, title])
 {
-    if (selection.length > 0)
-        res.push([stepId, selection.indexOf(stepId) > -1  ? "ACTIVE" : "EDITABLE", title, _getIcon(stepId)]);
+    if (ids)
+        res.push([stepId, ids.indexOf(stepId) > -1  ? "ACTIVE" : "EDITABLE", title, _getIcon(stepId)]);
     else
         res.push([stepId, stepId === selected ? "ACTIVE" : "EDITABLE", title, _getIcon(stepId)]);
 });
-
 result.object(res);
 
 function _getIcon (pPhase)
-- 
GitLab