diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 069380249db..ce3eb33cce5 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -395,7 +395,6 @@ class ProductFournisseur extends Product return -2; } } - else { dol_syslog(get_class($this).'::update_buyprice without knowing id of line, so we delete from company, quantity and supplier_ref and insert again', LOG_DEBUG); @@ -438,11 +437,11 @@ class ProductFournisseur extends Product $sql .= (empty($fk_barcode_type) ? 'NULL' : "'".$this->db->escape($fk_barcode_type)."'"); $sql .= ")"; - $idinserted = 0; + $this->product_fourn_price_id = 0; $resql = $this->db->query($sql); if ($resql) { - $idinserted = $this->db->last_insert_id(MAIN_DB_PREFIX."product_fournisseur_price"); + $this->product_fourn_price_id = $this->db->last_insert_id(MAIN_DB_PREFIX . "product_fournisseur_price"); } else { $error++; @@ -450,6 +449,7 @@ class ProductFournisseur extends Product if (!$error && empty($conf->global->PRODUCT_PRICE_SUPPLIER_NO_LOG)) { // Add record into log table + // $this->product_fourn_price_id must be set $result = $this->logPrice($user, $now, $buyprice, $qty, $multicurrency_buyprice, $multicurrency_unitBuyPrice, $multicurrency_tx, $fk_multicurrenc, $multicurrency_code); if ($result < 0) { $error++; @@ -465,7 +465,6 @@ class ProductFournisseur extends Product if (empty($error)) { $this->db->commit(); - $this->product_fourn_price_id = $idinserted; return $this->product_fourn_price_id; } else { $this->db->rollback(); diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index 1944de13f61..133b3d3d509 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -284,9 +284,11 @@ if ($object->id > 0) $morehtmlref.='
'; // Third party - $morehtmlref.=$langs->trans("ThirdParty").': '; - $morehtmlref.=$projectstatic->thirdparty->getNomUrl(1); - $morehtmlref.=''; + $morehtmlref .= $langs->trans("ThirdParty") . ': '; + if (is_object($projectstatic->thirdparty) && $projectstatic->thirdparty->id > 0) { + $morehtmlref .= $projectstatic->thirdparty->getNomUrl(1); + } + $morehtmlref .= ''; } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param);