diff --git a/htdocs/product/stock/index.php b/htdocs/product/stock/index.php index 409362a00390ca53dfac8ccdf1bbbfc463f7cd0f..8eb52f5206c545a1de1eb3774b9e3f7ca226d75e 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 '<br>'; - +print_fiche_titre($langs->trans("StocksArea")); -print '<table class="noborder" width="100%">'; -print '<tr><td valign="top" width="30%">'; +print '<table border="0" width="100%" class="notopnoleftnoright">'; +print '<tr><td valign="top" width="30%" class="notopnoleft">'; /* * Zone recherche entrepot */ -print '<form method="post" action="liste.php">'; +print '<form method="post" action="'.DOL_URL_ROOT.'/product/stock/liste.php">'; print '<table class="noborder" width="100%">'; print "<tr class=\"liste_titre\">"; print '<td colspan="3">'.$langs->trans("Search").'</td></tr>'; print "<tr $bc[0]><td>"; -print $langs->trans("Ref").' :</td><td><input class="flat" type="text" size="20" name="sf_ref"></td><td><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>'; +print $langs->trans("Ref").':</td><td><input class="flat" type="text" size="18" name="sf_ref"></td><td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>'; +print "<tr $bc[0]><td>".$langs->trans("Other").':</td><td><input type="text" name="sall" class="flat" size="18"></td>'; print "</table></form><br>"; - $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 '</td><td valign="top" width="70%">'; +print '</td><td valign="top" width="70%" class="notopnoleft">'; print '</td></tr></table>'; $db->close(); -llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>"); +llxFooter('$Date$ - $Revision$'); ?> diff --git a/htdocs/product/stock/liste.php b/htdocs/product/stock/liste.php index 22c3d72e3177620adc1448add44cad58a87ddaf0..ed3aead6e6cef4d53cad835297d9cef3b875710e 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("<em>Dernière modification $Date$ révision $Revision$</em>"); +llxFooter('$Date$ - $Revision$'); ?>