diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php
index 4fef3184c20..6aa063a9b4e 100644
--- a/htdocs/categories/categorie.php
+++ b/htdocs/categories/categorie.php
@@ -118,7 +118,8 @@ if (empty($reshook))
}
if ($type==1 && $user->rights->societe->creer)
{
- $object = new Societe($db);
+ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
+ $object = new Fournisseur($db);
$result = $object->fetch($objectid);
$elementtype = 'fournisseur';
}
@@ -152,7 +153,7 @@ if (empty($reshook))
setEventMessage($cat->errors,'errors');
}
}
-
+
// Add object into a category
if ($parent > 0)
{
@@ -165,7 +166,8 @@ if (empty($reshook))
}
if ($type==1 && $user->rights->societe->creer)
{
- $object = new Societe($db);
+ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
+ $object = new Fournisseur($db);
$result = $object->fetch($objectid);
$elementtype = 'fournisseur';
}
@@ -319,11 +321,11 @@ if ($socid)
dol_fiche_end();
- if ($soc->client) formCategory($db,$soc,2,$socid);
+ if ($soc->client) formCategory($db,$soc,2,$socid,$user->rights->societe->creer);
if ($soc->client && $soc->fournisseur) print '
';
- if ($soc->fournisseur) formCategory($db,$soc,1,$socid);
+ if ($soc->fournisseur) formCategory($db,$soc,1,$socid,$user->rights->societe->creer);
}
else if ($id || $ref)
{
@@ -377,7 +379,7 @@ else if ($id || $ref)
dol_fiche_end();
- formCategory($db,$product,0);
+ formCategory($db,$product,0,($user->rights->produit->creer || $user->rights->service->creer));
}
if ($type == 3)
@@ -456,7 +458,7 @@ else if ($id || $ref)
dol_fiche_end();
- formCategory($db,$member,3);
+ formCategory($db,$member,3,0,$user->rights->adherent->creer);
}
if ($type == 4)
{
@@ -602,7 +604,7 @@ else if ($id || $ref)
dol_fiche_end();
- formCategory($db,$object,4);
+ formCategory($db,$object,4,$user->rights->societe->creer);
}
}
@@ -610,13 +612,14 @@ else if ($id || $ref)
/**
* Function to output a form to add object into a category
*
- * @param DoliDb $db Database handler
- * @param Object $object Object we want to see categories it can be classified into
- * @param int $typeid Type of category (0, 1, 2, 3)
- * @param int $socid Id thirdparty
+ * @param DoliDb $db Database handler
+ * @param Object $object Object we want to see categories it can be classified into
+ * @param int $typeid Type of category (0, 1, 2, 3)
+ * @param int $socid Id thirdparty
+ * @param string $showclassifyform 1=Add form to 'Classify', 0=Do not show form to 'Classify'
* @return int 0
*/
-function formCategory($db,$object,$typeid,$socid=0)
+function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1)
{
global $user,$langs,$form,$bc;
@@ -626,33 +629,37 @@ function formCategory($db,$object,$typeid,$socid=0)
if ($typeid == 3) $title = $langs->trans("MembersCategoriesShort");
if ($typeid == 4) $title = $langs->trans("ContactCategoriesShort");
- // Form to add record into a category
print '
';
print_fiche_titre($title,'','');
- print '