diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php
index 9396b02d518..ef4639e4b5e 100644
--- a/htdocs/adherents/list.php
+++ b/htdocs/adherents/list.php
@@ -436,7 +436,7 @@ if ($sall) {
// Filter on categories
$moreforfilter = '';
-if (!empty($conf->categorie->enabled)) {
+if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '
';
$moreforfilter .= $langs->trans('Categories').': ';
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index e50078993f8..f9ccc0837c8 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -542,7 +542,7 @@ if ($resql)
$moreforfilter .= '
';
}
// If the user can view products
- if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
+ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '';
@@ -551,7 +551,7 @@ if ($resql)
$moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter .= '
';
}
- if (!empty($conf->categorie->enabled))
+ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '';
diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index ae73b23a876..c30a60424a6 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -593,7 +593,7 @@ if ($resql)
$moreforfilter .= '
';
}
// If the user can view prospects other than his'
- if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
+ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '';
@@ -602,7 +602,7 @@ if ($resql)
$moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter .= '
';
}
- if (!empty($conf->categorie->enabled))
+ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '';
diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php
index 5cdd4711871..9c67897e18d 100644
--- a/htdocs/compta/bank/list.php
+++ b/htdocs/compta/bank/list.php
@@ -276,7 +276,7 @@ if ($sall)
$moreforfilter = '';
-if (!empty($conf->categorie->enabled))
+if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
$moreforfilter .= $form->getFilterBox(Categorie::TYPE_ACCOUNT, $search_category_list);
}
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 607afbc943f..e12e21e70b4 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -729,7 +729,7 @@ if ($resql)
$moreforfilter .= '
';
}
// If the user can view prospects other than his'
- if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
+ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '';
@@ -738,7 +738,7 @@ if ($resql)
$moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter .= '
';
}
- if (!empty($conf->categorie->enabled))
+ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '';
diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php
index 531fb885f63..8199a62201b 100644
--- a/htdocs/contact/list.php
+++ b/htdocs/contact/list.php
@@ -571,7 +571,7 @@ if ($search_firstlast_only)
}
$moreforfilter = '';
-if (!empty($conf->categorie->enabled))
+if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '
';
@@ -594,21 +594,20 @@ if (!empty($conf->categorie->enabled))
$moreforfilter .= $formother->select_categories(Categorie::TYPE_SUPPLIER, $search_categ_supplier, 'search_categ_supplier', 1);
$moreforfilter .= '
';
}
- $moreforfilter .= '
';
- $moreforfilter .= $langs->trans('Roles').': ';
- $moreforfilter .= $formcompany->showRoles("search_roles", $objecttmp, 'edit', $search_roles);
- $moreforfilter .= '
';
-}
-if ($moreforfilter)
-{
- print '
';
- print $moreforfilter;
- $parameters = array('type'=>$type);
- $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
- print $hookmanager->resPrint;
- print '
';
}
+$moreforfilter .= '
';
+$moreforfilter .= $langs->trans('Roles').': ';
+$moreforfilter .= $formcompany->showRoles("search_roles", $objecttmp, 'edit', $search_roles);
+$moreforfilter .= '
';
+
+print '
';
+print $moreforfilter;
+$parameters = array('type'=>$type);
+$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
+print $hookmanager->resPrint;
+print '
';
+
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php
index 608fc6c0d81..04329a63145 100644
--- a/htdocs/contrat/list.php
+++ b/htdocs/contrat/list.php
@@ -416,7 +416,7 @@ if ($user->rights->user->user->lire)
$moreforfilter .= '
';
}
// If the user can view categories of products
-if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
+if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '';
diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php
index 3f9de5533fc..37bee98d73f 100644
--- a/htdocs/expedition/list.php
+++ b/htdocs/expedition/list.php
@@ -408,7 +408,7 @@ if ($resql)
$moreforfilter .= '
';
}
// If the user can view prospects other than his'
- if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
+ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '';
@@ -417,7 +417,7 @@ if ($resql)
$moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter .= '
';
}
- if (!empty($conf->categorie->enabled))
+ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '';
diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php
index a1dfb78a2c5..8bbd73ad016 100644
--- a/htdocs/fourn/commande/list.php
+++ b/htdocs/fourn/commande/list.php
@@ -782,7 +782,7 @@ if ($resql)
$moreforfilter .= '
';
}
// If the user can view prospects other than his'
- if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
+ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '';
diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php
index 66e94d461a4..337f2a9a000 100644
--- a/htdocs/fourn/facture/list.php
+++ b/htdocs/fourn/facture/list.php
@@ -595,7 +595,7 @@ if ($resql)
$moreforfilter .= '
';
}
// If the user can view prospects other than his'
- if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
+ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '';
diff --git a/htdocs/product/list.php b/htdocs/product/list.php
index a0bfa073afa..4abf8fd4a8b 100644
--- a/htdocs/product/list.php
+++ b/htdocs/product/list.php
@@ -593,7 +593,7 @@ if ($resql)
// Filter on categories
$moreforfilter = '';
- if (!empty($conf->categorie->enabled))
+ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
$moreforfilter .= '
';
$moreforfilter .= $langs->trans('Categories').': ';
diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php
index b0f593f82d9..f717e541229 100644
--- a/htdocs/product/stock/list.php
+++ b/htdocs/product/stock/list.php
@@ -375,7 +375,7 @@ if ($search_all)
$moreforfilter = '';
-if (!empty($conf->categorie->enabled))
+if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
$formcategory = new FormCategory($db);
$moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_WAREHOUSE, $search_category_list);
diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php
index a2eb2d1938c..7c85327545d 100644
--- a/htdocs/projet/list.php
+++ b/htdocs/projet/list.php
@@ -496,7 +496,7 @@ if ($search_all)
$moreforfilter = '';
// Filter on categories
-if (!empty($conf->categorie->enabled))
+if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
$formcategory = new FormCategory($db);
$moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PROJECT, $search_category_array);
diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php
index 7d1a8354bb3..f2d455f7a04 100644
--- a/htdocs/projet/tasks/list.php
+++ b/htdocs/projet/tasks/list.php
@@ -458,7 +458,7 @@ if ($search_all)
$morehtmlfilter = '';
// Filter on categories
-if (!empty($conf->categorie->enabled))
+if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '
';
diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php
index 54ee7d5310c..ed861220816 100644
--- a/htdocs/societe/list.php
+++ b/htdocs/societe/list.php
@@ -663,7 +663,7 @@ if ($search_all)
$moreforfilter = '';
if (empty($type) || $type == 'c' || $type == 'p')
{
- if (!empty($conf->categorie->enabled))
+ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '
';
@@ -674,7 +674,7 @@ if (empty($type) || $type == 'c' || $type == 'p')
}
if (empty($type) || $type == 'f')
{
- if (!empty($conf->categorie->enabled))
+ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '
';
diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php
index b0f8bf40609..7f2576ca0f6 100644
--- a/htdocs/supplier_proposal/list.php
+++ b/htdocs/supplier_proposal/list.php
@@ -463,7 +463,7 @@ if ($resql)
$moreforfilter .= '
';
}
// If the user can view products
- if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
+ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '
';
diff --git a/htdocs/user/list.php b/htdocs/user/list.php
index 0bed08c3c31..ef19ebefe26 100644
--- a/htdocs/user/list.php
+++ b/htdocs/user/list.php
@@ -482,7 +482,7 @@ $moreforfilter = '';
$moreforfilter.= '
';*/
// Filter on categories
-if (!empty($conf->categorie->enabled))
+if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
$moreforfilter .= '
';
$moreforfilter .= $langs->trans('Categories').': ';