fix #20270 : use product_id in sql only if product_id is defined
This commit is contained in:
parent
a70d45b3ab
commit
744b84cb09
@ -1803,7 +1803,9 @@ class Product extends CommonObject
|
|||||||
$sql .= " ,pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code";
|
$sql .= " ,pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code";
|
||||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", pfp.packaging";
|
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", pfp.packaging";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
||||||
$sql .= " WHERE pfp.fk_product = ".$product_id;
|
$sql .= " WHERE 1=1";
|
||||||
|
if ($product_id != 0) { $sql .= " AND pfp.fk_product = '".$product_id."'";
|
||||||
|
}
|
||||||
if ($fourn_ref != 'none') { $sql .= " AND pfp.ref_fourn = '".$fourn_ref."'";
|
if ($fourn_ref != 'none') { $sql .= " AND pfp.ref_fourn = '".$fourn_ref."'";
|
||||||
}
|
}
|
||||||
if ($fk_soc > 0) { $sql .= " AND pfp.fk_soc = ".$fk_soc;
|
if ($fk_soc > 0) { $sql .= " AND pfp.fk_soc = ".$fk_soc;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user