Merge pull request #7446 from hregis/6.0_bug3

Fix: wrong supplier product price id
This commit is contained in:
Laurent Destailleur 2017-09-20 17:31:10 +02:00 committed by GitHub
commit 7706020805
3 changed files with 6 additions and 4 deletions

View File

@ -1414,7 +1414,7 @@ class CommandeFournisseur extends CommonOrder
if ($remise_percent == 0 && $prod->remise_percent !=0) if ($remise_percent == 0 && $prod->remise_percent !=0)
$remise_percent =$prod->remise_percent; $remise_percent =$prod->remise_percent;
} }
if ($result == 0) // If result == 0, we failed to found the supplier reference price if ($result == 0) // If result == 0, we failed to found the supplier reference price
{ {
@ -2678,14 +2678,14 @@ class CommandeFournisseur extends CommonOrder
if ($db->num_rows($query)) if ($db->num_rows($query))
{ {
$obj = $db->fetch_object($query); $obj = $db->fetch_object($query);
$string = $langs->trans($obj->code); $string = $langs->trans($obj->code);
if ($string == $obj->code) if ($string == $obj->code)
{ {
$string = $obj->label != '-' ? $obj->label : ''; $string = $obj->label != '-' ? $obj->label : '';
} }
return $string; return $string;
} }
} }
else dol_print_error($db); else dol_print_error($db);
} }

View File

@ -409,7 +409,7 @@ if (empty($reshook))
$localtax1_tx, $localtax1_tx,
$localtax2_tx, $localtax2_tx,
$idprod, $idprod,
$productsupplier->id, $productsupplier->product_fourn_price_id,
$productsupplier->fourn_ref, $productsupplier->fourn_ref,
$remise_percent, $remise_percent,
'HT', 'HT',

View File

@ -1532,6 +1532,7 @@ class Product extends CommonObject
$obj->price = $price_result; $obj->price = $price_result;
} }
} }
$this->product_fourn_price_id = $obj->rowid;
$this->buyprice = $obj->price; // deprecated $this->buyprice = $obj->price; // deprecated
$this->fourn_pu = $obj->price / $obj->quantity; // Unit price of product of supplier $this->fourn_pu = $obj->price / $obj->quantity; // Unit price of product of supplier
$this->fourn_price_base_type = 'HT'; // Price base type $this->fourn_price_base_type = 'HT'; // Price base type
@ -1577,6 +1578,7 @@ class Product extends CommonObject
$obj->price = $price_result; $obj->price = $price_result;
} }
} }
$this->product_fourn_price_id = $obj->rowid;
$this->buyprice = $obj->price; // deprecated $this->buyprice = $obj->price; // deprecated
$this->fourn_qty = $obj->quantity; // min quantity for price for a virtual supplier $this->fourn_qty = $obj->quantity; // min quantity for price for a virtual supplier
$this->fourn_pu = $obj->price / $obj->quantity; // Unit price of product for a virtual supplier $this->fourn_pu = $obj->price / $obj->quantity; // Unit price of product for a virtual supplier