Skip to content

Commit

Permalink
FIX ref_supplier was not set. We also refered to old var names.
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed May 5, 2016
1 parent 8a8e7cd commit c795803
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
4 changes: 3 additions & 1 deletion htdocs/fourn/class/fournisseur.product.class.php
Expand Up @@ -613,7 +613,9 @@ function find_min_price_product_fournisseur($prodid, $qty=0)
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"];
Expand Down
31 changes: 18 additions & 13 deletions htdocs/fourn/commande/card.php
Expand Up @@ -984,17 +984,16 @@
// 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;

Expand Down Expand Up @@ -1056,11 +1055,17 @@
}

$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,
Expand All @@ -1070,7 +1075,7 @@
$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,
Expand Down

0 comments on commit c795803

Please sign in to comment.