diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 0ed4a1ad80a..687a59dedab 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -1307,9 +1307,8 @@ class Form
}
if (strval($filtertype) != '') $sql.=" AND p.fk_product_type=".$filtertype;
// Add criteria on ref/label
- if ($filterkey && $filterkey != '')
+ if ($filterkey != '')
{
- $sql.=" AND (";
if (! empty($conf->global->PRODUCT_DONOTSEARCH_ANYWHERE)) // Can use index
{
$sql.=" AND (p.ref LIKE '".$filterkey."%' OR p.label LIKE '".$filterkey."%'";
@@ -1331,7 +1330,6 @@ class Form
{
$sql .= " OR p.barcode LIKE '".$filterkey."'";
}
- $sql.=")";
}
$sql.= $db->order("p.ref");
$sql.= $db->plimit($limit);
diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php
index 3fed5d5152c..61ef111bddf 100644
--- a/htdocs/product/ajax/products.php
+++ b/htdocs/product/ajax/products.php
@@ -157,11 +157,11 @@ else
$form = new Form($db);
if (empty($mode) || $mode == 1)
{
- $arrayresult=$form->select_produits_do("",$htmlname,$type,"",$price_level,$searchkey,$status,2,$outjson);
+ $arrayresult=$form->select_produits_list("",$htmlname,$type,"",$price_level,$searchkey,$status,2,$outjson);
}
elseif ($mode == 2)
{
- $arrayresult=$form->select_produits_fournisseurs_do($socid,"",$htmlname,$type,"",$searchkey,$status,$outjson);
+ $arrayresult=$form->select_produits_fournisseurs_list($socid,"",$htmlname,$type,"",$searchkey,$status,$outjson);
}
$db->close();