diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index 38da2d0077c..cf6ca335125 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -6,6 +6,7 @@ * Copyright (C) 2012-2014 Raphaƫl Doursenaud * Copyright (C) 2013 Florian Henry * Copyright (C) 2017 Juanjo Menent + * Copyright (C) 2024 MDW * * 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 @@ -34,7 +35,14 @@ * $type, $text, $description, $line */ -/** var ObjectLine $line */ +/** + * @var CommonObjectLine $line + * @var int $num + */ +'@phan-var-force CommonObjectLine $line + @phan-var-force int $num + @phan-var-force CommonObject $this + @phan-var-force CommonObject $object'; require_once DOL_DOCUMENT_ROOT.'/workstation/class/workstation.class.php'; @@ -44,8 +52,6 @@ if (empty($object) || !is_object($object)) { exit(1); } -'@phan-var-force CommonObject $this - @phan-var-force CommonObject $object'; global $filtertype; if (empty($filtertype)) { @@ -249,7 +255,7 @@ print ''; // Select of all the sub-BOM lines // From this point to the end of the file, we only take care of sub-BOM lines $sql = 'SELECT rowid, fk_bom_child, fk_product, qty FROM '.MAIN_DB_PREFIX.'bom_bomline AS bl'; -$sql.= ' WHERE fk_bom ='. (int) $tmpbom->id; +$sql .= ' WHERE fk_bom ='. (int) $tmpbom->id; $resql = $object->db->query($sql); if ($resql) { @@ -323,7 +329,7 @@ if ($resql) { if (!empty($sub_bom->id)) { $sub_bom->calculateCosts(); print ''.price(price2num($sub_bom->total_cost * $sub_bom_line->qty * $line->qty, 'MT')).''; - $total_cost+= $sub_bom->total_cost * $sub_bom_line->qty * $line->qty; + $total_cost += $sub_bom->total_cost * $sub_bom_line->qty * $line->qty; } elseif ($sub_bom_product->type == Product::TYPE_SERVICE && isModEnabled('workstation') && !empty($sub_bom_product->fk_default_workstation)) { //Convert qty to hour $unit = measuringUnitString($sub_bom_line->fk_unit, '', '', 1); @@ -339,24 +345,24 @@ if ($resql) { } elseif ($sub_bom_product->cost_price > 0) { print ''; print ''.price(price2num($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty, 'MT')).''; - $total_cost+= $sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty; + $total_cost += $sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty; } elseif ($sub_bom_product->pmp > 0) { // PMP if cost price isn't defined print ''; print ''.price(price2num($sub_bom_product->pmp * $sub_bom_line->qty * $line->qty, 'MT')).''; - $total_cost.= $sub_bom_product->pmp * $sub_bom_line->qty * $line->qty; + $total_cost .= $sub_bom_product->pmp * $sub_bom_line->qty * $line->qty; } else { // Minimum purchase price if cost price and PMP aren't defined $sql_supplier_price = 'SELECT MIN(price) AS min_price, quantity AS qty FROM '.MAIN_DB_PREFIX.'product_fournisseur_price'; - $sql_supplier_price.= ' WHERE fk_product = '. (int) $sub_bom_product->id; + $sql_supplier_price .= ' WHERE fk_product = '. (int) $sub_bom_product->id; $resql_supplier_price = $object->db->query($sql_supplier_price); if ($resql_supplier_price) { $obj = $object->db->fetch_object($resql_supplier_price); if (!empty($obj->qty) && !empty($sub_bom_line->qty) && !empty($line->qty)) { - $line_cost = $obj->min_price/$obj->qty * $sub_bom_line->qty * $line->qty; + $line_cost = $obj->min_price / $obj->qty * $sub_bom_line->qty * $line->qty; } else { $line_cost = $obj->min_price; } print ''.price2num($line_cost, 'MT').''; - $total_cost+= $line_cost; + $total_cost += $line_cost; } }