From fc767cbfbef84278a5998dd0d08c649133d01eea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Fali=C3=A8re?= Date: Mon, 6 Feb 2023 17:56:21 +0100 Subject: [PATCH 1/2] FIX discount wasn't taken into account when adding a line in BOM --- htdocs/bom/class/bom.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 0e57bebd922..e414954d1a5 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1058,8 +1058,10 @@ class BOM extends CommonObject return -1; } $line->unit_cost = price2num((!empty($tmpproduct->cost_price)) ? $tmpproduct->cost_price : $tmpproduct->pmp); - if (empty($line->unit_cost)) { - if ($productFournisseur->find_min_price_product_fournisseur($line->fk_product) > 0) { + if ((empty($line->unit_cost)) && ($productFournisseur->find_min_price_product_fournisseur($line->fk_product) > 0)) { + if ($productFournisseur->fourn_remise_percent != "0") { + $line->unit_cost = $productFournisseur->fourn_unitprice_with_discount; + } else { $line->unit_cost = $productFournisseur->fourn_unitprice; } } From 016d1117a69f3818485b3b7ad8e8c0d4a321fa7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Fali=C3=A8re?= Date: Mon, 6 Feb 2023 18:02:28 +0100 Subject: [PATCH 2/2] added my name to the file --- htdocs/bom/class/bom.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index e414954d1a5..8b866e221de 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2019 Laurent Destailleur + * Copyright (C) 2023 Benjamin Falière * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by