From c6d3d656c29b0a18e967c4b431bb8a964c967927 Mon Sep 17 00:00:00 2001 From: Johannes Hoermann <j.hoermann@adito.de> Date: Wed, 21 Aug 2019 13:54:33 +0200 Subject: [PATCH] fix product pricelist --- .../Productprice_entity/entityfields/currency/valueProcess.js | 2 +- .../entityfields/fromquantity/valueProcess.js | 4 +--- .../entityfields/pricelist/valueProcess.js | 2 +- .../entityfields/product_id/valueProcess.js | 2 +- entity/Productprice_entity/entityfields/vat/valueProcess.js | 3 +-- entity/Productprice_entity/onValidation.js | 3 ++- 6 files changed, 7 insertions(+), 9 deletions(-) diff --git a/entity/Productprice_entity/entityfields/currency/valueProcess.js b/entity/Productprice_entity/entityfields/currency/valueProcess.js index f07b41ba6fe..7b9758eece8 100644 --- a/entity/Productprice_entity/entityfields/currency/valueProcess.js +++ b/entity/Productprice_entity/entityfields/currency/valueProcess.js @@ -3,7 +3,7 @@ import("system.neon"); import("system.vars"); import("KeywordRegistry_basic"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) { result.string($KeywordRegistry.currency$eur()); } \ No newline at end of file diff --git a/entity/Productprice_entity/entityfields/fromquantity/valueProcess.js b/entity/Productprice_entity/entityfields/fromquantity/valueProcess.js index d471ab772a4..e216f703872 100644 --- a/entity/Productprice_entity/entityfields/fromquantity/valueProcess.js +++ b/entity/Productprice_entity/entityfields/fromquantity/valueProcess.js @@ -3,6 +3,4 @@ import("system.result"); import("system.neon"); if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) - result.string("1"); -else - result.string(vars.get("$this.value")); \ No newline at end of file + result.string("1"); \ No newline at end of file diff --git a/entity/Productprice_entity/entityfields/pricelist/valueProcess.js b/entity/Productprice_entity/entityfields/pricelist/valueProcess.js index deff487595e..5e19924138c 100644 --- a/entity/Productprice_entity/entityfields/pricelist/valueProcess.js +++ b/entity/Productprice_entity/entityfields/pricelist/valueProcess.js @@ -3,5 +3,5 @@ import("system.neon"); import("system.vars"); import("KeywordRegistry_basic"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$field.CONTACT_ID")) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$field.CONTACT_ID") && vars.get("$this.value") == null) result.string($KeywordRegistry.productPricelist$standardList()); \ No newline at end of file diff --git a/entity/Productprice_entity/entityfields/product_id/valueProcess.js b/entity/Productprice_entity/entityfields/product_id/valueProcess.js index bb3ee6de138..99cbed8d319 100644 --- a/entity/Productprice_entity/entityfields/product_id/valueProcess.js +++ b/entity/Productprice_entity/entityfields/product_id/valueProcess.js @@ -1,7 +1,7 @@ import("system.result"); import("system.vars"); -if(vars.exists("$param.ProductId_param") && vars.get("$param.ProductId_param")) +if(vars.exists("$param.ProductId_param") && vars.get("$param.ProductId_param") && vars.get("$this.value") == null) { result.string(vars.getString("$param.ProductId_param")); } \ No newline at end of file diff --git a/entity/Productprice_entity/entityfields/vat/valueProcess.js b/entity/Productprice_entity/entityfields/vat/valueProcess.js index 98c06869e15..20e9d87a63c 100644 --- a/entity/Productprice_entity/entityfields/vat/valueProcess.js +++ b/entity/Productprice_entity/entityfields/vat/valueProcess.js @@ -3,8 +3,7 @@ import("system.vars"); import("system.result"); import("system.neon"); - // '!+' -> "0", "", 0 will result in false -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !+vars.get("$this.value")) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) { if (vars.get("$field.PRODUCT_ID")) { diff --git a/entity/Productprice_entity/onValidation.js b/entity/Productprice_entity/onValidation.js index fddde143c2d..2f63d928b70 100644 --- a/entity/Productprice_entity/onValidation.js +++ b/entity/Productprice_entity/onValidation.js @@ -1,3 +1,4 @@ +import("system.logging"); import("Product_lib"); import("system.translate"); import("system.result"); @@ -22,7 +23,7 @@ var priceList = { validFrom: vars.get("$field.VALID_FROM"), validTo: vars.get("$field.VALID_TO") }; - +logging.log(JSON.stringify([priceList], null, "\t")) var identicalPriceList = ProductUtils.checkForIndenticalPriceLists(vars.get("$field.PRODUCT_ID"), priceList); if(identicalPriceList != null) { -- GitLab