Fix missing vars in fetch_product_fournisseur_price

This commit is contained in:
Ion Agorria 2016-02-11 20:02:06 +01:00
parent e67be201ed
commit 1a45ab9d50

View File

@ -51,6 +51,7 @@ class ProductFournisseur extends Product
var $ref_supplier; // ref supplier (can be set by get_buyprice)
var $vatrate_supplier; // default vat rate for this supplier/qty/product (can be set by get_buyprice)
var $fourn_id; //supplier id
var $fourn_qty; // quantity for price (can be set by get_buyprice)
var $fourn_pu; // unit price for quantity (can be set by get_buyprice)
@ -354,7 +355,7 @@ class ProductFournisseur extends Product
*/
function fetch_product_fournisseur_price($rowid, $ignore_expression = 0)
{
$sql = "SELECT pfp.rowid, pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability,";
$sql = "SELECT pfp.rowid, s.rowid as fourn_id, pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability,";
$sql.= " pfp.fk_soc, pfp.ref_fourn, pfp.fk_product, pfp.charges, pfp.unitcharges, pfp.fk_supplier_price_expression, pfp.delivery_time_days"; // , pfp.recuperableonly as fourn_tva_npr"; FIXME this field not exist in llx_product_fournisseur_price
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
$sql.= " WHERE pfp.rowid = ".$rowid;
@ -367,6 +368,7 @@ class ProductFournisseur extends Product
if ($obj)
{
$this->product_fourn_price_id = $rowid;
$this->fourn_id = $obj->fourn_id;
$this->fourn_ref = $obj->ref_fourn; // deprecated
$this->ref_supplier = $obj->ref_fourn;
$this->fourn_price = $obj->price;
@ -379,6 +381,7 @@ class ProductFournisseur extends Product
$this->fourn_tva_tx = $obj->tva_tx;
$this->product_id = $obj->fk_product; // deprecated
$this->fk_product = $obj->fk_product;
$this->id = $obj->fk_product;
$this->fk_availability = $obj->fk_availability;
$this->delivery_time_days = $obj->delivery_time_days;
//$this->fourn_tva_npr = $obj->fourn_tva_npr; // TODO this field not exist in llx_product_fournisseur_price. We should add it ?