From 6a62a21288e010c9e4db0697c52bb205e054f4da Mon Sep 17 00:00:00 2001
From: "p.neub" <p.neub@adito.de>
Date: Wed, 24 Feb 2021 14:40:27 +0100
Subject: [PATCH] =?UTF-8?q?[Projekt:=20xRM-Sales][TicketNr.:=201053226][Ve?=
 =?UTF-8?q?rkn=C3=BCpfung=20zwischen=20Angebot=20und=20Beleg]?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 entity/Offer_entity/Offer_entity.aod               | 14 ++++++++++++++
 .../orders/children/offerid_param/valueProcess.js  |  4 ++++
 entity/Order_entity/Order_entity.aod               |  6 ++++++
 .../recordcontainers/db/conditionProcess.js        |  5 ++++-
 neonView/OfferMain_view/OfferMain_view.aod         |  5 +++++
 5 files changed, 33 insertions(+), 1 deletion(-)
 create mode 100644 entity/Offer_entity/entityfields/orders/children/offerid_param/valueProcess.js

diff --git a/entity/Offer_entity/Offer_entity.aod b/entity/Offer_entity/Offer_entity.aod
index 89c126aae6..c9a551b7de 100644
--- a/entity/Offer_entity/Offer_entity.aod
+++ b/entity/Offer_entity/Offer_entity.aod
@@ -1125,6 +1125,20 @@
       <iconId>VAADIN:CURLY_BRACKETS</iconId>
       <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/openadminview/stateProcess.js</stateProcess>
     </entityActionField>
+    <entityConsumer>
+      <name>Orders</name>
+      <dependency>
+        <name>dependency</name>
+        <entityName>Order_entity</entityName>
+        <fieldName>#PROVIDER</fieldName>
+      </dependency>
+      <children>
+        <entityParameter>
+          <name>OfferId_param</name>
+          <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/orders/children/offerid_param/valueProcess.js</valueProcess>
+        </entityParameter>
+      </children>
+    </entityConsumer>
   </entityFields>
   <recordContainers>
     <dbRecordContainer>
diff --git a/entity/Offer_entity/entityfields/orders/children/offerid_param/valueProcess.js b/entity/Offer_entity/entityfields/orders/children/offerid_param/valueProcess.js
new file mode 100644
index 0000000000..2f6bb2c4c7
--- /dev/null
+++ b/entity/Offer_entity/entityfields/orders/children/offerid_param/valueProcess.js
@@ -0,0 +1,4 @@
+import("system.vars");
+import("system.result");
+
+result.string(vars.get("$field.OFFERID"));
diff --git a/entity/Order_entity/Order_entity.aod b/entity/Order_entity/Order_entity.aod
index f9d3dd60f0..ea20792d66 100644
--- a/entity/Order_entity/Order_entity.aod
+++ b/entity/Order_entity/Order_entity.aod
@@ -35,6 +35,12 @@
           <fieldName>Orders</fieldName>
           <isConsumer v="false" />
         </entityDependency>
+        <entityDependency>
+          <name>b9cdee36-bfa3-4682-9a1d-26996dd6a5c2</name>
+          <entityName>Offer_entity</entityName>
+          <fieldName>Orders</fieldName>
+          <isConsumer v="false" />
+        </entityDependency>
       </dependencies>
     </entityProvider>
     <entityField>
diff --git a/entity/Order_entity/recordcontainers/db/conditionProcess.js b/entity/Order_entity/recordcontainers/db/conditionProcess.js
index 572d8249de..a2241cff99 100644
--- a/entity/Order_entity/recordcontainers/db/conditionProcess.js
+++ b/entity/Order_entity/recordcontainers/db/conditionProcess.js
@@ -7,7 +7,10 @@ var cond = newWhere();
 
 if(vars.exists("$param.ContactId_param") && vars.get("$param.ContactId_param"))
     cond.andIfSet("SALESORDER.CONTACT_ID", "$param.ContactId_param");
-else {
+else if(vars.exists("$param.OfferId_param") && vars.get("$param.OfferId_param"))
+    cond.andIfSet("SALESORDER.OFFER_ID", "$param.OfferId_param");
+else
+{
     cond.andIfSet("SALESORDER.OBJECT_ROWID", "$param.ObjectRowId_param")
         .andIfSet("SALESORDER.OBJECT_TYPE", "$param.ObjectType_param");
 }
diff --git a/neonView/OfferMain_view/OfferMain_view.aod b/neonView/OfferMain_view/OfferMain_view.aod
index 2010f32c7d..e573ae5340 100644
--- a/neonView/OfferMain_view/OfferMain_view.aod
+++ b/neonView/OfferMain_view/OfferMain_view.aod
@@ -24,6 +24,11 @@
       <entityField>Products</entityField>
       <view>ProductFilter_view</view>
     </neonViewReference>
+    <neonViewReference>
+      <name>e44fbc18-387e-41f3-acbc-41a9e65e2d38</name>
+      <entityField>Orders</entityField>
+      <view>OrderFilter_view</view>
+    </neonViewReference>
     <neonViewReference>
       <name>e6b12eed-d67e-467c-9302-f6340f901235</name>
       <entityField>#ENTITY</entityField>
-- 
GitLab