From ff985e443e6b6e67d383ec4d01f2fa2519b9e0fd Mon Sep 17 00:00:00 2001
From: "j.goderbauer" <j.goderbauer@jgoderbauer2.aditosoftware.local>
Date: Fri, 24 Jan 2020 13:19:04 +0100
Subject: [PATCH] Offeritem: product-info was not set on change of product

---
 .../entityfields/product_id/onValueChange.js        | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/entity/Offeritem_entity/entityfields/product_id/onValueChange.js b/entity/Offeritem_entity/entityfields/product_id/onValueChange.js
index 5a3438e82a..3a5de6feab 100644
--- a/entity/Offeritem_entity/entityfields/product_id/onValueChange.js
+++ b/entity/Offeritem_entity/entityfields/product_id/onValueChange.js
@@ -18,13 +18,14 @@ if(pid != "")
     var PriceListFilter = { currency: currency, quantity: vars.get("$field.QUANTITY"), relationId: contactid, priceList: pricelist };
     
     //TODO: loading from db until loading from Consumer is possible.
+    var productInfoSubSql = newSelect("DESCRIPTION")
+        .from("DESCRIPTIONTRANSLATION")
+        .whereIfSet("DESCRIPTIONTRANSLATION.OBJECT_ROWID", "$local.value")
+        .and("DESCRIPTIONTRANSLATION.OBJECT_TYPE = 'Product'")
+        .andIfSet("DESCRIPTIONTRANSLATION.LANG", "$param.Language_param")
+        .toString();
     var ProductDetails = ProductUtils.getProductDetails(pid, PriceListFilter, 
-            [["info", "(" + newSelect("DESCRIPTION")
-                            .from("DESCRIPTIONTRANSLATION")
-                            .whereIfSet("DESCRIPTIONTRANSLATION.OBJECT_ROWID", "local.value")
-                            .and("DESCRIPTIONTRANSLATION.OBJECT_TYPE = 'Product'")
-                            .andIfSet("DESCRIPTIONTRANSLATION.LANG", "$param.Language_param")
-                            .toString() + ")"]
+            [["info", "(" + productInfoSubSql + ")"]
             ]);
     
     if(ProductDetails.productId != undefined)
-- 
GitLab