From c9f444b13db2a44606f756b54622a839de736473 Mon Sep 17 00:00:00 2001
From: "j.goderbauer" <j.goderbauer@adito.de>
Date: Wed, 20 Mar 2019 13:45:09 +0100
Subject: [PATCH] [Projekt: Entwicklung - Neon][TicketNr.:
 1035771][Kontaktmanagement - Firma / Kontaktperson + Adressen / Kommunikation
 - Nutzung des kompletten Moduls sicherstellen]

---
 entity/Contact_entity/Contact_entity.aod                      | 3 ++-
 .../entityfields/organisation_id/onValueChange.js             | 4 ++++
 2 files changed, 6 insertions(+), 1 deletion(-)
 create mode 100644 entity/Contact_entity/entityfields/organisation_id/onValueChange.js

diff --git a/entity/Contact_entity/Contact_entity.aod b/entity/Contact_entity/Contact_entity.aod
index c758ccea00..95e026e4e1 100644
--- a/entity/Contact_entity/Contact_entity.aod
+++ b/entity/Contact_entity/Contact_entity.aod
@@ -4,7 +4,7 @@
   <title>Contact</title>
   <majorModelMode>DISTRIBUTED</majorModelMode>
   <documentation>%aditoprj%/entity/Contact_entity/documentation.adoc</documentation>
-  <icon>VAADIN:USERS</icon>
+  <iconId>VAADIN:USERS</iconId>
   <recordContainer>db</recordContainer>
   <entityFields>
     <entityProvider>
@@ -18,6 +18,7 @@
       <title>Organisation</title>
       <consumer>Organisations</consumer>
       <mandatory v="true" />
+      <onValueChange>%aditoprj%/entity/Contact_entity/entityfields/organisation_id/onValueChange.js</onValueChange>
     </entityField>
     <entityField>
       <name>PERSON_ID</name>
diff --git a/entity/Contact_entity/entityfields/organisation_id/onValueChange.js b/entity/Contact_entity/entityfields/organisation_id/onValueChange.js
new file mode 100644
index 0000000000..0347a3d2d5
--- /dev/null
+++ b/entity/Contact_entity/entityfields/organisation_id/onValueChange.js
@@ -0,0 +1,4 @@
+import("system.vars");
+
+//since the standard address can be only values of org the standard address has to be reset on org change
+vars.set("$field.ADDRESS_ID", "");
\ No newline at end of file
-- 
GitLab