From 5843cc8cb6741800461c1b5f5af9f06cf1d1e79b Mon Sep 17 00:00:00 2001 From: atm-lena Date: Fri, 16 Sep 2022 11:11:20 +0200 Subject: [PATCH] Bom services : fix calcul of cost for line without workstation --- htdocs/bom/class/bom.class.php | 14 ++++++-------- htdocs/langs/fr_FR/mrp.lang | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index ef99f9f7bb7..c271b7479be 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1369,16 +1369,14 @@ class BOM extends CommonObject $unit = measuringUnitString($line->fk_unit, '', '', 1); $qty = convertDurationtoHour($line->qty, $unit); - if ($conf->workstation->enabled) { - if ($tmpproduct->fk_default_workstation) { - $workstation = new Workstation($this->db); - $res = $workstation->fetch($tmpproduct->fk_default_workstation); + if ($conf->workstation->enabled && !empty($tmpproduct->fk_default_workstation)) { + $workstation = new Workstation($this->db); + $res = $workstation->fetch($tmpproduct->fk_default_workstation); - if ($res > 0) $line->total_cost = price2num($qty * ($workstation->thm_operator_estimated + $workstation->thm_machine_estimated), 'MT'); - else { - $this->error = $workstation->error; + if ($res > 0) $line->total_cost = price2num($qty * ($workstation->thm_operator_estimated + $workstation->thm_machine_estimated), 'MT'); + else { + $this->error = $workstation->error; return -3; - } } } else { $line->total_cost = price2num($qty * $tmpproduct->cost_price, 'MT'); diff --git a/htdocs/langs/fr_FR/mrp.lang b/htdocs/langs/fr_FR/mrp.lang index 2a905a76530..1d17bc750ea 100644 --- a/htdocs/langs/fr_FR/mrp.lang +++ b/htdocs/langs/fr_FR/mrp.lang @@ -82,7 +82,7 @@ ProductsToProduce=Produits à produire UnitCost=Coût unitaire TotalCost=Coût total BOMTotalCost=Le coût de production de cette nomenclature basé sur chaque quantité et produit à consommer (utilise le prix de revient si défini, sinon le PMP si défini, sinon le meilleur prix d'achat) -BOMTotalCostService=Si le module "Poste de travail" est activé, alors le calcul est "quantité (convertie en heures) x thm du poste de travail", sinon "quantité (convertie en heures) x prix de revient du service" +BOMTotalCostService=Si le module "Poste de travail" est activé et qu'un poste de travil est défini par défaut sur la ligne, alors le calcul est "quantité (convertie en heures) x thm du poste de travail", sinon "quantité (convertie en heures) x prix de revient du service" BOMProductsList=Liste des composants BOMServicesList=Liste des services GoOnTabProductionToProduceFirst=Vous devez avoir la production pour clôturer un Ordre de Fabrication (voir onglet '%s'). Mais vous pouvez l'annuler.