From 0d134f62aced0c610faf61d0d6b42659dfc550e2 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Tue, 17 Jan 2023 17:22:32 +0100 Subject: [PATCH 1/2] FIX : Sub bom costs were not good --- htdocs/bom/tpl/objectline_view.tpl.php | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index b7087b27288..be12ec460ba 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -167,9 +167,14 @@ if ($filtertype != 1) { } } $total_cost = 0; +$tmpbom->calculateCosts(); print ''; $coldisplay++; -echo ''.price($line->total_cost).''; +if(!empty($line->fk_bom_child)) { + echo ''.price($tmpbom->total_cost).''; +} else { + echo ''.price($line->total_cost).''; +} print ''; if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines') { @@ -309,15 +314,5 @@ if ($resql) { } } -// Replace of the total_cost value by the sum of all sub-BOM lines total_cost -// TODO Remove this bad practice. We should not replace content of ouput using javascript but value should be good during generation of output. -if ($total_cost > 0) { - $line->total_cost = price($total_cost); - ?> - - \n"; From 82cccc82f58a342b52b3ce2d33bf81fda3abf6be Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 17 Jan 2023 19:23:01 +0000 Subject: [PATCH 2/2] Fixing style errors. --- htdocs/bom/tpl/objectline_view.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index be12ec460ba..2c18ffbd87f 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -170,7 +170,7 @@ $total_cost = 0; $tmpbom->calculateCosts(); print ''; $coldisplay++; -if(!empty($line->fk_bom_child)) { +if (!empty($line->fk_bom_child)) { echo ''.price($tmpbom->total_cost).''; } else { echo ''.price($line->total_cost).'';