';
+
+print load_fiche_titre($langs->trans("SubCats"), $newcardbutton);
+
+
print '
';
print '';
@@ -483,9 +492,10 @@ if ($type == Categorie::TYPE_PRODUCT)
print '
';
$param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($prods); $nbtotalofrecords = ''; $newcardbutton = '';
- print_barre_liste($langs->trans("ProductsAndServices"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, $newcardbutton, '', $limit);
+ print_barre_liste($langs->trans("ProductsAndServices"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'products', 0, $newcardbutton, '', $limit);
- print "
\n";
+
+ print ''."\n";
print '| '.$langs->trans("Ref").' |
'."\n";
if (count($prods) > 0)
@@ -503,17 +513,11 @@ if ($type == Categorie::TYPE_PRODUCT)
print ''.$prod->label." | \n";
// Link to delete from category
print '';
- $permission = 0;
- if ($type == Categorie::TYPE_PRODUCT) $permission = ($user->rights->produit->creer || $user->rights->service->creer);
- if ($type == Categorie::TYPE_SUPPLIER) $permission = $user->rights->societe->creer;
- if ($type == Categorie::TYPE_CUSTOMER) $permission = $user->rights->societe->creer;
- if ($type == Categorie::TYPE_MEMBER) $permission = $user->rights->adherent->creer;
- if ($type == Categorie::TYPE_PROJECT) $permission = $user->rights->projet->creer;
if ($permission)
{
print "id."&type=".$typeid."&removeelem=".$prod->id."'>";
print $langs->trans("DeleteFromCat");
- print img_picto($langs->trans("DeleteFromCat"), 'unlink');
+ print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft');
print "";
}
print ' | ';
@@ -522,7 +526,7 @@ if ($type == Categorie::TYPE_PRODUCT)
}
else
{
- print '| '.$langs->trans("ThisCategoryHasNoProduct").' |
';
+ print '| '.$langs->trans("ThisCategoryHasNoItems").' |
';
}
print "
\n";
@@ -532,7 +536,9 @@ if ($type == Categorie::TYPE_PRODUCT)
if ($type == Categorie::TYPE_SUPPLIER)
{
- $socs = $object->getObjectsInCateg("supplier", 0, $limit, $offset);
+ $permission = $user->rights->societe->creer;
+
+ $socs = $object->getObjectsInCateg($type, 0, $limit, $offset);
if ($socs < 0)
{
dol_print_error($db, $socs->error, $socs->errors);
@@ -548,7 +554,7 @@ if ($type == Categorie::TYPE_SUPPLIER)
print '
';
$param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($socs); $nbtotalofrecords = ''; $newcardbutton = '';
- print_barre_liste($langs->trans("Suppliers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, $newcardbutton, '', $limit);
+ print_barre_liste($langs->trans("Suppliers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'companies', 0, $newcardbutton, '', $limit);
print ''."\n";
print '| '.$langs->trans("Name")." |
\n";
@@ -567,17 +573,11 @@ if ($type == Categorie::TYPE_SUPPLIER)
print "\n";
// Link to delete from category
print '';
- $permission = 0;
- if ($type == Categorie::TYPE_PRODUCT) $permission = ($user->rights->produit->creer || $user->rights->service->creer);
- if ($type == Categorie::TYPE_SUPPLIER) $permission = $user->rights->societe->creer;
- if ($type == Categorie::TYPE_CUSTOMER) $permission = $user->rights->societe->creer;
- if ($type == Categorie::TYPE_MEMBER) $permission = $user->rights->adherent->creer;
- if ($type == Categorie::TYPE_PROJECT) $permission = $user->rights->projet->creer;
if ($permission)
{
print "id."&type=".$typeid."&removeelem=".$soc->id."'>";
print $langs->trans("DeleteFromCat");
- print img_picto($langs->trans("DeleteFromCat"), 'unlink');
+ print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft');
print "";
}
print ' | ';
@@ -587,7 +587,7 @@ if ($type == Categorie::TYPE_SUPPLIER)
}
else
{
- print '| '.$langs->trans("ThisCategoryHasNoSupplier").' |
';
+ print '| '.$langs->trans("ThisCategoryHasNoItems").' |
';
}
print "
\n";
@@ -597,7 +597,9 @@ if ($type == Categorie::TYPE_SUPPLIER)
if ($type == Categorie::TYPE_CUSTOMER)
{
- $socs = $object->getObjectsInCateg("customer", 0, $limit, $offset);
+ $permission = $user->rights->societe->creer;
+
+ $socs = $object->getObjectsInCateg($type, 0, $limit, $offset);
if ($socs < 0)
{
dol_print_error($db, $socs->error, $socs->errors);
@@ -613,7 +615,7 @@ if ($type == Categorie::TYPE_CUSTOMER)
print '
';
$param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($socs); $nbtotalofrecords = ''; $newcardbutton = '';
- print_barre_liste($langs->trans("Customers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, $newcardbutton, '', $limit);
+ print_barre_liste($langs->trans("Customers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'companies', 0, $newcardbutton, '', $limit);
print ''."\n";
print '| '.$langs->trans("Name").' |
'."\n";
@@ -632,17 +634,11 @@ if ($type == Categorie::TYPE_CUSTOMER)
print "\n";
// Link to delete from category
print '';
- $permission = 0;
- if ($type == Categorie::TYPE_PRODUCT) $permission = ($user->rights->produit->creer || $user->rights->service->creer);
- if ($type == Categorie::TYPE_SUPPLIER) $permission = $user->rights->societe->creer;
- if ($type == Categorie::TYPE_CUSTOMER) $permission = $user->rights->societe->creer;
- if ($type == Categorie::TYPE_MEMBER) $permission = $user->rights->adherent->creer;
- if ($type == Categorie::TYPE_PROJECT) $permission = $user->rights->projet->creer;
if ($permission)
{
print "id."&type=".$typeid."&removeelem=".$soc->id."'>";
print $langs->trans("DeleteFromCat");
- print img_picto($langs->trans("DeleteFromCat"), 'unlink');
+ print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft');
print "";
}
print ' | ';
@@ -651,7 +647,7 @@ if ($type == Categorie::TYPE_CUSTOMER)
}
else
{
- print '| '.$langs->trans("ThisCategoryHasNoCustomer").' |
';
+ print '| '.$langs->trans("ThisCategoryHasNoItems").' |
';
}
print "
\n";
@@ -664,7 +660,9 @@ if ($type == Categorie::TYPE_MEMBER)
{
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
- $prods = $object->getObjectsInCateg("member", 0, $limit, $offset);
+ $permission = $user->rights->adherent->creer;
+
+ $prods = $object->getObjectsInCateg($type, 0, $limit, $offset);
if ($prods < 0)
{
dol_print_error($db, $prods->error, $prods->errors);
@@ -680,7 +678,7 @@ if ($type == Categorie::TYPE_MEMBER)
print '
';
$param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($prods); $nbtotalofrecords = ''; $newcardbutton = '';
- print_barre_liste($langs->trans("Member"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, $newcardbutton, '', $limit);
+ print_barre_liste($langs->trans("Member"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'adherents', 0, $newcardbutton, '', $limit);
print "\n";
print '| '.$langs->trans("Name").' |
'."\n";
@@ -702,17 +700,11 @@ if ($type == Categorie::TYPE_MEMBER)
print ''.$member->firstname." | \n";
// Link to delete from category
print '';
- $permission = 0;
- if ($type == Categorie::TYPE_PRODUCT) $permission = ($user->rights->produit->creer || $user->rights->service->creer);
- if ($type == Categorie::TYPE_SUPPLIER) $permission = $user->rights->societe->creer;
- if ($type == Categorie::TYPE_CUSTOMER) $permission = $user->rights->societe->creer;
- if ($type == Categorie::TYPE_MEMBER) $permission = $user->rights->adherent->creer;
- if ($type == Categorie::TYPE_PROJECT) $permission = $user->rights->projet->creer;
if ($permission)
{
print "id."&type=".$typeid."&removeelem=".$member->id."'>";
print $langs->trans("DeleteFromCat");
- print img_picto($langs->trans("DeleteFromCat"), 'unlink');
+ print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft');
print "";
}
print "\n";
@@ -720,7 +712,7 @@ if ($type == Categorie::TYPE_MEMBER)
}
else
{
- print ' | | '.$langs->trans("ThisCategoryHasNoMember").' |
';
+ print '| '.$langs->trans("ThisCategoryHasNoItems").' |
';
}
print "
\n";
@@ -731,7 +723,9 @@ if ($type == Categorie::TYPE_MEMBER)
// Categorie contact
if ($type == Categorie::TYPE_CONTACT)
{
- $contacts = $object->getObjectsInCateg("contact", 0, $limit, $offset);
+ $permission = $user->rights->societe->creer;
+
+ $contacts = $object->getObjectsInCateg($type, 0, $limit, $offset);
if ($contacts < 0)
{
dol_print_error($db, $contacts->error, $contacts->errors);
@@ -746,8 +740,11 @@ if ($type == Categorie::TYPE_CONTACT)
print '';
print '
';
- $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($contacts); $nbtotalofrecords = ''; $newcardbutton = '';
- print_barre_liste($langs->trans("Contact"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, $newcardbutton, '', $limit);
+ $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
+ $num = count($contacts);
+ $nbtotalofrecords = '';
+ $newcardbutton = '';
+ print_barre_liste($langs->trans("Contact"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contacts', 0, $newcardbutton, '', $limit);
print ''."\n";
print '| '.$langs->trans("Ref").' |
'."\n";
@@ -766,17 +763,11 @@ if ($type == Categorie::TYPE_CONTACT)
print "\n";
// Link to delete from category
print '';
- $permission = 0;
- if ($type == Categorie::TYPE_PRODUCT) $permission = ($user->rights->produit->creer || $user->rights->service->creer);
- if ($type == Categorie::TYPE_SUPPLIER) $permission = $user->rights->societe->creer;
- if ($type == Categorie::TYPE_CUSTOMER) $permission = $user->rights->societe->creer;
- if ($type == Categorie::TYPE_MEMBER) $permission = $user->rights->adherent->creer;
- if ($type == Categorie::TYPE_PROJECT) $permission = $user->rights->projet->creer;
if ($permission)
{
print "id."&type=".$typeid."&removeelem=".$contact->id."'>";
print $langs->trans("DeleteFromCat");
- print img_picto($langs->trans("DeleteFromCat"), 'unlink');
+ print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft');
print "";
}
print ' | ';
@@ -785,7 +776,7 @@ if ($type == Categorie::TYPE_CONTACT)
}
else
{
- print '| '.$langs->trans("ThisCategoryHasNoContact").' |
';
+ print '| '.$langs->trans("ThisCategoryHasNoItems").' |
';
}
print "
\n";
@@ -798,7 +789,9 @@ if ($type == Categorie::TYPE_ACCOUNT)
{
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
- $accounts = $object->getObjectsInCateg("account", 0, $limit, $offset);
+ $permission = $user->rights->banque->creer;
+
+ $accounts = $object->getObjectsInCateg($type, 0, $limit, $offset);
if ($accounts < 0)
{
dol_print_error($db, $accounts->error, $accounts->errors);
@@ -814,7 +807,7 @@ if ($type == Categorie::TYPE_ACCOUNT)
print '
';
$param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($accounts); $nbtotalofrecords = ''; $newcardbutton = '';
- print_barre_liste($langs->trans("Account"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, $newcardbutton, '', $limit);
+ print_barre_liste($langs->trans("Account"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'account', 0, $newcardbutton, '', $limit);
print "\n";
print '| '.$langs->trans("Ref").' |
'."\n";
@@ -835,17 +828,11 @@ if ($type == Categorie::TYPE_ACCOUNT)
print ''.$account->number." | \n";
// Link to delete from category
print '';
- $permission = 0;
- if ($type == Categorie::TYPE_PRODUCT) $permission = ($user->rights->produit->creer || $user->rights->service->creer);
- if ($type == Categorie::TYPE_SUPPLIER) $permission = $user->rights->societe->creer;
- if ($type == Categorie::TYPE_CUSTOMER) $permission = $user->rights->societe->creer;
- if ($type == Categorie::TYPE_MEMBER) $permission = $user->rights->adherent->creer;
- if ($type == Categorie::TYPE_PROJECT) $permission = $user->rights->projet->creer;
if ($permission)
{
print "id."&type=".$typeid."&removeelem=".$account->id."'>";
print $langs->trans("DeleteFromCat");
- print img_picto($langs->trans("DeleteFromCat"), 'unlink');
+ print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft');
print "";
}
print "\n";
@@ -853,7 +840,7 @@ if ($type == Categorie::TYPE_ACCOUNT)
}
else
{
- print ' | | '.$langs->trans("ThisCategoryHasNoAccount").' |
';
+ print '| '.$langs->trans("ThisCategoryHasNoItems").' |
';
}
print "
\n";
@@ -866,8 +853,10 @@ if ($type == Categorie::TYPE_PROJECT)
{
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
- $projects = $object->getObjectsInCateg("project", 0, $limit, $offset);
- if ($projects < 0)
+ $permission = $user->rights->projet->creer;
+
+ $objects = $object->getObjectsInCateg($type, 0, $limit, $offset);
+ if ($objects < 0)
{
dol_print_error($db, $object->error, $object->errors);
}
@@ -881,16 +870,17 @@ if ($type == Categorie::TYPE_PROJECT)
print '';
print '
';
- $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($projects); $nbtotalofrecords = ''; $newcardbutton = '';
- print_barre_liste($langs->trans("Project"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, $newcardbutton, '', $limit);
+ $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($objects); $nbtotalofrecords = ''; $newcardbutton = '';
+
+ print_barre_liste($langs->trans("Project"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'projects', 0, $newcardbutton, '', $limit);
print "\n";
print '| '.$langs->trans("Ref").' |
'."\n";
- if (count($projects) > 0)
+ if (count($objects) > 0)
{
$i = 0;
- foreach ($projects as $key => $project)
+ foreach ($objects as $key => $project)
{
$i++;
if ($i > $limit) break;
@@ -903,17 +893,11 @@ if ($type == Categorie::TYPE_PROJECT)
print ''.$project->title." | \n";
// Link to delete from category
print '';
- $permission = 0;
- if ($type == Categorie::TYPE_PRODUCT) $permission = ($user->rights->produit->creer || $user->rights->service->creer);
- if ($type == Categorie::TYPE_SUPPLIER) $permission = $user->rights->societe->creer;
- if ($type == Categorie::TYPE_CUSTOMER) $permission = $user->rights->societe->creer;
- if ($type == Categorie::TYPE_MEMBER) $permission = $user->rights->adherent->creer;
- if ($type == Categorie::TYPE_PROJECT) $permission = $user->rights->projet->creer;
if ($permission)
{
print "id."&type=".$typeid."&removeelem=".$project->id."'>";
print $langs->trans("DeleteFromCat");
- print img_picto($langs->trans("DeleteFromCat"), 'unlink');
+ print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft');
print "";
}
print "\n";
@@ -921,7 +905,7 @@ if ($type == Categorie::TYPE_PROJECT)
}
else
{
- print ' | | '.$langs->trans("ThisCategoryHasNoProject").' |
';
+ print '| '.$langs->trans("ThisCategoryHasNoItems").' |
';
}
print "
\n";
@@ -934,14 +918,25 @@ if ($type == Categorie::TYPE_USER)
{
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
- $users = $object->getObjectsInCateg("user");
+ $users = $object->getObjectsInCateg($type);
if ($users < 0)
{
dol_print_error($db, $object->error, $object->errors);
}
else
{
- print "
";
+ print ''."\n";
}
}
+
+// List of Project
+if ($type == Categorie::TYPE_WAREHOUSE)
+{
+ $permission = $user->rights->stock->creer;
+
+ 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";
+ }
+}
+
+
// End of page
llxFooter();
$db->close();
diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang
index 1ec9b5bd409..30bace0574c 100644
--- a/htdocs/langs/en_US/categories.lang
+++ b/htdocs/langs/en_US/categories.lang
@@ -63,13 +63,7 @@ AccountsCategoriesShort=Accounts tags/categories
ProjectsCategoriesShort=Projects tags/categories
UsersCategoriesShort=Users tags/categories
StockCategoriesShort=Warehouse tags/categories
-ThisCategoryHasNoProduct=This category does not contain any product.
-ThisCategoryHasNoSupplier=This category does not contain any vendor.
-ThisCategoryHasNoCustomer=This category does not contain any customer.
-ThisCategoryHasNoMember=This category does not contain any member.
-ThisCategoryHasNoContact=This category does not contain any contact.
-ThisCategoryHasNoAccount=This category does not contain any account.
-ThisCategoryHasNoProject=This category does not contain any project.
+ThisCategoryHasNoItems=This category does not contain any items.
CategId=Tag/category id
CatSupList=List of vendor tags/categories
CatCusList=List of customer/prospect tags/categories