From e3b35b207bced6a35b9ce5852bbd827cf02b20d9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Schr=C3=B6ger?= <m.schroeger@adito.de>
Date: Wed, 21 Nov 2018 15:03:48 +0100
Subject: [PATCH] Bugfix Offer Language

---
 entity/Offer_entity/Offer_entity.aod            | 17 +++++++++--------
 .../entityfields/relation_id/onValueChange.js   |  2 +-
 neonView/OfferEdit_view/OfferEdit_view.aod      |  2 +-
 .../OfferPreview_view/OfferPreview_view.aod     |  2 +-
 4 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/entity/Offer_entity/Offer_entity.aod b/entity/Offer_entity/Offer_entity.aod
index 98ed5ca489..c75d5629ea 100644
--- a/entity/Offer_entity/Offer_entity.aod
+++ b/entity/Offer_entity/Offer_entity.aod
@@ -35,14 +35,6 @@
       <contentType>DATE</contentType>
       <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/date_new/valueProcess.js</valueProcess>
     </entityField>
-    <entityField>
-      <name>LANGUAGE</name>
-      <tableName>OFFER</tableName>
-      <columnName>LANGUAGE</columnName>
-      <caption>Language</caption>
-      <mandatory v="true" />
-      <possibleItemsProcess>%aditoprj%/entity/Offer_entity/entityfields/language/possibleItemsProcess.js</possibleItemsProcess>
-    </entityField>
     <entityField>
       <name>OFFERCODE</name>
       <tableName>OFFER</tableName>
@@ -218,6 +210,15 @@
         </entityDependency>
       </dependencies>
     </entityIncomingField>
+    <entityField>
+      <name>LANGUAGE</name>
+      <tableName>OFFER</tableName>
+      <columnName>LANGUAGE</columnName>
+      <caption>Language</caption>
+      <mandatory v="true" />
+      <outgoingField></outgoingField>
+      <possibleItemsProcess>%aditoprj%/entity/Offer_entity/entityfields/language/possibleItemsProcess.js</possibleItemsProcess>
+    </entityField>
   </entityFields>
   <linkInformation>
     <linkInformation>
diff --git a/entity/Offer_entity/entityfields/relation_id/onValueChange.js b/entity/Offer_entity/entityfields/relation_id/onValueChange.js
index b5114f0629..4c3220606c 100644
--- a/entity/Offer_entity/entityfields/relation_id/onValueChange.js
+++ b/entity/Offer_entity/entityfields/relation_id/onValueChange.js
@@ -7,5 +7,5 @@ if(relid != "")
 {
     var relData = db.array(db.ROW, "select LANGUAGE from RELATION where RELATIONID = '" + relid + "'");
     
-    vars.set("$field.LANGUAGE", relData[0]);
+    if(relData[0] != "")    vars.set("$field.LANGUAGE", relData[0]);
 }
\ No newline at end of file
diff --git a/neonView/OfferEdit_view/OfferEdit_view.aod b/neonView/OfferEdit_view/OfferEdit_view.aod
index fc6c2ad735..52ce916b39 100644
--- a/neonView/OfferEdit_view/OfferEdit_view.aod
+++ b/neonView/OfferEdit_view/OfferEdit_view.aod
@@ -26,7 +26,7 @@
           <entityField>OFFERDATE</entityField>
         </entityFieldLink>
         <entityFieldLink>
-          <name>ca883d2e-f391-4681-b9f7-72040d4b9669</name>
+          <name>7ab3eb65-b713-4251-9eb1-3119432565f5</name>
           <entityField>LANGUAGE</entityField>
         </entityFieldLink>
         <entityFieldLink>
diff --git a/neonView/OfferPreview_view/OfferPreview_view.aod b/neonView/OfferPreview_view/OfferPreview_view.aod
index c9b1bb9929..7563c1e23e 100644
--- a/neonView/OfferPreview_view/OfferPreview_view.aod
+++ b/neonView/OfferPreview_view/OfferPreview_view.aod
@@ -29,7 +29,7 @@
           <entityField>STATUS</entityField>
         </entityFieldLink>
         <entityFieldLink>
-          <name>7a145c84-dc49-4af2-870f-44960dd89d12</name>
+          <name>423cf3fa-49d7-4c48-bd8f-1fc05a14cb1a</name>
           <entityField>LANGUAGE</entityField>
         </entityFieldLink>
         <entityFieldLink>
-- 
GitLab