FIX : product_fourn_price_id was assigned too late for logPrice() function

This commit is contained in:
gauthier 2019-12-13 14:55:39 +01:00
parent c72e7e6a97
commit cc1454c8d5

View File

@ -434,11 +434,9 @@ 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;
$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++;
@ -461,7 +459,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();