Merge pull request #12708 from atm-gauthier/10.0_fix_product_fourn_price_id
FIX : product_fourn_price_id was assigned too late for logPrice() function
This commit is contained in:
commit
60a0c18338
@ -391,7 +391,6 @@ class ProductFournisseur extends Product
|
|||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
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);
|
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);
|
||||||
@ -434,11 +433,11 @@ class ProductFournisseur extends Product
|
|||||||
$sql .= (empty($fk_barcode_type) ? 'NULL' : "'" . $this->db->escape($fk_barcode_type) . "'");
|
$sql .= (empty($fk_barcode_type) ? 'NULL' : "'" . $this->db->escape($fk_barcode_type) . "'");
|
||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
|
|
||||||
$idinserted = 0;
|
$this->product_fourn_price_id = 0;
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
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 {
|
else {
|
||||||
$error++;
|
$error++;
|
||||||
@ -446,6 +445,7 @@ class ProductFournisseur extends Product
|
|||||||
|
|
||||||
if (! $error && empty($conf->global->PRODUCT_PRICE_SUPPLIER_NO_LOG)) {
|
if (! $error && empty($conf->global->PRODUCT_PRICE_SUPPLIER_NO_LOG)) {
|
||||||
// Add record into log table
|
// 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);
|
$result = $this->logPrice($user, $now, $buyprice, $qty, $multicurrency_buyprice, $multicurrency_unitBuyPrice, $multicurrency_tx, $fk_multicurrenc, $multicurrency_code);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
@ -461,7 +461,6 @@ class ProductFournisseur extends Product
|
|||||||
|
|
||||||
if (empty($error)) {
|
if (empty($error)) {
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
$this->product_fourn_price_id = $idinserted;
|
|
||||||
return $this->product_fourn_price_id;
|
return $this->product_fourn_price_id;
|
||||||
} else {
|
} else {
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user