diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index bd411654a04..3855af82083 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -789,14 +789,12 @@ class BOM extends CommonObject if (isset($this->label)) { $label .= '
'.$langs->trans('Label').': '.$this->label; } - if (!empty($this->fk_product)) { - dol_include_once('/product/class/product.class.php'); + if (!empty($this->fk_product) && $this->fk_product > 0) { + include_once DOL_DOCUMENT_ROO.'/product/class/product.class.php'; $product = new Product($db); $resultFetch = $product->fetch($this->fk_product); - if ($resultFetch < 0) { - setEventMessages($product->error, $product->errors, 'errors'); - } else { - $label .= "
".$langs->trans("Product").': '.$product->getNomUrl(0, '', 0, -1, 1); + if ($resultFetch > 0) { + $label .= "
".$langs->trans("Product").': '.$product->label; } }