Fix: La fonction filtre des produits s'accorde bien avec la fonction tri.
This commit is contained in:
parent
09019c0df1
commit
1fe1256f24
@ -23,30 +23,29 @@
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\file htdocs/product/liste.php
|
\file htdocs/product/liste.php
|
||||||
\ingroup product
|
\ingroup produit
|
||||||
\brief Page liste des produits ou services
|
\brief Page liste des produits ou services
|
||||||
\version $Revision$
|
\version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
$user->getrights('produit');
|
|
||||||
|
|
||||||
$langs->load("products");
|
$langs->load("products");
|
||||||
|
|
||||||
|
$user->getrights('produit');
|
||||||
|
|
||||||
if (!$user->rights->produit->lire)
|
if (!$user->rights->produit->lire)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
/*
|
$sref=isset($_GET["sref"])?$_GET["sref"]:$_POST["sref"];
|
||||||
*
|
$snom=isset($_GET["snom"])?$_GET["snom"]:$_POST["snom"];
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
$type=$_GET["type"];
|
$type=isset($_GET["type"])?$_GET["type"]:$_POST["type"];
|
||||||
|
|
||||||
|
$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
|
||||||
|
$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
|
||||||
$page = $_GET["page"];
|
$page = $_GET["page"];
|
||||||
$sortfield = $_GET["sortfield"];
|
|
||||||
$sortorder = $_GET["sortorder"];
|
|
||||||
if ($page < 0) {
|
if ($page < 0) {
|
||||||
$page = 0 ; }
|
$page = 0 ; }
|
||||||
|
|
||||||
@ -61,13 +60,18 @@ if ($sortorder == "")
|
|||||||
$sortorder="DESC";
|
$sortorder="DESC";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($_POST["button_removefilter"] == $langs->trans("RemoveFilter")) {
|
||||||
|
$sref="";
|
||||||
|
$snom="";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mode Liste
|
* Mode Liste
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$title=$langs->trans("Products and Services");
|
$title=$langs->trans("ProductsAndServices");
|
||||||
|
|
||||||
$sql = "SELECT p.rowid, p.label, p.price, p.ref";
|
$sql = "SELECT p.rowid, p.label, p.price, p.ref";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
|
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||||
@ -89,15 +93,14 @@ else
|
|||||||
{
|
{
|
||||||
$type = 0;
|
$type = 0;
|
||||||
}
|
}
|
||||||
|
$sql .= " WHERE p.fk_product_type = ".$type;
|
||||||
$sql .= " WHERE p.fk_product_type = $type";
|
if ($sref)
|
||||||
if ($_POST["sref"])
|
|
||||||
{
|
{
|
||||||
$sql .= " AND p.ref like '%".$_POST["sref"]."%'";
|
$sql .= " AND p.ref like '%".$sref."%'";
|
||||||
}
|
}
|
||||||
if ($_POST["snom"])
|
if ($snom)
|
||||||
{
|
{
|
||||||
$sql .= " AND p.label like '%".$_POST["snom"]."%'";
|
$sql .= " AND p.label like '%".$snom."%'";
|
||||||
}
|
}
|
||||||
if (isset($_GET["envente"]) && strlen($_GET["envente"]) > 0)
|
if (isset($_GET["envente"]) && strlen($_GET["envente"]) > 0)
|
||||||
{
|
{
|
||||||
@ -124,7 +127,7 @@ if ($result)
|
|||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
if ($num == 1 && (isset($_POST["sall"]) or isset($_POST["snom"]) or isset($_POST["sref"])))
|
if ($num == 1 && (isset($_POST["sall"]) or $snom or $sref))
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($i);
|
$objp = $db->fetch_object($i);
|
||||||
Header("Location: fiche.php?id=$objp->rowid");
|
Header("Location: fiche.php?id=$objp->rowid");
|
||||||
@ -152,9 +155,9 @@ if ($result)
|
|||||||
|
|
||||||
llxHeader("","",$texte);
|
llxHeader("","",$texte);
|
||||||
|
|
||||||
if ($_POST["sref"] || $_POST["snom"] || $_POST["sall"] || $_POST["search"])
|
if ($sref || $snom || $_POST["sall"] || $_POST["search"])
|
||||||
{
|
{
|
||||||
print_barre_liste($texte, $page, "liste.php", "&sref=".$_POST["sref"]."&snom=".$_POST["snom"]."&envente=".$_POST["envente"], $sortfield, $sortorder,'',$num);
|
print_barre_liste($texte, $page, "liste.php", "&sref=".$sref."&snom=".$snom."&envente=".$_POST["envente"], $sortfield, $sortorder,'',$num);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -163,18 +166,31 @@ if ($result)
|
|||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
|
// Lignes des titres
|
||||||
print "<tr class=\"liste_titre\">";
|
print "<tr class=\"liste_titre\">";
|
||||||
print_liste_field_titre($langs->trans("Ref"),"liste.php", "p.ref","&envente=$envente&type=$type&fourn_id=$fourn_id");
|
print_liste_field_titre($langs->trans("Ref"),"liste.php", "p.ref","&envente=$envente&type=$type&fourn_id=$fourn_id&snom=$snom&sref=$sref","","",$sortfield);
|
||||||
print_liste_field_titre($langs->trans("Label"),"liste.php", "p.label","&envente=$envente&type=$type&fourn_id=$fourn_id");
|
print_liste_field_titre($langs->trans("Label"),"liste.php", "p.label","&envente=$envente&type=$type&fourn_id=$fourn_id&snom=$snom&sref=$sref","","",$sortfield);
|
||||||
print_liste_field_titre($langs->trans("SellingPrice"),"liste.php", "p.price","&envente=$envente&type=$type&fourn_id=$fourn_id","",'align=\"right\"');
|
print_liste_field_titre($langs->trans("SellingPrice"),"liste.php", "p.price","&envente=$envente&type=$type&fourn_id=$fourn_id&snom=$snom&sref=$sref","",'align="right"',$sortfield);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
// Lignes des champs de filtre
|
||||||
|
print '<form action="liste.php" method="post">';
|
||||||
|
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||||
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
|
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<form action="liste.php?type='.$type.'" method="post">';
|
print '<td>';
|
||||||
print '<td><input class="flat" type="text" size="10" name="sref"> <input class="flat" type="submit" value="'.$langs->trans("Go").'"></td>';
|
print '<input class="fat" type="text" name="sref" value="'.$sref.'">';
|
||||||
print '</form><form action="liste.php" method="post">';
|
print '</td>';
|
||||||
print '<td><input class="flat" type="text" size="20" name="snom"> <input class="flat" type="submit" value="'.$langs->trans("Go").'"></td>';
|
print '<td valign="right">';
|
||||||
print '</form><td> </td></tr>';
|
print '<input class="fat" type="text" name="snom" value="'.$snom.'">';
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="center">';
|
||||||
|
print '<input type="submit" class="button" name="button_search" value="'.$langs->trans("Search").'">';
|
||||||
|
print ' <input type="submit" class="button" name="button_removefilter" value="'.$langs->trans("RemoveFilter").'">';
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
print '</form>';
|
||||||
|
|
||||||
|
|
||||||
$var=True;
|
$var=True;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user