From 0e6223ca4d350d1ee2523db45868f0f9336e0148 Mon Sep 17 00:00:00 2001
From: Tobias Feldmann <t.feldmann@adito.de>
Date: Mon, 22 Jun 2020 16:03:28 +0200
Subject: [PATCH] #1058838 calc salesproject ai probability only if example is
 active

---
 .../entityfields/probability_ai/valueProcess.js          | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/entity/Salesproject_entity/entityfields/probability_ai/valueProcess.js b/entity/Salesproject_entity/entityfields/probability_ai/valueProcess.js
index fc2d20ec68..844f60472a 100644
--- a/entity/Salesproject_entity/entityfields/probability_ai/valueProcess.js
+++ b/entity/Salesproject_entity/entityfields/probability_ai/valueProcess.js
@@ -2,10 +2,15 @@ import("system.vars");
 import("system.logging");
 import("system.result");
 import("AISalesproject_lib");
+import("system.project");
 
-result.string(AISalesprojectUtil.classify(vars.getString("$field.SALESPROJECTID"), 
+if(JSON.parse(project.getPreferenceValue("custom.ai.salesprojectProbability", "false")))
+{
+    result.string(AISalesprojectUtil.classify(vars.getString("$field.SALESPROJECTID"), 
                                           vars.getString("$field.CONTACT_ID"), 
                                           vars.getString("$field.PHASE"), 
                                           vars.getString("$field.STATUS"), 
                                           vars.getString("$field.VOLUME"),
-                                          vars.getString("$field.PROBABILITY")));
\ No newline at end of file
+                                          vars.getString("$field.PROBABILITY"))); 
+ 
+}
\ No newline at end of file
-- 
GitLab