From ea35e43a5f164e66e0729d35975d1f2ca0a5dd0b Mon Sep 17 00:00:00 2001
From: Johannes Hoermann <j.hoermann@adito.de>
Date: Fri, 15 Mar 2019 15:29:06 +0100
Subject: [PATCH] update forecast meldung wieder anzeigen

---
 .../recordcontainers/db/onDBUpdate.js               | 13 ++++++++++---
 .../_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod     |  2 +-
 language/_____LANGUAGE_de/_____LANGUAGE_de.aod      |  3 ++-
 language/_____LANGUAGE_en/_____LANGUAGE_en.aod      |  3 ++-
 process/Salesproject_lib/process.js                 |  2 +-
 5 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/entity/Salesproject_entity/recordcontainers/db/onDBUpdate.js b/entity/Salesproject_entity/recordcontainers/db/onDBUpdate.js
index 22b4360c61f..20ec5095d25 100644
--- a/entity/Salesproject_entity/recordcontainers/db/onDBUpdate.js
+++ b/entity/Salesproject_entity/recordcontainers/db/onDBUpdate.js
@@ -5,10 +5,13 @@ import("Salesproject_lib");
 import("Sql_lib");
 import("system.db");
 
-var typeValue, fieldVar
+var needToUpdateForecast = false;
 
 // create Milestones if changed
 vars.get("$local.changed").forEach(function(fieldName) {
+    var typeValue;
+    var fieldVar;
+    
     switch (fieldName) {
         case "SALESPROJECT.PHASE":
             typeValue = 1;
@@ -39,11 +42,15 @@ vars.get("$local.changed").forEach(function(fieldName) {
     }
 
     if (typeValue) {
-        // TODO Milestone Value is still an Integer but has to be a String (varchar)
-        // Salesproject.insertMilestone(vars.getString("$field.SALESPROJECTID"), typeValue, vars.getString(fieldVar), true);
+        needToUpdateForecast = true;
+        // TODO Milestone Value is still an Integer but has to be a String (varchar) -> use new keywords
+        //Salesproject.insertMilestone(vars.getString("$field.SALESPROJECTID"), typeValue, vars.getString(fieldVar));
     }
 });
 
+if (needToUpdateForecast)
+    Salesproject.notifyToUpdateForecast();
+
 neon.refresh()
 
 function _updateReasons(pDelete)
diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
index 0620d74259b..128002a25d9 100644
--- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
+++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod
@@ -682,7 +682,7 @@
       <key>Standard / Individual</key>
     </entry>
     <entry>
-      <key>Please update the forecast.</key>
+      <key>Please update the ${FORECAST_ENGLISH}.</key>
     </entry>
     <entry>
       <key>no Project planned</key>
diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
index 0009fdbbe25..f560f4c32cf 100644
--- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
+++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod
@@ -1166,7 +1166,8 @@
       <key>Standard / Individual</key>
     </entry>
     <entry>
-      <key>Please update the forecast.</key>
+      <key>Please update the ${FORECAST_ENGLISH}.</key>
+      <value>Bitte den Forecast überprüfen.</value>
     </entry>
     <entry>
       <key>Industry</key>
diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
index 166e7600e12..01e1885eece 100644
--- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
+++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod
@@ -688,7 +688,8 @@
       <key>Standard / Individual</key>
     </entry>
     <entry>
-      <key>Please update the forecast.</key>
+      <key>Please update the ${FORECAST_ENGLISH}.</key>
+      <value>Please update the forecast.</value>
     </entry>
     <entry>
       <key>no Project planned</key>
diff --git a/process/Salesproject_lib/process.js b/process/Salesproject_lib/process.js
index cadd2a4a1b4..1e98c785d07 100644
--- a/process/Salesproject_lib/process.js
+++ b/process/Salesproject_lib/process.js
@@ -54,7 +54,6 @@ Salesproject.insertMilestone = function(salesprojectId, type, value, notifyForec
             ["SALESPROJECT_CYCLEID", "SALESPROJECT_ID", "TYPE", "VALUE", "DATE_START"],
             null,
             [util.getNewUUID(), salesprojectId, type, value, vars.get("$sys.date")]);
-            
         if (notifyForecast) {
             Salesproject.notifyToUpdateForecast()
         }
@@ -69,6 +68,7 @@ Salesproject.insertMilestone = function(salesprojectId, type, value, notifyForec
 Salesproject.notifyToUpdateForecast = function() {
    // TODO: logging.show durch sinnvolle Meldung ersetzen oder ähnlich...
    // logging.show(translate.text("Please update the forecast."));
+   question.showMessage(translate.text("Please update the ${FORECAST_ENGLISH}."), question.INFORMATION, translate.text("${FORECAST_ENGLISH}"))
 }
 
 /**
-- 
GitLab