La recherche raccourci sur les stocks regarde aussi dans le label et descirption de l'entrepot.

This commit is contained in:
Laurent Destailleur 2005-08-31 21:29:03 +00:00
parent 51b8ef37c6
commit e6a40f6972
2 changed files with 26 additions and 20 deletions

View File

@ -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&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
llxFooter('$Date$ - $Revision$');
?>

View File

@ -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&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
llxFooter('$Date$ - $Revision$');
?>