From 70ed27d668a518bfcbd451a07a2d6817917db960 Mon Sep 17 00:00:00 2001
From: Johannes Hoermann <j.hoermann@adito.de>
Date: Thu, 7 Mar 2019 16:36:29 +0100
Subject: [PATCH] =?UTF-8?q?Produkt=20Attribute=20hinzuf=C3=BCgen?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../AttributeRelation_entity.aod              |  6 ++++++
 entity/Product_entity/Product_entity.aod      | 20 +++++++++++++++++++
 .../children/objectrowid_param/code.js        |  5 +++++
 .../children/objecttype_param/code.js         |  4 ++++
 .../ProductMain_view/ProductMain_view.aod     |  5 +++++
 process/Product_lib/process.js                |  2 +-
 6 files changed, 41 insertions(+), 1 deletion(-)
 create mode 100644 entity/Product_entity/entityfields/attributes/children/objectrowid_param/code.js
 create mode 100644 entity/Product_entity/entityfields/attributes/children/objecttype_param/code.js

diff --git a/entity/AttributeRelation_entity/AttributeRelation_entity.aod b/entity/AttributeRelation_entity/AttributeRelation_entity.aod
index b2ca6240ff..08affbf568 100644
--- a/entity/AttributeRelation_entity/AttributeRelation_entity.aod
+++ b/entity/AttributeRelation_entity/AttributeRelation_entity.aod
@@ -75,6 +75,12 @@
           <fieldName>Attributes</fieldName>
           <isConsumer v="false" />
         </entityDependency>
+        <entityDependency>
+          <name>5bcda86a-e56c-4a4a-ac13-c6eb68152200</name>
+          <entityName>Product_entity</entityName>
+          <fieldName>Attributes</fieldName>
+          <isConsumer v="false" />
+        </entityDependency>
       </dependencies>
       <children>
         <entityParameter>
diff --git a/entity/Product_entity/Product_entity.aod b/entity/Product_entity/Product_entity.aod
index a30ac9f67e..d366abbdf4 100644
--- a/entity/Product_entity/Product_entity.aod
+++ b/entity/Product_entity/Product_entity.aod
@@ -319,6 +319,26 @@
       <onActionProcess>%aditoprj%/entity/Product_entity/entityfields/newactivity/onActionProcess.js</onActionProcess>
       <iconId>NEON:HISTORY</iconId>
     </entityActionField>
+    <entityConsumer>
+      <name>Attributes</name>
+      <title>Attributes</title>
+      <fieldType>DEPENDENCY_OUT</fieldType>
+      <dependency>
+        <name>dependency</name>
+        <entityName>AttributeRelation_entity</entityName>
+        <fieldName>RelationsForSpecificObject</fieldName>
+      </dependency>
+      <children>
+        <entityParameter>
+          <name>objectType_param</name>
+          <code>%aditoprj%/entity/Product_entity/entityfields/attributes/children/objecttype_param/code.js</code>
+        </entityParameter>
+        <entityParameter>
+          <name>objectRowId_param</name>
+          <code>%aditoprj%/entity/Product_entity/entityfields/attributes/children/objectrowid_param/code.js</code>
+        </entityParameter>
+      </children>
+    </entityConsumer>
   </entityFields>
   <recordContainers>
     <dbRecordContainer>
diff --git a/entity/Product_entity/entityfields/attributes/children/objectrowid_param/code.js b/entity/Product_entity/entityfields/attributes/children/objectrowid_param/code.js
new file mode 100644
index 0000000000..9635e2f4c4
--- /dev/null
+++ b/entity/Product_entity/entityfields/attributes/children/objectrowid_param/code.js
@@ -0,0 +1,5 @@
+import("system.vars");
+import("system.result");
+import("Context_lib");
+
+result.string(vars.get("$field.PRODUCTID"));
\ No newline at end of file
diff --git a/entity/Product_entity/entityfields/attributes/children/objecttype_param/code.js b/entity/Product_entity/entityfields/attributes/children/objecttype_param/code.js
new file mode 100644
index 0000000000..008915f61d
--- /dev/null
+++ b/entity/Product_entity/entityfields/attributes/children/objecttype_param/code.js
@@ -0,0 +1,4 @@
+import("system.result");
+import("Context_lib");
+
+result.string(ContextUtils.getCurrentContextId());
\ No newline at end of file
diff --git a/neonView/ProductMain_view/ProductMain_view.aod b/neonView/ProductMain_view/ProductMain_view.aod
index 68c00aacee..25005dcfa6 100644
--- a/neonView/ProductMain_view/ProductMain_view.aod
+++ b/neonView/ProductMain_view/ProductMain_view.aod
@@ -39,5 +39,10 @@
       <entityField>Documents</entityField>
       <view>DocumentFilter_view</view>
     </neonViewReference>
+    <neonViewReference>
+      <name>b069dbb1-fa32-41a7-a40c-918d3d50dd26</name>
+      <entityField>Attributes</entityField>
+      <view>AttributeRelationFilter_view</view>
+    </neonViewReference>
   </children>
 </neonView>
diff --git a/process/Product_lib/process.js b/process/Product_lib/process.js
index 33c29bed91..1d51b694be 100644
--- a/process/Product_lib/process.js
+++ b/process/Product_lib/process.js
@@ -36,7 +36,7 @@ ProductUtils.getCurrentProductPrice = function(pid, buySell) {
         var actualPriceCondition = SqlCondition.begin()
                     .andPrepare("PRODUCTPRICE.BUYSELL", buySell)
                     .andPrepare("PRODUCTPRICE.PRODUCT_ID", pid)
-                    .andPrepare("PRODUCTPRICE.CURRENCY", 1) // TODO: warum ist Currency hardgecoded auf 1?? --> Einheitliche Währungen einbauen (auch zeichen vor oder nach der zahel, etc.)
+                    .andPrepare("PRODUCTPRICE.CURRENCY", 1) // TODO: warum ist Currency hardgecoded auf 1?? --> Einheitliche Währungen einbauen (auch zeichen vor oder nach der zahel, etc.) 1034949
                     .andPrepare("PRODUCTPRICE.VALID_FROM", today, "# <= ?")
                     .andSqlCondition(SqlCondition.begin()
                         .orPrepare("PRODUCTPRICE.VALID_TO", today, "# >= ?")
-- 
GitLab