Fix bug #933: Ajax error

Caused by commit 7e53f98
This commit is contained in:
Marcos García 2013-06-08 22:29:18 +02:00
parent c8a634fa08
commit f0454926c2
2 changed files with 3 additions and 5 deletions

View File

@ -1307,9 +1307,8 @@ class Form
} }
if (strval($filtertype) != '') $sql.=" AND p.fk_product_type=".$filtertype; if (strval($filtertype) != '') $sql.=" AND p.fk_product_type=".$filtertype;
// Add criteria on ref/label // Add criteria on ref/label
if ($filterkey && $filterkey != '') if ($filterkey != '')
{ {
$sql.=" AND (";
if (! empty($conf->global->PRODUCT_DONOTSEARCH_ANYWHERE)) // Can use index if (! empty($conf->global->PRODUCT_DONOTSEARCH_ANYWHERE)) // Can use index
{ {
$sql.=" AND (p.ref LIKE '".$filterkey."%' OR p.label LIKE '".$filterkey."%'"; $sql.=" AND (p.ref LIKE '".$filterkey."%' OR p.label LIKE '".$filterkey."%'";
@ -1331,7 +1330,6 @@ class Form
{ {
$sql .= " OR p.barcode LIKE '".$filterkey."'"; $sql .= " OR p.barcode LIKE '".$filterkey."'";
} }
$sql.=")";
} }
$sql.= $db->order("p.ref"); $sql.= $db->order("p.ref");
$sql.= $db->plimit($limit); $sql.= $db->plimit($limit);

View File

@ -157,11 +157,11 @@ else
$form = new Form($db); $form = new Form($db);
if (empty($mode) || $mode == 1) 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) 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(); $db->close();