From 67f58d66182a8194ca89480c4ee077d20827420a Mon Sep 17 00:00:00 2001
From: "j.goderbauer" <j.goderbauer@adito.de>
Date: Tue, 2 Apr 2019 10:34:34 +0200
Subject: [PATCH] Offer: Offercode as one column in table

---
 entity/Offer_entity/Offer_entity.aod                      | 6 ++++++
 .../entityfields/fulloffercode/valueProcess.js            | 5 +++++
 .../offercode_versnr_fieldgroup/valueProcess.js           | 2 +-
 neonView/OfferFilter_view/OfferFilter_view.aod            | 8 ++------
 4 files changed, 14 insertions(+), 7 deletions(-)
 create mode 100644 entity/Offer_entity/entityfields/fulloffercode/valueProcess.js

diff --git a/entity/Offer_entity/Offer_entity.aod b/entity/Offer_entity/Offer_entity.aod
index 07c13a4f19..b2dd85d8d2 100644
--- a/entity/Offer_entity/Offer_entity.aod
+++ b/entity/Offer_entity/Offer_entity.aod
@@ -679,6 +679,12 @@
       <searchable v="false" />
       <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/date_edit/valueProcess.js</valueProcess>
     </entityField>
+    <entityField>
+      <name>FullOfferCode</name>
+      <title>Offer number</title>
+      <state>READONLY</state>
+      <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/fulloffercode/valueProcess.js</valueProcess>
+    </entityField>
   </entityFields>
   <recordContainers>
     <dbRecordContainer>
diff --git a/entity/Offer_entity/entityfields/fulloffercode/valueProcess.js b/entity/Offer_entity/entityfields/fulloffercode/valueProcess.js
new file mode 100644
index 0000000000..d39bcd7a3c
--- /dev/null
+++ b/entity/Offer_entity/entityfields/fulloffercode/valueProcess.js
@@ -0,0 +1,5 @@
+import("system.result");
+import("system.vars");
+
+//a filedGroup cannot be placed in a table (filter-view) at the moment and therefore a separate field is needed:
+result.string(vars.get("$field.OFFERCODE") + "-" + vars.get("$field.VERSNR"));
diff --git a/entity/Offer_entity/entityfields/offercode_versnr_fieldgroup/valueProcess.js b/entity/Offer_entity/entityfields/offercode_versnr_fieldgroup/valueProcess.js
index c7fab6e323..28c9f0b087 100644
--- a/entity/Offer_entity/entityfields/offercode_versnr_fieldgroup/valueProcess.js
+++ b/entity/Offer_entity/entityfields/offercode_versnr_fieldgroup/valueProcess.js
@@ -1,4 +1,4 @@
 import("system.result");
 import("system.vars");
 
-result.string(vars.get("$field.OFFERCODE") + "-" + vars.get("$field.VERSNR"));
+result.string(vars.get("$field.FullOfferCode"));
diff --git a/neonView/OfferFilter_view/OfferFilter_view.aod b/neonView/OfferFilter_view/OfferFilter_view.aod
index edf7596f2f..b64a227c3a 100644
--- a/neonView/OfferFilter_view/OfferFilter_view.aod
+++ b/neonView/OfferFilter_view/OfferFilter_view.aod
@@ -54,12 +54,8 @@
       <entityField>#ENTITY</entityField>
       <columns>
         <neonTableColumn>
-          <name>60b83daa-9349-4bef-94d8-5f1fc350da59</name>
-          <entityField>OFFERCODE</entityField>
-        </neonTableColumn>
-        <neonTableColumn>
-          <name>36b035da-4a57-413e-a5dc-c8974ca3855b</name>
-          <entityField>VERSNR</entityField>
+          <name>4d40cee3-bcb1-4e67-8c1d-d5fc2e49cc11</name>
+          <entityField>FullOfferCode</entityField>
         </neonTableColumn>
         <neonTableColumn>
           <name>780087e7-ff3c-4592-90be-607357168295</name>
-- 
GitLab