diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index 6e9b67de7e3..64882eee6a9 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -924,10 +924,14 @@ if ($_GET['propalid'] > 0)
print '
\n";
print ' | ';
print '';
- if($societe->tva_assuj == "0")
- print '0';
- else
- $html->select_tva('np_tva_tx', $conf->defaulttx, $mysoc, $societe);
+ if($societe->tva_assuj == "0")
+ {
+ print '0';
+ }
+ else
+ {
+ $html->select_tva('np_tva_tx', $conf->defaulttx, $mysoc, $societe);
+ }
print " | \n";
print ' | ';
print ' | ';
@@ -948,11 +952,15 @@ if ($_GET['propalid'] > 0)
print '
';
print '';
- // multiprix
- if($conf->global->PRODUIT_MULTIPRICES == 1)
- $html->select_produits('','idprod','',$conf->produit->limit_size,$societe->price_level);
- else
- $html->select_produits('','idprod','',$conf->produit->limit_size);
+ // multiprix
+ if($conf->global->PRODUIT_MULTIPRICES == 1)
+ {
+ $html->select_produits('','idprod','',$conf->produit->limit_size,$societe->price_level);
+ }
+ else
+ {
+ $html->select_produits('','idprod','',$conf->produit->limit_size);
+ }
print ' ';
print '';
print ' | ';
diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php
index e64d2140884..8c45d79ea9f 100644
--- a/htdocs/html.form.class.php
+++ b/htdocs/html.form.class.php
@@ -4,6 +4,7 @@
* Copyright (C) 2004 Benoit Mortier
* Copyright (C) 2004 Sebastien Di Cintio
* Copyright (C) 2004 Eric Seigne
+ * Copyright (C) 2005-2006 Regis Houssin
* Copyright (C) 2006 Andre Cianfarani
*
* This program is free software; you can redistribute it and/or modify
@@ -606,11 +607,21 @@ class Form
*/
function select_produits($selected='',$htmlname='productid',$filtretype='',$limit=20,$price_level=0)
{
- global $langs,$conf;
+ global $langs,$conf,$user;
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p ";
+ if ($conf->categorie->enabled && !$user->rights->categorie->voir)
+ {
+ $sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp";
+ $sql .= ", ".MAIN_DB_PREFIX."categorie as c";
+ }
$sql.= " WHERE p.envente = 1";
+ if ($conf->categorie->enabled && !$user->rights->categorie->voir)
+ {
+ $sql .= " AND cp.fk_product = p.rowid";
+ $sql .= " AND cp.fk_categorie = c.rowid AND c.visible = 1";
+ }
if ($filtretype && $filtretype != '') $sql.=" AND p.fk_product_type=".$filtretype;
$sql.= " ORDER BY p.nbvente DESC";
if ($limit) $sql.= " LIMIT $limit";