From 2dc987b86f70dbf2986ad818ebe72867f907bc68 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 14 Sep 2005 23:57:05 +0000 Subject: [PATCH] =?UTF-8?q?Fix:=20Recherche=20sur=20r=E9f=E9rence=20produi?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/product/liste.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index e377276ef23..a003de11ac2 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -40,8 +40,11 @@ if (!$user->rights->produit->lire) $sref=isset($_GET["sref"])?$_GET["sref"]:$_POST["sref"]; $snom=isset($_GET["snom"])?$_GET["snom"]:$_POST["snom"]; $sall=isset($_GET["sall"])?$_GET["sall"]:$_POST["sall"]; - $type=isset($_GET["type"])?$_GET["type"]:$_POST["type"]; +$sref=trim($sref); +$snom=trim($snom); +$sall=trim($sall); +$type=trim($type); $sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"]; $sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"]; @@ -65,7 +68,7 @@ if (isset($_POST["button_removefilter_x"])) $title=$langs->trans("ProductsAndServices"); -$sql = 'SELECT p.rowid, p.label, p.price, p.ref, p.fk_product_type, '.$db->pdate('p.tms').' as datem'; +$sql = 'SELECT p.rowid, p.ref, p.label, p.price, p.fk_product_type, '.$db->pdate('p.tms').' as datem'; $sql.= ' FROM '.MAIN_DB_PREFIX.'product as p'; if ($_GET["fourn_id"] > 0) @@ -76,7 +79,7 @@ if ($_GET["fourn_id"] > 0) $sql .= " WHERE 1=1"; if ($sall) { - $sql .= " AND (p.label like '%".$sall."%' OR p.description like '%".$sall."%' OR p.note like '%".$sall."%')"; + $sql .= " AND (p.ref like '%".$sall."%' OR p.label like '%".$sall."%' OR p.description like '%".$sall."%' OR p.note like '%".$sall."%')"; } if (strlen($_GET["type"]) || strlen($_POST["type"])) { @@ -101,12 +104,10 @@ else $sql .= " AND p.envente = 1"; } } - if ($fourn_id > 0) { $sql .= " AND p.rowid = pf.fk_product AND pf.fk_soc = $fourn_id"; } - $sql .= " ORDER BY $sortfield $sortorder "; $sql .= $db->plimit($limit + 1 ,$offset); $resql = $db->query($sql) ;