From d43321c69e72dfcc16642f9a09a99a1cb2658e81 Mon Sep 17 00:00:00 2001
From: Johannes Hoermann <j.hoermann@adito.de>
Date: Fri, 23 Aug 2019 10:35:20 +0200
Subject: [PATCH] uncomment grantDeletes fro Performance in filterView (until
 Bugfix is provided)

---
 entity/Activity_entity/grantDeleteProcess.js     |  3 ++-
 entity/CampaignStep_entity/grantDeleteProcess.js |  6 +++---
 entity/Campaign_entity/grantDeleteProcess.js     |  8 ++++----
 entity/Contract_entity/grantDeleteProcess.js     |  8 ++++----
 entity/Employee_entity/grantDeleteProcess.js     |  4 ++--
 entity/Offer_entity/grantDeleteProcess.js        | 10 +++++-----
 entity/Organisation_entity/grantDeleteProcess.js |  8 ++++----
 entity/Person_entity/grantDeleteProcess.js       |  8 ++++----
 entity/Product_entity/grantDeleteProcess.js      |  6 +++---
 entity/Salesproject_entity/grantDeleteProcess.js |  8 ++++----
 entity/Task_entity/grantDeleteProcess.js         |  3 ++-
 11 files changed, 37 insertions(+), 35 deletions(-)

diff --git a/entity/Activity_entity/grantDeleteProcess.js b/entity/Activity_entity/grantDeleteProcess.js
index b8b033f79ad..1611440cc92 100644
--- a/entity/Activity_entity/grantDeleteProcess.js
+++ b/entity/Activity_entity/grantDeleteProcess.js
@@ -2,4 +2,5 @@ import("Document_lib");
 import("system.vars");
 import("system.result");
 
-result.string(!DocumentUtil.hasDocuments("ACTIVITY", null, vars.get("$field.ACTIVITYID")));
\ No newline at end of file
+// TODO: Commented because of performance problems: in Filter view this Process is called for every row. Waiting for bugfix
+//result.string(!DocumentUtil.hasDocuments("ACTIVITY", null, vars.get("$field.ACTIVITYID")));
diff --git a/entity/CampaignStep_entity/grantDeleteProcess.js b/entity/CampaignStep_entity/grantDeleteProcess.js
index c9a9ccc60bc..e10f390c21f 100644
--- a/entity/CampaignStep_entity/grantDeleteProcess.js
+++ b/entity/CampaignStep_entity/grantDeleteProcess.js
@@ -4,6 +4,6 @@ import("system.vars");
 import("ActivityTask_lib");
 import("system.result");
 
-if (vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_DATASET)
-    result.string(!TaskUtils.hasTasks(vars.get("$field.CAMPAIGNSTEPID"), ContextUtils.getCurrentContextId())
-        && !ActivityUtils.hasActivities(vars.get("$field.CAMPAIGNSTEPID"), ContextUtils.getCurrentContextId()));
\ No newline at end of file
+// TODO: Commented because of performance problems: in Filter view this Process is called for every row. Waiting for bugfix
+//result.string(!TaskUtils.hasTasks(vars.get("$field.CAMPAIGNSTEPID"), ContextUtils.getCurrentContextId())
+//    && !ActivityUtils.hasActivities(vars.get("$field.CAMPAIGNSTEPID"), ContextUtils.getCurrentContextId()));
diff --git a/entity/Campaign_entity/grantDeleteProcess.js b/entity/Campaign_entity/grantDeleteProcess.js
index dce63260564..1c14ed3fc37 100644
--- a/entity/Campaign_entity/grantDeleteProcess.js
+++ b/entity/Campaign_entity/grantDeleteProcess.js
@@ -5,7 +5,7 @@ import("Document_lib");
 import("system.vars");
 import("system.result");
 
-if (vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_DATASET)
-    result.string(!DocumentUtil.hasDocuments("CAMPAIGN", null, vars.get("$field.CAMPAIGNID"))
-        && !TaskUtils.hasTasks(vars.get("$field.CAMPAIGNID"), ContextUtils.getCurrentContextId())
-        && !ActivityUtils.hasActivities(vars.get("$field.CAMPAIGNID"), ContextUtils.getCurrentContextId()));
\ No newline at end of file
+// TODO: Commented because of performance problems: in Filter view this Process is called for every row. Waiting for bugfix
+//result.string(!DocumentUtil.hasDocuments("CAMPAIGN", null, vars.get("$field.CAMPAIGNID"))
+//    && !TaskUtils.hasTasks(vars.get("$field.CAMPAIGNID"), ContextUtils.getCurrentContextId())
+//    && !ActivityUtils.hasActivities(vars.get("$field.CAMPAIGNID"), ContextUtils.getCurrentContextId()));
\ No newline at end of file
diff --git a/entity/Contract_entity/grantDeleteProcess.js b/entity/Contract_entity/grantDeleteProcess.js
index 7c268463d68..551b9b070c7 100644
--- a/entity/Contract_entity/grantDeleteProcess.js
+++ b/entity/Contract_entity/grantDeleteProcess.js
@@ -5,7 +5,7 @@ import("Document_lib");
 import("system.vars");
 import("system.result");
 
-if (vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_DATASET)
-    result.string(!DocumentUtil.hasDocuments("CONTRACT", null, vars.get("$field.CONTRACTID"))
-        && !TaskUtils.hasTasks(vars.get("$field.CONTRACTID"), ContextUtils.getCurrentContextId())
-        && !ActivityUtils.hasActivities(vars.get("$field.CONTRACTID"), ContextUtils.getCurrentContextId()));
\ No newline at end of file
+// TODO: Commented because of performance problems: in Filter view this Process is called for every row. Waiting for bugfix
+//result.string(!DocumentUtil.hasDocuments("CONTRACT", null, vars.get("$field.CONTRACTID"))
+//    && !TaskUtils.hasTasks(vars.get("$field.CONTRACTID"), ContextUtils.getCurrentContextId())
+//    && !ActivityUtils.hasActivities(vars.get("$field.CONTRACTID"), ContextUtils.getCurrentContextId()));
\ No newline at end of file
diff --git a/entity/Employee_entity/grantDeleteProcess.js b/entity/Employee_entity/grantDeleteProcess.js
index b60872d672c..e1d6c3c3c66 100644
--- a/entity/Employee_entity/grantDeleteProcess.js
+++ b/entity/Employee_entity/grantDeleteProcess.js
@@ -2,5 +2,5 @@ import("Employee_lib");
 import("Document_lib");
 import("system.vars");
 import("system.result");
-
-result.string(!DocumentUtil.hasDocuments("EMPLOYEE", null, EmployeeUtils.sliceUserId(vars.get("$field.UID"))));
\ No newline at end of file
+// TODO: Commented because of performance problems: in Filter view this Process is called for every row. Waiting for bugfix
+//result.string(!DocumentUtil.hasDocuments("EMPLOYEE", null, EmployeeUtils.sliceUserId(vars.get("$field.UID"))));
\ No newline at end of file
diff --git a/entity/Offer_entity/grantDeleteProcess.js b/entity/Offer_entity/grantDeleteProcess.js
index 93fe93b75bd..a3be3189c21 100644
--- a/entity/Offer_entity/grantDeleteProcess.js
+++ b/entity/Offer_entity/grantDeleteProcess.js
@@ -6,8 +6,8 @@ import("system.vars");
 import("system.result");
 import("Offer_lib");
 
-if (vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_DATASET)
-    result.string(OfferUtils.isDeletable(vars.get("$field.STATUS")) 
-        && !DocumentUtil.hasDocuments("OFFER", null, vars.get("$field.OFFERID"))
-        && !TaskUtils.hasTasks(vars.get("$field.OFFERID"), ContextUtils.getCurrentContextId())
-        && !ActivityUtils.hasActivities(vars.get("$field.OFFERID"), ContextUtils.getCurrentContextId()));
\ No newline at end of file
+result.string(OfferUtils.isDeletable(vars.get("$field.STATUS")) 
+//        && !DocumentUtil.hasDocuments("OFFER", null, vars.get("$field.OFFERID"))
+//        && !TaskUtils.hasTasks(vars.get("$field.OFFERID"), ContextUtils.getCurrentContextId())
+//        && !ActivityUtils.hasActivities(vars.get("$field.OFFERID"), ContextUtils.getCurrentContextId()))
+) // TODO: Commented because of performance problems: in Filter view this Process is called for every row. Waiting for bugfix
\ No newline at end of file
diff --git a/entity/Organisation_entity/grantDeleteProcess.js b/entity/Organisation_entity/grantDeleteProcess.js
index 062489e598b..827f19abd10 100644
--- a/entity/Organisation_entity/grantDeleteProcess.js
+++ b/entity/Organisation_entity/grantDeleteProcess.js
@@ -5,7 +5,7 @@ import("Document_lib");
 import("system.vars");
 import("system.result");
 
-if (vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_DATASET)
-    result.string(!DocumentUtil.hasDocuments("CONTACT", null, vars.get("$field.CONTACTID"))
-        && !TaskUtils.hasTasks(vars.get("$field.CONTACTID"), ContextUtils.getCurrentContextId())
-        && !ActivityUtils.hasActivities(vars.get("$field.CONTACTID"), ContextUtils.getCurrentContextId()));
\ No newline at end of file
+// TODO: Commented because of performance problems: in Filter view this Process is called for every row. Waiting for bugfix
+//result.string(!DocumentUtil.hasDocuments("CONTACT", null, vars.get("$field.CONTACTID"))
+//    && !TaskUtils.hasTasks(vars.get("$field.CONTACTID"), ContextUtils.getCurrentContextId())
+//    && !ActivityUtils.hasActivities(vars.get("$field.CONTACTID"), ContextUtils.getCurrentContextId()));
\ No newline at end of file
diff --git a/entity/Person_entity/grantDeleteProcess.js b/entity/Person_entity/grantDeleteProcess.js
index 062489e598b..827f19abd10 100644
--- a/entity/Person_entity/grantDeleteProcess.js
+++ b/entity/Person_entity/grantDeleteProcess.js
@@ -5,7 +5,7 @@ import("Document_lib");
 import("system.vars");
 import("system.result");
 
-if (vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_DATASET)
-    result.string(!DocumentUtil.hasDocuments("CONTACT", null, vars.get("$field.CONTACTID"))
-        && !TaskUtils.hasTasks(vars.get("$field.CONTACTID"), ContextUtils.getCurrentContextId())
-        && !ActivityUtils.hasActivities(vars.get("$field.CONTACTID"), ContextUtils.getCurrentContextId()));
\ No newline at end of file
+// TODO: Commented because of performance problems: in Filter view this Process is called for every row. Waiting for bugfix
+//result.string(!DocumentUtil.hasDocuments("CONTACT", null, vars.get("$field.CONTACTID"))
+//    && !TaskUtils.hasTasks(vars.get("$field.CONTACTID"), ContextUtils.getCurrentContextId())
+//    && !ActivityUtils.hasActivities(vars.get("$field.CONTACTID"), ContextUtils.getCurrentContextId()));
\ No newline at end of file
diff --git a/entity/Product_entity/grantDeleteProcess.js b/entity/Product_entity/grantDeleteProcess.js
index 2aa4ac0fb02..ceda91b855d 100644
--- a/entity/Product_entity/grantDeleteProcess.js
+++ b/entity/Product_entity/grantDeleteProcess.js
@@ -5,6 +5,6 @@ import("system.vars");
 import("system.result");
 import("system.neon");
 
-if (vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_DATASET)
-    result.string(!DocumentUtil.hasDocuments("PRODUCT", null, vars.get("$field.PRODUCTID"))
-        && !ActivityUtils.hasActivities(vars.get("$field.PRODUCTID"), ContextUtils.getCurrentContextId()));
\ No newline at end of file
+// TODO: Commented because of performance problems: in Filter view this Process is called for every row. Waiting for bugfix
+//result.string(!DocumentUtil.hasDocuments("PRODUCT", null, vars.get("$field.PRODUCTID"))
+//    && !ActivityUtils.hasActivities(vars.get("$field.PRODUCTID"), ContextUtils.getCurrentContextId()));
\ No newline at end of file
diff --git a/entity/Salesproject_entity/grantDeleteProcess.js b/entity/Salesproject_entity/grantDeleteProcess.js
index fd4a209f509..45e83a39245 100644
--- a/entity/Salesproject_entity/grantDeleteProcess.js
+++ b/entity/Salesproject_entity/grantDeleteProcess.js
@@ -5,7 +5,7 @@ import("Document_lib");
 import("system.vars");
 import("system.result");
 
-if (vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_DATASET)
-    result.string(!DocumentUtil.hasDocuments("SALESPROJECT", null, vars.get("$field.SALESPROJECTID"))
-        && !TaskUtils.hasTasks(vars.get("$field.SALESPROJECTID"), ContextUtils.getCurrentContextId())
-        && !ActivityUtils.hasActivities(vars.get("$field.SALESPROJECTID"), ContextUtils.getCurrentContextId()));
\ No newline at end of file
+// TODO: Commented because of performance problems: in Filter view this Process is called for every row. Waiting for bugfix
+//result.string(!DocumentUtil.hasDocuments("SALESPROJECT", null, vars.get("$field.SALESPROJECTID"))
+//    && !TaskUtils.hasTasks(vars.get("$field.SALESPROJECTID"), ContextUtils.getCurrentContextId())
+//    && !ActivityUtils.hasActivities(vars.get("$field.SALESPROJECTID"), ContextUtils.getCurrentContextId()));
\ No newline at end of file
diff --git a/entity/Task_entity/grantDeleteProcess.js b/entity/Task_entity/grantDeleteProcess.js
index 33915f18594..091371f7422 100644
--- a/entity/Task_entity/grantDeleteProcess.js
+++ b/entity/Task_entity/grantDeleteProcess.js
@@ -2,4 +2,5 @@ import("Document_lib");
 import("system.vars");
 import("system.result");
 
-result.string(!DocumentUtil.hasDocuments("TASK", null, vars.get("$field.TASKID")));
\ No newline at end of file
+// TODO: Commented because of performance problems: in Filter view this Process is called for every row. Waiting for bugfix
+//result.string(!DocumentUtil.hasDocuments("TASK", null, vars.get("$field.TASKID")));
\ No newline at end of file
-- 
GitLab