diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php
index 75c9c731810..c6477f01eb1 100644
--- a/htdocs/adherents/list.php
+++ b/htdocs/adherents/list.php
@@ -425,7 +425,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 3396cd6270b..1adb7691f6e 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 875b72a8dd2..01052c00834 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -583,7 +583,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 .= '';
@@ -592,7 +592,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 ace8a327768..be764248b1f 100644
--- a/htdocs/compta/bank/list.php
+++ b/htdocs/compta/bank/list.php
@@ -281,7 +281,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 b4bfa70a287..549e680193f 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -725,7 +725,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 .= '';
@@ -734,7 +734,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 1332bc5e100..f8f8f37669d 100644
--- a/htdocs/contact/list.php
+++ b/htdocs/contact/list.php
@@ -573,7 +573,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 .= '
';
@@ -596,21 +596,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 531642f81f7..a8781a5aaf3 100644
--- a/htdocs/contrat/list.php
+++ b/htdocs/contrat/list.php
@@ -418,7 +418,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 77796fc9bc1..ddf71330e77 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 c900431d910..6a655eb220e 100644
--- a/htdocs/fourn/commande/list.php
+++ b/htdocs/fourn/commande/list.php
@@ -739,7 +739,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 bbc4f45e4b2..c594be95af5 100644
--- a/htdocs/fourn/facture/list.php
+++ b/htdocs/fourn/facture/list.php
@@ -597,7 +597,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 18e6e1c3500..227a9508b9c 100644
--- a/htdocs/product/list.php
+++ b/htdocs/product/list.php
@@ -598,7 +598,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 8a7645941d5..8964796dee9 100644
--- a/htdocs/projet/list.php
+++ b/htdocs/projet/list.php
@@ -489,7 +489,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 20d917b2ae8..d5e1c02ceac 100644
--- a/htdocs/projet/tasks/list.php
+++ b/htdocs/projet/tasks/list.php
@@ -462,7 +462,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 ad9813c4fec..34e8f7a87ff 100644
--- a/htdocs/societe/list.php
+++ b/htdocs/societe/list.php
@@ -660,7 +660,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 .= '
';
@@ -671,7 +671,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 1340dce3b3b..df8e85787e6 100644
--- a/htdocs/supplier_proposal/list.php
+++ b/htdocs/supplier_proposal/list.php
@@ -465,7 +465,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 92826eac19e..38940c1213d 100644
--- a/htdocs/user/list.php
+++ b/htdocs/user/list.php
@@ -341,7 +341,7 @@ if ($sall)
$moreforfilter = '';
// Filter on categories
-if (!empty($conf->categorie->enabled))
+if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
$moreforfilter .= '
';
$moreforfilter .= $langs->trans('Categories').': ';