From a42bfae3a88ada7358510e8a366d4127edd614c7 Mon Sep 17 00:00:00 2001
From: Johannes Hoermann <j.hoermann@adito.de>
Date: Thu, 29 Aug 2019 09:02:52 +0200
Subject: [PATCH] addres ws fix mandatory fields not working

---
 entity/Address_entity/Address_entity.aod                 | 1 +
 .../entityfields/zip_ws/displayValueProcess.js           | 2 +-
 process/WsValidation_lib/process.js                      | 9 +++++----
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/entity/Address_entity/Address_entity.aod b/entity/Address_entity/Address_entity.aod
index 6fb61c9765..6d56e9450b 100644
--- a/entity/Address_entity/Address_entity.aod
+++ b/entity/Address_entity/Address_entity.aod
@@ -425,6 +425,7 @@
     </entityField>
     <entityField>
       <name>Address_ws</name>
+      <title>dfg</title>
       <consumer>StreetValidation</consumer>
       <mandatoryProcess>%aditoprj%/entity/Address_entity/entityfields/address_ws/mandatoryProcess.js</mandatoryProcess>
       <textInputAllowed v="true" />
diff --git a/entity/Address_entity/entityfields/zip_ws/displayValueProcess.js b/entity/Address_entity/entityfields/zip_ws/displayValueProcess.js
index 72a6e97c0a..3c1fea5790 100644
--- a/entity/Address_entity/entityfields/zip_ws/displayValueProcess.js
+++ b/entity/Address_entity/entityfields/zip_ws/displayValueProcess.js
@@ -1,3 +1,3 @@
 import("WsValidation_lib");
 
-WsValidationFieldUtils.wsDisplayValueProcess(WsValidationType.get().TYPE_ZIP_NOMINATIM, "$field.ZIP");
\ No newline at end of file
+WsValidationFieldUtils.wsDisplayValueProcess(WsValidationType.get().TYPE_ZIP_NOMINATIM);
\ No newline at end of file
diff --git a/process/WsValidation_lib/process.js b/process/WsValidation_lib/process.js
index ef1bf9a459..1343b1a29d 100644
--- a/process/WsValidation_lib/process.js
+++ b/process/WsValidation_lib/process.js
@@ -1,3 +1,4 @@
+import("system.result");
 import("system.logging");
 import("system.translate");
 import("system.project");
@@ -490,8 +491,8 @@ WsValidationFieldUtils.mainFieldMandatoryProcess = function(pWsType, pMandatory)
  * @param {String} field-variable from the main field. e.g. "$field.ZIP"
  */
 WsValidationFieldUtils.wsValueProcess = function(pWsType, pMainField)
-{
-    if (vars.get("$this.value") == null && WsValidationUtils.isWsEnabled(pWsType))
+{//vars.get("$this.value") == null && 
+    if (WsValidationUtils.isWsEnabled(pWsType))
     {
         result.string(vars.get(pMainField));
     }
@@ -507,8 +508,8 @@ WsValidationFieldUtils.wsDisplayValueProcess = function(pWsType, pMainField)
 {
     if (WsValidationUtils.isWsEnabled(pWsType))
     {
-        // use the value from the corresponding field as display value
-        result.string(vars.get(pMainField));
+        // use the value from the current field as display value (for instant refresh of display value
+        result.string(vars.get("$" + vars.get("$this.name")))
     }
 }
 
-- 
GitLab