diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php
index 5405b33d994..0e5da0735ce 100644
--- a/htdocs/categories/viewcat.php
+++ b/htdocs/categories/viewcat.php
@@ -487,753 +487,800 @@ $typeid = $type;
// List of products or services (type is type of category)
if ($type == Categorie::TYPE_PRODUCT) {
- $permission = ($user->rights->produit->creer || $user->rights->service->creer);
+ if ($user->hasRight("product", "read")) {
+ $permission = ($user->rights->produit->creer || $user->rights->service->creer);
+
+ $prods = $object->getObjectsInCateg($type, 0, $limit, $offset);
+ if ($prods < 0) {
+ dol_print_error($db, $object->error, $object->errors);
+ } else {
+ // Form to add record into a category
+ $showclassifyform = 1;
+ if ($showclassifyform) {
+ print '
';
+ print '
';
+ }
- $prods = $object->getObjectsInCateg($type, 0, $limit, $offset);
- if ($prods < 0) {
- dol_print_error($db, $object->error, $object->errors);
- } else {
- // Form to add record into a category
- $showclassifyform = 1;
- if ($showclassifyform) {
- print '
';
print '';
- }
+ print '';
- print ''."\n";
+ print ''."\n";
+ }
+ } else {
+ print_barre_liste($langs->trans("ProductsAndServices"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'products');
+ accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
}
}
// List of customers
if ($type == Categorie::TYPE_CUSTOMER) {
- $permission = $user->rights->societe->creer;
+ if ($user->hasRight("societe", "read")) {
+ $permission = $user->rights->societe->creer;
+
+ $socs = $object->getObjectsInCateg($type, 0, $limit, $offset);
+ if ($socs < 0) {
+ dol_print_error($db, $object->error, $object->errors);
+ } else {
+ // Form to add record into a category
+ $showclassifyform = 1;
+ if ($showclassifyform) {
+ print '
';
+ print '';
+ }
- $socs = $object->getObjectsInCateg($type, 0, $limit, $offset);
- if ($socs < 0) {
- dol_print_error($db, $object->error, $object->errors);
- } else {
- // Form to add record into a category
- $showclassifyform = 1;
- if ($showclassifyform) {
- print '
';
print '';
- }
+ print '';
- print ''."\n";
+ print ''."\n";
+ }
+ } else {
+ print_barre_liste($langs->trans("Customers"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'companies');
+ accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
}
}
// List of suppliers
if ($type == Categorie::TYPE_SUPPLIER) {
- $permission = $user->rights->societe->creer;
+ if ($user->hasRight("fournisseur", "read")) {
+ $permission = $user->rights->societe->creer;
+
+ $socs = $object->getObjectsInCateg($type, 0, $limit, $offset);
+ if ($socs < 0) {
+ dol_print_error($db, $object->error, $object->errors);
+ } else {
+ // Form to add record into a category
+ $showclassifyform = 1;
+ if ($showclassifyform) {
+ print '
';
+ print '';
+ }
- $socs = $object->getObjectsInCateg($type, 0, $limit, $offset);
- if ($socs < 0) {
- dol_print_error($db, $object->error, $object->errors);
- } else {
- // Form to add record into a category
- $showclassifyform = 1;
- if ($showclassifyform) {
- print '
';
print '';
- }
+ print '';
- print ''."\n";
+ print ''."\n";
+ }
+ } else {
+ print_barre_liste($langs->trans("Suppliers"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'companies');
+ accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
}
}
// List of members
if ($type == Categorie::TYPE_MEMBER) {
- require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
+ if ($user->hasRight("adherent", "read")) {
+ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
- $permission = $user->rights->adherent->creer;
+ $permission = $user->rights->adherent->creer;
+
+ $prods = $object->getObjectsInCateg($type, 0, $limit, $offset);
+ if ($prods < 0) {
+ dol_print_error($db, $object->error, $object->errors);
+ } else {
+ // Form to add record into a category
+ $showclassifyform = 1;
+ if ($showclassifyform) {
+ print '
';
+ print '';
+ }
- $prods = $object->getObjectsInCateg($type, 0, $limit, $offset);
- if ($prods < 0) {
- dol_print_error($db, $object->error, $object->errors);
- } else {
- // Form to add record into a category
- $showclassifyform = 1;
- if ($showclassifyform) {
- print '
';
print '';
- }
+ print '';
- print ''."\n";
+ print ''."\n";
+ }
+ } else {
+ print_barre_liste($langs->trans("Member"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'members');
+ accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
}
}
// List of contacts
if ($type == Categorie::TYPE_CONTACT) {
- $permission = $user->rights->societe->creer;
+ if ($user->hasRight("societe", "read")) {
+ $permission = $user->rights->societe->creer;
- $contacts = $object->getObjectsInCateg($type, 0, $limit, $offset);
- if (is_numeric($contacts) && $contacts < 0) {
- dol_print_error($db, $object->error, $object->errors);
- } else {
- // Form to add record into a category
- $showclassifyform = 1;
- if ($showclassifyform) {
- print '
';
+ $contacts = $object->getObjectsInCateg($type, 0, $limit, $offset);
+ if (is_numeric($contacts) && $contacts < 0) {
+ dol_print_error($db, $object->error, $object->errors);
+ } else {
+ // Form to add record into a category
+ $showclassifyform = 1;
+ if ($showclassifyform) {
+ print '
';
+ print '';
+ }
print '';
- }
- print ''."\n";
+ print ''."\n";
+ }
+ } else {
+ print_barre_liste($langs->trans("Contact"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'contact');
+ accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
}
}
// List of bank accounts
if ($type == Categorie::TYPE_ACCOUNT) {
- require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+ if ($user->hasRight("banque", "read")) {
+ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
- $permission = $user->rights->banque->creer;
+ $permission = $user->rights->banque->creer;
+
+ $accounts = $object->getObjectsInCateg($type, 0, $limit, $offset);
+ if ($accounts < 0) {
+ dol_print_error($db, $object->error, $object->errors);
+ } else {
+ // Form to add record into a category
+ $showclassifyform = 1;
+ if ($showclassifyform) {
+ print '
';
+ print '';
+ }
- $accounts = $object->getObjectsInCateg($type, 0, $limit, $offset);
- if ($accounts < 0) {
- dol_print_error($db, $object->error, $object->errors);
- } else {
- // Form to add record into a category
- $showclassifyform = 1;
- if ($showclassifyform) {
- print '
';
print '';
- }
+ print '';
- print ''."\n";
+ print ''."\n";
+ }
+ } else {
+ print_barre_liste($langs->trans("Banque"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'bank');
+ accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
}
}
// List of Project
if ($type == Categorie::TYPE_PROJECT) {
- require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
+ if ($user->hasRight("project", "read")) {
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
- $permission = $user->rights->projet->creer;
+ $permission = $user->rights->projet->creer;
+
+ $objects = $object->getObjectsInCateg($type, 0, $limit, $offset);
+ if ($objects < 0) {
+ dol_print_error($db, $object->error, $object->errors);
+ } else {
+ // Form to add record into a category
+ $showclassifyform = 1;
+ if ($showclassifyform) {
+ print '
';
+ print '';
+ }
- $objects = $object->getObjectsInCateg($type, 0, $limit, $offset);
- if ($objects < 0) {
- dol_print_error($db, $object->error, $object->errors);
- } else {
- // Form to add record into a category
- $showclassifyform = 1;
- if ($showclassifyform) {
- print '
';
print '';
- }
+ print '';
- print ''."\n";
+ print ''."\n";
+ }
+ } else {
+ print_barre_liste($langs->trans("Project"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'project');
+ accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
}
}
// List of users
-if ($type == Categorie::TYPE_USER && $user->hasRight("user", "user", "read")) {
- require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
+if ($type == Categorie::TYPE_USER) {
+ if ($user->hasRight("user", "user", "read")) {
+ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
- $users = $object->getObjectsInCateg($type);
- if ($users < 0) {
- dol_print_error($db, $object->error, $object->errors);
- } else {
- // Form to add record into a category
- $showclassifyform = 1;
- if ($showclassifyform) {
- print '
';
+ $users = $object->getObjectsInCateg($type);
+ if ($users < 0) {
+ dol_print_error($db, $object->error, $object->errors);
+ } else {
+ // Form to add record into a category
+ $showclassifyform = 1;
+ if ($showclassifyform) {
+ print '
';
+ print '';
+ }
print '';
- }
- print ''."\n";
+ print ''."\n";
+ }
+ } else {
+ print_barre_liste($langs->trans("Users"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'user');
+ accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
}
-} else {
- print_barre_liste($langs->trans("Users"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'user');
- accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
}
// List of warehouses
if ($type == Categorie::TYPE_WAREHOUSE) {
- $permission = $user->rights->stock->creer;
+ if ($user->hasRight("warehouse", "read")) {
+ $permission = $user->rights->stock->creer;
- require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
+ require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
- $objects = $object->getObjectsInCateg($type, 0, $limit, $offset);
- if ($objects < 0) {
- dol_print_error($db, $object->error, $object->errors);
- } else {
- print ''."\n";
- }
-}
-
-// List of tickets
-if ($type == Categorie::TYPE_TICKET) {
- $permission = ($user->rights->categorie->creer || $user->rights->categorie->creer);
-
- $tickets = $object->getObjectsInCateg($type, 0, $limit, $offset);
- if ($tickets < 0) {
- dol_print_error($db, $object->error, $object->errors);
- } else {
- // Form to add record into a category
- $showclassifyform = 1;
- if ($showclassifyform) {
- print '
';
print '';
- }
+ print '';
- print ''."\n";
+ print ''."\n";
+ }
+ } else {
+ print_barre_liste($langs->trans("Warehouse"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'stock');
+ accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
+ }
+}
+
+// List of tickets
+if ($type == Categorie::TYPE_TICKET) {
+ if ($user->hasRight("ticket", "read")) {
+ $permission = ($user->rights->categorie->creer || $user->rights->categorie->creer);
+
+ $tickets = $object->getObjectsInCateg($type, 0, $limit, $offset);
+ if ($tickets < 0) {
+ dol_print_error($db, $object->error, $object->errors);
+ } else {
+ // Form to add record into a category
+ $showclassifyform = 1;
+ if ($showclassifyform) {
+ print '
';
+ print '';
+ }
+
+ print ''."\n";
+ }
+ } else {
+ print_barre_liste($langs->trans("Ticket"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'ticket');
+ accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
}
}