From 29f8a1034560fa8857ffaeef96fc7115ba40ffd7 Mon Sep 17 00:00:00 2001 From: Pascal Neub <p.neub@adito.de> Date: Wed, 22 Dec 2021 10:26:25 +0100 Subject: [PATCH] =?UTF-8?q?[Projekt:=20xRM-Sales][TicketNr.:=202002919][Pr?= =?UTF-8?q?odukte=20-=20Fehlermeldung=20beim=20Hinzuf=C3=BCgen=20eines=20E?= =?UTF-8?q?inzelproduktes]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entity/Offeritem_entity/afterSave.js | 1 + entity/Prod2prod_entity/Prod2prod_entity.aod | 4 ++++ .../entityfields/source_id/onValueChange.js | 21 +++++++++++-------- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/entity/Offeritem_entity/afterSave.js b/entity/Offeritem_entity/afterSave.js index 0fc435de653..2041fcb06eb 100644 --- a/entity/Offeritem_entity/afterSave.js +++ b/entity/Offeritem_entity/afterSave.js @@ -2,6 +2,7 @@ import("system.neon"); import("system.entities"); import("system.vars"); import("Sql_lib"); +import("Offer_lib"); if(vars.get("$local.recordstate") == neon.OPERATINGSTATE_EDIT) { diff --git a/entity/Prod2prod_entity/Prod2prod_entity.aod b/entity/Prod2prod_entity/Prod2prod_entity.aod index ead47cfc2b7..16f8ef9b863 100644 --- a/entity/Prod2prod_entity/Prod2prod_entity.aod +++ b/entity/Prod2prod_entity/Prod2prod_entity.aod @@ -39,6 +39,10 @@ <consumer>Products</consumer> <mandatory v="true" /> <onValueChange>%aditoprj%/entity/Prod2prod_entity/entityfields/source_id/onValueChange.js</onValueChange> + <onValueChangeTypes> + <element>MASK</element> + <element>PROCESS_SETVALUE</element> + </onValueChangeTypes> </entityField> <entityField> <name>TAKEPRICE</name> diff --git a/entity/Prod2prod_entity/entityfields/source_id/onValueChange.js b/entity/Prod2prod_entity/entityfields/source_id/onValueChange.js index 6b7340b99f9..c9db8f5da2e 100644 --- a/entity/Prod2prod_entity/entityfields/source_id/onValueChange.js +++ b/entity/Prod2prod_entity/entityfields/source_id/onValueChange.js @@ -166,17 +166,20 @@ function _calcPrices() } - for (i = 0; i < productAndChildProducts[null].length; i++) + if(productAndChildProducts[null]) { - var currentProdId = productAndChildProducts[null][i]; - - if(Utils.isNotNullOrEmptyString(productPrices[currentProdId]["PP"])) - { - buyPrice = eMath.addDec(buyPrice, productPrices[currentProdId]["PP"]); - } - if(Utils.isNotNullOrEmptyString(productPrices[currentProdId]["SP"])) + for(i = 0; i < productAndChildProducts[null].length; i++) { - sellPrice = eMath.addDec(sellPrice, productPrices[currentProdId]["SP"]); + var currentProdId = productAndChildProducts[null][i]; + + if(Utils.isNotNullOrEmptyString(productPrices[currentProdId]["PP"])) + { + buyPrice = eMath.addDec(buyPrice, productPrices[currentProdId]["PP"]); + } + if(Utils.isNotNullOrEmptyString(productPrices[currentProdId]["SP"])) + { + sellPrice = eMath.addDec(sellPrice, productPrices[currentProdId]["SP"]); + } } } buyPrice =( -- GitLab