diff --git a/htdocs/product/stock/index.php b/htdocs/product/stock/index.php index 409362a0039..8eb52f5206c 100644 --- a/htdocs/product/stock/index.php +++ b/htdocs/product/stock/index.php @@ -18,7 +18,6 @@ * * $Id$ * $Source$ - * */ /** @@ -40,28 +39,26 @@ if (!$user->rights->stock->lire) llxHeader("","",$langs->trans("Stocks")); -print_titre($langs->trans("StocksArea")); -print '
'; +print_fiche_titre($langs->trans("StocksArea")); - -print ''; -print '
'; +print ''; +print '
'; /* * Zone recherche entrepot */ -print '
'; +print ''; print ''; print ""; print ''; print "'; +print $langs->trans("Ref").':'; +print "'; print "
'.$langs->trans("Search").'
"; -print $langs->trans("Ref").' :
".$langs->trans("Other").':

"; - $sql = "SELECT e.label, e.rowid, e.statut FROM ".MAIN_DB_PREFIX."entrepot as e"; $sql .= " ORDER BY e.statut DESC "; $sql .= $db->plimit(15 ,0); @@ -101,12 +98,12 @@ else dolibarr_print_error($db); } -print '
'; +print ''; print '
'; $db->close(); -llxFooter("Dernière modification $Date$ révision $Revision$"); +llxFooter('$Date$ - $Revision$'); ?> diff --git a/htdocs/product/stock/liste.php b/htdocs/product/stock/liste.php index 22c3d72e317..ed3aead6e6c 100644 --- a/htdocs/product/stock/liste.php +++ b/htdocs/product/stock/liste.php @@ -18,7 +18,6 @@ * * $Id$ * $Source$ - * */ /** @@ -37,25 +36,35 @@ $langs->load("stocks"); if (!$user->rights->stock->lire) accessforbidden(); +$sref=isset($_GET["sref"])?$_GET["sref"]:$_POST["sref"]; +$snom=isset($_GET["snom"])?$_GET["snom"]:$_POST["snom"]; +$sall=isset($_GET["sall"])?$_GET["sall"]:$_POST["sall"]; +$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"]; +$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"]; +if (! $sortfield) $sortfield="e.label"; +if (! $sortorder) $sortorder="ASC"; $page = $_GET["page"]; -$sortfield = $_GET["sortfield"]; -$sortorder = $_GET["sortorder"]; - if ($page < 0) $page = 0; $limit = $conf->liste_limit; $offset = $limit * $page; -if (! $sortfield) $sortfield="e.label"; -if (! $sortorder) $sortorder="ASC"; - $sql = "SELECT e.rowid as ref, e.label, e.statut, e.lieu, e.address, e.cp, e.ville, e.fk_pays"; $sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e"; +$sql .= " WHERE 1=1"; +if ($sref) +{ + $sql .= " AND e.ref like '%".$sref."%'"; +} +if ($sall) +{ + $sql .= " AND (e.label like '%".$sall."%' OR e.description like '%".$sall."%' OR e.lieu like '%".$sall."%' OR e.address like '%".$sall."%' OR e.ville like '%".$sall."%')"; +} $sql .= " ORDER BY $sortfield $sortorder"; $sql .= $db->plimit($limit + 1 ,$offset); -$result = $db->query($sql) ; +$result = $db->query($sql) ; if ($result) { $num = $db->num_rows($result); @@ -104,5 +113,5 @@ else $db->close(); -llxFooter("Dernière modification $Date$ révision $Revision$"); +llxFooter('$Date$ - $Revision$'); ?>