From 50bc28e75b851eb4f8771cc9e9c647cd7300edb7 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Mon, 11 Aug 2003 19:13:05 +0000 Subject: [PATCH] Gestion du module de recherche --- htdocs/product/index.php3 | 45 ++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/htdocs/product/index.php3 b/htdocs/product/index.php3 index 17509c0cc88..0641ef1f028 100644 --- a/htdocs/product/index.php3 +++ b/htdocs/product/index.php3 @@ -42,33 +42,30 @@ if ($action == 'update') * */ +if ($page < 0) { + $page = 0 ; } - if ($page == -1) { - $page = 0 ; - } - - $limit = $conf->liste_limit; - $offset = $limit * $page ; +$limit = $conf->liste_limit; +$offset = $limit * $page ; - if ($sortfield == "") - { - $sortfield="p.tms"; - } - if ($sortorder == "") - { - $sortorder="DESC"; - } +if ($sortfield == "") { + $sortfield="p.tms"; } + +if ($sortorder == "") +{ + $sortorder="DESC"; +} - $sql = "SELECT p.rowid, p.label, p.price, p.ref FROM llx_product as p"; - $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 = "SELECT p.rowid, p.label, p.price, p.ref FROM llx_product as p"; +$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 .= " ORDER BY $sortfield $sortorder "; $sql .= $db->plimit($limit + 1 ,$offset);