Skip to content
Snippets Groups Projects
Commit c795803d authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

FIX ref_supplier was not set. We also refered to old var names.

parent 8a8e7cdf
No related branches found
No related tags found
No related merge requests found
......@@ -613,7 +613,9 @@ class ProductFournisseur extends Product
if ($fourn_unitprice < $min || $min == -1)
{
$this->product_fourn_price_id = $record["product_fourn_price_id"];
$this->fourn_ref = $record["ref_fourn"];
$this->ref_supplier = $record["ref_fourn"];
$this->ref_fourn = $record["ref_fourn"]; // deprecated
$this->fourn_ref = $record["ref_fourn"]; // deprecated
$this->fourn_price = $fourn_price;
$this->fourn_qty = $record["quantity"];
$this->fourn_remise_percent = $record["remise_percent"];
......
......@@ -984,17 +984,16 @@ if (empty($reshook))
// If creation from another object of another module (Example: origin=propal, originid=1)
if (! empty($origin) && ! empty($originid))
{
if ($origin == 'order' || $origin == 'commande') {
if ($origin == 'order' || $origin == 'commande')
{
$element = $subelement = 'commande';
}
elseif ($origin =='supplier_proposal'){
else
{
$element = 'supplier_proposal';
$subelement = 'supplier_proposal';
}
else {
$element = 'comm/askpricesupplier';
$subelement = 'askpricesupplier';
}
}
$object->origin = $origin;
$object->origin_id = $originid;
......@@ -1056,11 +1055,17 @@ if (empty($reshook))
}
$result = $productsupplier->find_min_price_product_fournisseur($lines[$i]->fk_product, $lines[$i]->qty);
if ($result>0) {
$productsupplier->fetch($productsupplier->id);
$soc=new societe($db);
$soc->fetch($socid);
$tva_tx=($origin=="commande")?get_default_tva($soc,$mysoc,$lines[$i]->fk_product,$idprod):$lines[$i]->tva_tx;
if ($result>0)
{
$tva_tx = $lines[$i]->tva_tx;
if ($origin=="commande")
{
$soc=new societe($db);
$soc->fetch($socid);
$tva_tx=get_default_tva($soc, $mysoc, $lines[$i]->fk_product, $productsupplier->product_fourn_price_id);
}
$result = $object->addline(
$desc,
$lines[$i]->subprice,
......@@ -1070,7 +1075,7 @@ if (empty($reshook))
$lines[$i]->localtax2_tx,
$lines[$i]->fk_product,
$productsupplier->product_fourn_price_id,
$productsupplier->ref_fourn,
$productsupplier->ref_supplier,
$lines[$i]->remise_percent,
'HT',
0,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment