From ba45661fced3f3c3f2b287eb522f72584835e5de Mon Sep 17 00:00:00 2001
From: "s.pongratz" <s.pongratz@adito.de>
Date: Fri, 1 Oct 2021 17:39:45 +0200
Subject: [PATCH] [Projekt: xRM-ContactManagement][TicketNr.: 1075564][Angabe
 einer Postfachnummer bei Postfachadressen]

---
 entity/Address_entity/Address_entity.aod               |  1 +
 .../entityfields/address/titleProcess.js               | 10 ++++++++++
 .../entityfields/buildingno/stateProcess.js            |  4 +++-
 3 files changed, 14 insertions(+), 1 deletion(-)
 create mode 100644 entity/Address_entity/entityfields/address/titleProcess.js

diff --git a/entity/Address_entity/Address_entity.aod b/entity/Address_entity/Address_entity.aod
index 4fa663250b..1cfe28c601 100644
--- a/entity/Address_entity/Address_entity.aod
+++ b/entity/Address_entity/Address_entity.aod
@@ -15,6 +15,7 @@
       <mandatory v="true" />
       <textInputAllowed v="false" />
       <stateProcess>%aditoprj%/entity/Address_entity/entityfields/address/stateProcess.js</stateProcess>
+      <titleProcess>%aditoprj%/entity/Address_entity/entityfields/address/titleProcess.js</titleProcess>
       <tooltip></tooltip>
       <onValueChange>%aditoprj%/entity/Address_entity/entityfields/address/onValueChange.js</onValueChange>
       <onValueChangeTypes>
diff --git a/entity/Address_entity/entityfields/address/titleProcess.js b/entity/Address_entity/entityfields/address/titleProcess.js
new file mode 100644
index 0000000000..ad0fa3728f
--- /dev/null
+++ b/entity/Address_entity/entityfields/address/titleProcess.js
@@ -0,0 +1,10 @@
+import("system.result");
+import("system.vars");
+import("KeywordRegistry_basic");
+import("Keyword_lib");
+
+var key = vars.get("$field.ADDR_TYPE");
+if (key == $KeywordRegistry.addressType$post())
+{
+    result.string("Post office box number");
+}
diff --git a/entity/Address_entity/entityfields/buildingno/stateProcess.js b/entity/Address_entity/entityfields/buildingno/stateProcess.js
index ed5e161dcc..433311c289 100644
--- a/entity/Address_entity/entityfields/buildingno/stateProcess.js
+++ b/entity/Address_entity/entityfields/buildingno/stateProcess.js
@@ -1,10 +1,12 @@
+import("KeywordRegistry_basic");
 import("system.neon");
 import("system.result");
 import("system.vars");
 
+var key = vars.get("$field.ADDR_TYPE");
 // The field is only displayed in edit mode because there is the "formattedAddress" field which one shows the fromated address.
 // If the field has a Value it would be displayed next to the formattedAddress field in view mode, so in this case the state is set to invisible.
-if (vars.get("$sys.recordstate") == "" || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_VIEW)
+if (vars.get("$sys.recordstate") == "" || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_VIEW || key == $KeywordRegistry.addressType$post())
 {
     result.string(neon.COMPONENTSTATE_INVISIBLE);
 }
\ No newline at end of file
-- 
GitLab