La recherche raccourci sur les produits regarde aussi dans la description et les notes
This commit is contained in:
parent
8771bf5528
commit
b01402bcf0
@ -18,7 +18,6 @@
|
|||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
* $Source$
|
* $Source$
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -55,9 +54,12 @@ print '<table class="noborder" width="100%">';
|
|||||||
print "<tr class=\"liste_titre\">";
|
print "<tr class=\"liste_titre\">";
|
||||||
print '<td colspan="3">'.$langs->trans("Search").'</td></tr>';
|
print '<td colspan="3">'.$langs->trans("Search").'</td></tr>';
|
||||||
print "<tr $bc[0]><td>";
|
print "<tr $bc[0]><td>";
|
||||||
print $langs->trans("Ref").':</td><td><input class="flat" type="text" size="18" name="sref"></td><td><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>';
|
print $langs->trans("Ref").':</td><td><input class="flat" type="text" size="18" name="sref"></td>';
|
||||||
|
print '<td rowspan="2"><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>';
|
||||||
print "<tr $bc[0]><td>";
|
print "<tr $bc[0]><td>";
|
||||||
print $langs->trans("Label").':</td><td><input class="flat" type="text" size="18" name="snom"></td><td><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>';
|
print $langs->trans("Other").':</td><td><input class="flat" type="text" size="18" name="sall"></td>';
|
||||||
|
//print '<td><input type="submit" class="button" value="'.$langs->trans("Search").'"></td>';
|
||||||
|
print '</tr>';
|
||||||
print "</table></form><br>";
|
print "</table></form><br>";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,6 @@
|
|||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
* $Source$
|
* $Source$
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -40,24 +39,25 @@ if (!$user->rights->produit->lire)
|
|||||||
|
|
||||||
$sref=isset($_GET["sref"])?$_GET["sref"]:$_POST["sref"];
|
$sref=isset($_GET["sref"])?$_GET["sref"]:$_POST["sref"];
|
||||||
$snom=isset($_GET["snom"])?$_GET["snom"]:$_POST["snom"];
|
$snom=isset($_GET["snom"])?$_GET["snom"]:$_POST["snom"];
|
||||||
|
$sall=isset($_GET["sall"])?$_GET["sall"]:$_POST["sall"];
|
||||||
|
|
||||||
$type=isset($_GET["type"])?$_GET["type"]:$_POST["type"];
|
$type=isset($_GET["type"])?$_GET["type"]:$_POST["type"];
|
||||||
|
|
||||||
$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
|
$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
|
||||||
$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
|
$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
|
||||||
|
if (! $sortfield) $sortfield="p.ref";
|
||||||
|
if (! $sortorder) $sortorder="DESC";
|
||||||
$page = $_GET["page"];
|
$page = $_GET["page"];
|
||||||
|
|
||||||
$limit = $conf->liste_limit;
|
$limit = $conf->liste_limit;
|
||||||
$offset = $limit * $page ;
|
$offset = $limit * $page ;
|
||||||
|
|
||||||
if (! $sortfield) $sortfield="p.ref";
|
if (isset($_POST["button_removefilter_x"]))
|
||||||
if (! $sortorder) $sortorder="DESC";
|
{
|
||||||
|
|
||||||
if (isset($_POST["button_removefilter_x"])) {
|
|
||||||
$sref="";
|
$sref="";
|
||||||
$snom="";
|
$snom="";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mode Liste
|
* Mode Liste
|
||||||
*
|
*
|
||||||
@ -70,40 +70,35 @@ $sql.= ' FROM '.MAIN_DB_PREFIX.'product as p';
|
|||||||
|
|
||||||
if ($_GET["fourn_id"] > 0)
|
if ($_GET["fourn_id"] > 0)
|
||||||
{
|
{
|
||||||
$fourn_id = $_GET["fourn_id"];
|
$fourn_id = $_GET["fourn_id"];
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."product_fournisseur as pf";
|
$sql .= ", ".MAIN_DB_PREFIX."product_fournisseur as pf";
|
||||||
}
|
}
|
||||||
|
$sql .= " WHERE 1=1";
|
||||||
if ($_POST["mode"] == 'search')
|
if ($sall)
|
||||||
{
|
{
|
||||||
$sql .= " WHERE p.ref like '%".$_POST["sall"]."%'";
|
$sql .= " AND (p.label like '%".$sall."%' OR p.description like '%".$sall."%' OR p.note like '%".$sall."%')";
|
||||||
$sql .= " OR p.label like '%".$_POST["sall"]."%'";
|
}
|
||||||
|
if (strlen($_GET["type"]) || strlen($_POST["type"]))
|
||||||
|
{
|
||||||
|
$sql .= " AND p.fk_product_type = ".(strlen($_GET["type"])?$_GET["type"]:$_POST["type"]);
|
||||||
|
}
|
||||||
|
if ($sref)
|
||||||
|
{
|
||||||
|
$sql .= " AND p.ref like '%".$sref."%'";
|
||||||
|
}
|
||||||
|
if ($snom)
|
||||||
|
{
|
||||||
|
$sql .= " AND p.label like '%".$snom."%'";
|
||||||
|
}
|
||||||
|
if (isset($_GET["envente"]) && strlen($_GET["envente"]) > 0)
|
||||||
|
{
|
||||||
|
$sql .= " AND p.envente = ".$_GET["envente"];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql .= " WHERE 1=1";
|
if ($fourn_id == 0)
|
||||||
if (strlen($_GET["type"]) || strlen($_POST["type"]))
|
|
||||||
{
|
{
|
||||||
$sql .= " AND p.fk_product_type = ".(strlen($_GET["type"])?$_GET["type"]:$_POST["type"]);
|
$sql .= " AND p.envente = 1";
|
||||||
}
|
|
||||||
if ($sref)
|
|
||||||
{
|
|
||||||
$sql .= " AND p.ref like '%".$sref."%'";
|
|
||||||
}
|
|
||||||
if ($snom)
|
|
||||||
{
|
|
||||||
$sql .= " AND p.label like '%".$snom."%'";
|
|
||||||
}
|
|
||||||
if (isset($_GET["envente"]) && strlen($_GET["envente"]) > 0)
|
|
||||||
{
|
|
||||||
$sql .= " AND p.envente = ".$_GET["envente"];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ($fourn_id == 0)
|
|
||||||
{
|
|
||||||
$sql .= " AND p.envente = 1";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user