Ajout droits
This commit is contained in:
parent
b339466b2d
commit
ead6c895f7
@ -20,60 +20,75 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
require("./pre.inc.php3");
|
require("./pre.inc.php3");
|
||||||
|
$user->getrights('produit');
|
||||||
|
|
||||||
if (strlen($type) == 0)
|
if (strlen($type) == 0)
|
||||||
{
|
{
|
||||||
$type = 0;
|
$type = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$db = new Db();
|
|
||||||
|
|
||||||
if ($action == 'update')
|
if ($action == 'update')
|
||||||
{
|
{
|
||||||
$sql = "UPDATE llx_product SET description='$desc' where rowid = $rowid";
|
$sql = "UPDATE llx_product SET description='$desc' where rowid = $rowid";
|
||||||
$db->query($sql);
|
$db->query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($page == -1) {
|
/*
|
||||||
$page = 0 ;
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
if ($page == -1) {
|
||||||
|
$page = 0 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$limit = $conf->liste_limit;
|
||||||
|
$offset = $limit * $page ;
|
||||||
|
|
||||||
|
if ($sortfield == "")
|
||||||
|
{
|
||||||
|
$sortfield="p.tms";
|
||||||
|
}
|
||||||
|
if ($sortorder == "")
|
||||||
|
{
|
||||||
|
$sortorder="DESC";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT p.rowid, p.label, p.price, p.ref FROM llx_product as p";
|
||||||
|
$sql .= " WHERE p.fk_product_type = $type";
|
||||||
|
if ($sref)
|
||||||
|
{
|
||||||
|
$sql .= " AND lower(p.ref) like '%".strtolower($sref)."%'";
|
||||||
|
}
|
||||||
|
if ($snom)
|
||||||
|
{
|
||||||
|
$sql .= " AND lower(p.label) like '%".strtolower($snom)."%'";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($user->rights->produit->lire == 0)
|
||||||
|
{
|
||||||
|
// sécurité
|
||||||
|
$sql .= " AND 1 = 2";
|
||||||
}
|
}
|
||||||
|
|
||||||
$limit = $conf->liste_limit;
|
|
||||||
$offset = $limit * $page ;
|
|
||||||
|
|
||||||
if ($sortfield == "")
|
$sql .= " ORDER BY $sortfield $sortorder ";
|
||||||
{
|
$sql .= $db->plimit($limit + 1 ,$offset);
|
||||||
$sortfield="p.tms";
|
$result = $db->query($sql) ;
|
||||||
}
|
|
||||||
if ($sortorder == "")
|
|
||||||
{
|
|
||||||
$sortorder="DESC";
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "SELECT p.rowid, p.label, p.price, p.ref FROM llx_product as p";
|
if ($result)
|
||||||
$sql .= " WHERE p.fk_product_type = $type";
|
|
||||||
if ($sref)
|
|
||||||
{
|
|
||||||
$sql .= " AND lower(p.ref) like '%".strtolower($sref)."%'";
|
|
||||||
}
|
|
||||||
if ($snom)
|
|
||||||
{
|
|
||||||
$sql .= " AND lower(p.label) like '%".strtolower($snom)."%'";
|
|
||||||
}
|
|
||||||
$sql .= " ORDER BY $sortfield $sortorder ";
|
|
||||||
$sql .= $db->plimit($limit + 1 ,$offset);
|
|
||||||
|
|
||||||
if ( $db->query($sql) )
|
|
||||||
{
|
{
|
||||||
$num = $db->num_rows();
|
$num = $db->num_rows();
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
if ($num == 1)
|
if ($num == 1)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($i);
|
$objp = $db->fetch_object($i);
|
||||||
Header("Location: fiche.php3?id=$objp->rowid");
|
Header("Location: fiche.php3?id=$objp->rowid");
|
||||||
}
|
}
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
print_barre_liste("Liste des ".$types[$type]."s", $page, $PHP_SELF, "&sref=$sref&snom=$snom", $sortfield, $sortorder,'',$num);
|
print_barre_liste("Liste des ".$types[$type]."s", $page, $PHP_SELF, "&sref=$sref&snom=$snom", $sortfield, $sortorder,'',$num);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user