diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 8e28e77d185..c03de343489 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -2654,7 +2654,7 @@ class Form
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON pfp.fk_soc = s.rowid";
- $sql.= " WHERE pfp.entity IN (".getEntity('productprice').")";
+ $sql.= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")";
$sql.= " AND p.tobuy = 1";
$sql.= " AND s.fournisseur = 1";
$sql.= " AND p.rowid = ".$productid;
diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php
index 050d2867cf4..5c50597195a 100644
--- a/htdocs/fourn/class/fournisseur.product.class.php
+++ b/htdocs/fourn/class/fournisseur.product.class.php
@@ -530,7 +530,7 @@ class ProductFournisseur extends Product
$sql.= " ,pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code";
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
- $sql.= " WHERE pfp.entity IN (".getEntity('productprice').")";
+ $sql.= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")";
$sql.= " AND pfp.fk_soc = s.rowid";
$sql.= " AND s.status=1"; // only enabled company selected
$sql.= " AND pfp.fk_product = ".$prodid;
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 7d7cbf7c282..c271346d4bc 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -3081,7 +3081,7 @@ class Product extends CommonObject
$sql.= " WHERE fk_soc = ".$id_fourn;
$sql.= " AND ref_fourn = '".$this->db->escape($ref_fourn)."'";
$sql.= " AND fk_product != ".$this->id;
- $sql.= " AND entity IN (".getEntity('productprice').")";
+ $sql.= " AND entity IN (".getEntity('productsupplierprice').")";
$resql=$this->db->query($sql);
if ($resql)
@@ -3104,7 +3104,7 @@ class Product extends CommonObject
else $sql.= " AND (ref_fourn = '' OR ref_fourn IS NULL)";
$sql.= " AND quantity = '".$quantity."'";
$sql.= " AND fk_product = ".$this->id;
- $sql.= " AND entity IN (".getEntity('productprice').")";
+ $sql.= " AND entity IN (".getEntity('productsupplierprice').")";
$resql=$this->db->query($sql);
if ($resql)
diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php
index 5b41cb0f02b..fdff7b1fe6d 100644
--- a/htdocs/product/class/productcustomerprice.class.php
+++ b/htdocs/product/class/productcustomerprice.class.php
@@ -341,7 +341,8 @@ class Productcustomerprice extends CommonObject
$sql .= " WHERE soc.rowid=t.fk_soc ";
$sql .= " AND prod.rowid=t.fk_product ";
$sql .= " AND prod.entity IN (" . getEntity('product') . ")";
-
+ $sql .= " AND t.entity IN (" . getEntity('productprice') . ")";
+
// Manage filter
if (count($filter) > 0) {
foreach ( $filter as $key => $value ) {
@@ -450,6 +451,7 @@ class Productcustomerprice extends CommonObject
$sql .= " WHERE soc.rowid=t.fk_soc ";
$sql .= " AND prod.rowid=t.fk_product ";
$sql .= " AND prod.entity IN (" . getEntity('product') . ")";
+ $sql .= " AND t.entity IN (" . getEntity('productprice') . ")";
// Manage filter
if (count($filter) > 0) {
diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php
index 7c15b3fa7c5..874d5676e1f 100644
--- a/htdocs/product/stock/productlot_list.php
+++ b/htdocs/product/stock/productlot_list.php
@@ -218,7 +218,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."product_lot as t";
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_lot_extrafields as ef on (t.rowid = ef.fk_object)";
$sql.= ", ".MAIN_DB_PREFIX."product as p";
$sql.= " WHERE p.rowid = t.fk_product";
-//$sql.= " WHERE u.entity IN (".getEntity('productlot').")";
+$sql.= " WHERE p.entity IN (".getEntity('product').")";
if ($search_entity) $sql.= natural_search("entity",$search_entity);
if ($search_product) $sql.= natural_search("p.ref",$search_product);