Modif critère de recherche

This commit is contained in:
Rodolphe Quiedeville 2003-08-12 13:56:44 +00:00
parent 928bb29076
commit d0089fa74b

View File

@ -25,12 +25,6 @@ $user->getrights('produit');
if (!$user->rights->produit->lire) if (!$user->rights->produit->lire)
accessforbidden(); accessforbidden();
if (strlen($type) == 0)
{
$type = 0;
}
if ($action == 'update') if ($action == 'update')
{ {
$sql = "UPDATE llx_product SET description='$desc' where rowid = $rowid"; $sql = "UPDATE llx_product SET description='$desc' where rowid = $rowid";
@ -57,14 +51,28 @@ if ($sortorder == "")
} }
$sql = "SELECT p.rowid, p.label, p.price, p.ref FROM llx_product as p"; $sql = "SELECT p.rowid, p.label, p.price, p.ref FROM llx_product as p";
$sql .= " WHERE p.fk_product_type = $type";
if ($sref) if ($HTTP_POST_VARS["sall"])
{ {
$sql .= " AND lower(p.ref) like '%".strtolower($sref)."%'"; $sql .= " WHERE lower(p.ref) like '%".strtolower($sall)."%'";
$sql .= " OR lower(p.label) like '%".strtolower($sall)."%'";
} }
if ($snom) else
{ {
if (strlen($type) == 0)
{
$type = 0;
}
$sql .= " WHERE p.fk_product_type = $type";
if ($sref)
{
$sql .= " AND lower(p.ref) like '%".strtolower($sref)."%'";
}
if ($snom)
{
$sql .= " AND lower(p.label) like '%".strtolower($snom)."%'"; $sql .= " AND lower(p.label) like '%".strtolower($snom)."%'";
}
} }
$sql .= " ORDER BY $sortfield $sortorder "; $sql .= " ORDER BY $sortfield $sortorder ";