Ajout droits

This commit is contained in:
Rodolphe Quiedeville 2003-08-06 12:07:24 +00:00
parent b339466b2d
commit ead6c895f7

View File

@ -20,52 +20,67 @@
* *
*/ */
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) { /*
*
*
*/
if ($page == -1) {
$page = 0 ; $page = 0 ;
} }
$limit = $conf->liste_limit; $limit = $conf->liste_limit;
$offset = $limit * $page ; $offset = $limit * $page ;
if ($sortfield == "") if ($sortfield == "")
{ {
$sortfield="p.tms"; $sortfield="p.tms";
} }
if ($sortorder == "") if ($sortorder == "")
{ {
$sortorder="DESC"; $sortorder="DESC";
} }
$sql = "SELECT p.rowid, p.label, p.price, p.ref FROM llx_product as p"; $sql = "SELECT p.rowid, p.label, p.price, p.ref FROM llx_product as p";
$sql .= " WHERE p.fk_product_type = $type"; $sql .= " WHERE p.fk_product_type = $type";
if ($sref) if ($sref)
{ {
$sql .= " AND lower(p.ref) like '%".strtolower($sref)."%'"; $sql .= " AND lower(p.ref) like '%".strtolower($sref)."%'";
} }
if ($snom) if ($snom)
{ {
$sql .= " AND lower(p.label) like '%".strtolower($snom)."%'"; $sql .= " AND lower(p.label) like '%".strtolower($snom)."%'";
} }
$sql .= " ORDER BY $sortfield $sortorder ";
$sql .= $db->plimit($limit + 1 ,$offset);
if ( $db->query($sql) ) if ($user->rights->produit->lire == 0)
{
// sécurité
$sql .= " AND 1 = 2";
}
$sql .= " ORDER BY $sortfield $sortorder ";
$sql .= $db->plimit($limit + 1 ,$offset);
$result = $db->query($sql) ;
if ($result)
{ {
$num = $db->num_rows(); $num = $db->num_rows();
$i = 0; $i = 0;
if ($num == 1) if ($num == 1)