From d45aee86551813e649358f46f5082cde432e1e46 Mon Sep 17 00:00:00 2001
From: "j.goderbauer" <j.goderbauer@adito.de>
Date: Mon, 24 Sep 2018 10:16:36 +0200
Subject: [PATCH] [Projekt: Entwicklung - Neon][TicketNr.: 1023712][ADDR -
 Standard setzten (Aktion, Button, Darstellung)]

---
 .../entityfields/is_standard/onValueChange.js          |  8 ++++++++
 .../entityfields/is_standard/possibleItemsProcess.js   |  7 +++++++
 .../entityfields/is_standard/valueProcess.js           | 10 ++++++++++
 .../children/standardaddressid_param/code.js           |  5 +++++
 4 files changed, 30 insertions(+)
 create mode 100644 entity/Address_entity/entityfields/is_standard/onValueChange.js
 create mode 100644 entity/Address_entity/entityfields/is_standard/possibleItemsProcess.js
 create mode 100644 entity/Address_entity/entityfields/is_standard/valueProcess.js
 create mode 100644 entity/Org_entity/entityfields/orgaddress_dfo/children/standardaddressid_param/code.js

diff --git a/entity/Address_entity/entityfields/is_standard/onValueChange.js b/entity/Address_entity/entityfields/is_standard/onValueChange.js
new file mode 100644
index 00000000000..c4170ac0088
--- /dev/null
+++ b/entity/Address_entity/entityfields/is_standard/onValueChange.js
@@ -0,0 +1,8 @@
+import("system.neon");
+import("system.logging");
+import("system.vars");
+
+vars.set("$image.EditedStandardAddressId", vars.get("$field.ADDRESSID"));
+neon.refresh("$sys.currentimage", "$field.OrgAddress_dfo");//TODO: refresh the correct DFO
+
+//TODO: store in database via onUpdate
\ No newline at end of file
diff --git a/entity/Address_entity/entityfields/is_standard/possibleItemsProcess.js b/entity/Address_entity/entityfields/is_standard/possibleItemsProcess.js
new file mode 100644
index 00000000000..b429686afd5
--- /dev/null
+++ b/entity/Address_entity/entityfields/is_standard/possibleItemsProcess.js
@@ -0,0 +1,7 @@
+import("system.translate");
+import("system.result");
+
+result.object([
+     ["true", translate.text("Standardadresse")]
+    ,["false", ""]
+]);
\ No newline at end of file
diff --git a/entity/Address_entity/entityfields/is_standard/valueProcess.js b/entity/Address_entity/entityfields/is_standard/valueProcess.js
new file mode 100644
index 00000000000..793e8ffb480
--- /dev/null
+++ b/entity/Address_entity/entityfields/is_standard/valueProcess.js
@@ -0,0 +1,10 @@
+import("system.logging");
+import("system.vars");
+import("system.result");
+
+var currentAddressId, changedAddressId;
+currentAddressId = vars.get("$field.ADDRESSID");
+if (vars.exists("$image.EditedStandardAddressId")){
+    changedAddressId = vars.get("$image.EditedStandardAddressId");
+}
+result.string((changedAddressId ? changedAddressId : vars.get("$param.StandardAddressId_param")) == currentAddressId);
\ No newline at end of file
diff --git a/entity/Org_entity/entityfields/orgaddress_dfo/children/standardaddressid_param/code.js b/entity/Org_entity/entityfields/orgaddress_dfo/children/standardaddressid_param/code.js
new file mode 100644
index 00000000000..d42e61e0686
--- /dev/null
+++ b/entity/Org_entity/entityfields/orgaddress_dfo/children/standardaddressid_param/code.js
@@ -0,0 +1,5 @@
+import("system.vars");
+import("system.result");
+
+var addressId = vars.get("$field.ADDRESS_ID");
+result.string(addressId);
\ No newline at end of file
-- 
GitLab