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

Merge pull request #5889 from atm-gauthier/NEW_filter_socid_on_find_min_price_product_fournisseur

FIX param socid so find_min_price_product_fournisseur() use correct thirdparty when we create supplierorder from supplierproposal
parents 024c0501 7d639251
No related branches found
No related tags found
No related merge requests found
...@@ -521,9 +521,10 @@ class ProductFournisseur extends Product ...@@ -521,9 +521,10 @@ class ProductFournisseur extends Product
* *
* @param int $prodid Product id * @param int $prodid Product id
* @param int $qty Minimum quantity * @param int $qty Minimum quantity
* @param int $socid get min price for specific supplier
* @return int <0 if KO, 0=Not found of no product id provided, >0 if OK * @return int <0 if KO, 0=Not found of no product id provided, >0 if OK
*/ */
function find_min_price_product_fournisseur($prodid, $qty=0) function find_min_price_product_fournisseur($prodid, $qty=0, $socid=0)
{ {
global $conf; global $conf;
...@@ -556,6 +557,7 @@ class ProductFournisseur extends Product ...@@ -556,6 +557,7 @@ class ProductFournisseur extends Product
$sql.= " AND pfp.fk_soc = s.rowid"; $sql.= " AND pfp.fk_soc = s.rowid";
$sql.= " AND s.status = 1"; // only enabled society $sql.= " AND s.status = 1"; // only enabled society
if ($qty > 0) $sql.= " AND pfp.quantity <= ".$qty; if ($qty > 0) $sql.= " AND pfp.quantity <= ".$qty;
if ($socid > 0) $sql.= ' AND pfp.fk_soc = '.$socid;
dol_syslog(get_class($this)."::find_min_price_product_fournisseur", LOG_DEBUG); dol_syslog(get_class($this)."::find_min_price_product_fournisseur", LOG_DEBUG);
......
...@@ -1059,7 +1059,7 @@ if (empty($reshook)) ...@@ -1059,7 +1059,7 @@ if (empty($reshook))
$array_option = $lines[$i]->array_options; $array_option = $lines[$i]->array_options;
} }
$result = $productsupplier->find_min_price_product_fournisseur($lines[$i]->fk_product, $lines[$i]->qty); $result = $productsupplier->find_min_price_product_fournisseur($lines[$i]->fk_product, $lines[$i]->qty, $srcobject->socid);
if ($result>=0) if ($result>=0)
{ {
$tva_tx = $lines[$i]->tva_tx; $tva_tx = $lines[$i]->tva_tx;
......
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