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
This commit is contained in:
commit
b5b76dfaf7
@ -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
|
|||||||
$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))
|
|||||||
$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;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user