Update bom.class.php

This commit is contained in:
Laurent Destailleur 2022-01-10 20:58:08 +01:00 committed by GitHub
parent f5c04c81a9
commit c334c3cd58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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