diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 513d411d188..a61d29b6a48 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -292,6 +292,7 @@ if ($user->rights->categorie->supprimer) print ""; +$newcardbutton = ''; if (! empty($user->rights->categorie->creer)) { $link = DOL_URL_ROOT.'/categories/card.php'; @@ -300,9 +301,9 @@ if (! empty($user->rights->categorie->creer)) $link .= '&catorigin='.$object->id; $link .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type.'&id='.$id); - print '
'; - print dolGetButtonTitle($langs->trans('NewCategory'), '', 'fa fa-plus-circle', $link); - print "
"; + $newcardbutton = '
'; + $newcardbutton .= dolGetButtonTitle($langs->trans('NewCategory'), '', 'fa fa-plus-circle', $link); + $newcardbutton .= '
'; } @@ -311,6 +312,10 @@ if (! empty($user->rights->categorie->creer)) */ print '
'; + +print load_fiche_titre($langs->trans("SubCats"), $newcardbutton); + + print ''; print ''; @@ -442,19 +447,23 @@ $arrayofmassactions = array( ); $massactionbutton = $form->selectMassAction('', $arrayofmassactions); +$typeid = $type; + + // List of products or services (type is type of category) if ($type == Categorie::TYPE_PRODUCT) { - $prods = $object->getObjectsInCateg("product", 0, $limit, $offset); + $permission = ($user->rights->produit->creer || $user->rights->service->creer); + + $prods = $object->getObjectsInCateg($type, 0, $limit, $offset); if ($prods < 0) { dol_print_error($db, $prods->error, $prods->errors); } else { - $showclassifyform = 1; $typeid = Categorie::TYPE_PRODUCT; - // Form to add record into a category + $showclassifyform = 1; if ($showclassifyform) { print '
'; @@ -468,7 +477,7 @@ if ($type == Categorie::TYPE_PRODUCT) print ''; + print ''; print ''; print '
'; print $langs->trans("AddProductServiceIntoCategory").'  '; $form->select_produits('', 'elemid', '', 0, 0, -1, 2, '', 1); - 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 ''."\n"; if (count($prods) > 0) @@ -503,17 +513,11 @@ if ($type == Categorie::TYPE_PRODUCT) print '\n"; // Link to delete from category print ''; @@ -522,7 +526,7 @@ if ($type == Categorie::TYPE_PRODUCT) } else { - print ''; + print ''; } print "
'.$langs->trans("Ref").'
'.$prod->label."'; - $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 ""; print $langs->trans("DeleteFromCat"); - print img_picto($langs->trans("DeleteFromCat"), 'unlink'); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); print ""; } print '
'.$langs->trans("ThisCategoryHasNoProduct").'
'.$langs->trans("ThisCategoryHasNoItems").'
\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 '\n"; @@ -567,17 +573,11 @@ if ($type == Categorie::TYPE_SUPPLIER) print "\n"; // Link to delete from category print ''; @@ -587,7 +587,7 @@ if ($type == Categorie::TYPE_SUPPLIER) } else { - print ''; + print ''; } print "
'.$langs->trans("Name")."
'; - $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 ""; print $langs->trans("DeleteFromCat"); - print img_picto($langs->trans("DeleteFromCat"), 'unlink'); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); print ""; } print '
'.$langs->trans("ThisCategoryHasNoSupplier").'
'.$langs->trans("ThisCategoryHasNoItems").'
\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 ''."\n"; @@ -632,17 +634,11 @@ if ($type == Categorie::TYPE_CUSTOMER) print "\n"; // Link to delete from category print ''; @@ -651,7 +647,7 @@ if ($type == Categorie::TYPE_CUSTOMER) } else { - print ''; + print ''; } print "
'.$langs->trans("Name").'
'; - $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 ""; print $langs->trans("DeleteFromCat"); - print img_picto($langs->trans("DeleteFromCat"), 'unlink'); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); print ""; } print '
'.$langs->trans("ThisCategoryHasNoCustomer").'
'.$langs->trans("ThisCategoryHasNoItems").'
\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 ''."\n"; @@ -702,17 +700,11 @@ if ($type == Categorie::TYPE_MEMBER) print '\n"; // Link to delete from category print '\n"; @@ -720,7 +712,7 @@ if ($type == Categorie::TYPE_MEMBER) } else { - print ''; + print ''; } print "
'.$langs->trans("Name").'
'.$member->firstname."'; - $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 ""; print $langs->trans("DeleteFromCat"); - print img_picto($langs->trans("DeleteFromCat"), 'unlink'); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); print ""; } print "
'.$langs->trans("ThisCategoryHasNoMember").'
'.$langs->trans("ThisCategoryHasNoItems").'
\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 ''."\n"; @@ -766,17 +763,11 @@ if ($type == Categorie::TYPE_CONTACT) print "\n"; // Link to delete from category print ''; @@ -785,7 +776,7 @@ if ($type == Categorie::TYPE_CONTACT) } else { - print ''; + print ''; } print "
'.$langs->trans("Ref").'
'; - $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 ""; print $langs->trans("DeleteFromCat"); - print img_picto($langs->trans("DeleteFromCat"), 'unlink'); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); print ""; } print '
'.$langs->trans("ThisCategoryHasNoContact").'
'.$langs->trans("ThisCategoryHasNoItems").'
\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 ''."\n"; @@ -835,17 +828,11 @@ if ($type == Categorie::TYPE_ACCOUNT) print '\n"; // Link to delete from category print '\n"; @@ -853,7 +840,7 @@ if ($type == Categorie::TYPE_ACCOUNT) } else { - print ''; + print ''; } print "
'.$langs->trans("Ref").'
'.$account->number."'; - $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 ""; print $langs->trans("DeleteFromCat"); - print img_picto($langs->trans("DeleteFromCat"), 'unlink'); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); print ""; } print "
'.$langs->trans("ThisCategoryHasNoAccount").'
'.$langs->trans("ThisCategoryHasNoItems").'
\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 ''."\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 '\n"; // Link to delete from category print '\n"; @@ -921,7 +905,7 @@ if ($type == Categorie::TYPE_PROJECT) } else { - print ''; + print ''; } print "
'.$langs->trans("Ref").'
'.$project->title."'; - $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 ""; print $langs->trans("DeleteFromCat"); - print img_picto($langs->trans("DeleteFromCat"), 'unlink'); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); print ""; } print "
'.$langs->trans("ThisCategoryHasNoProject").'
'.$langs->trans("ThisCategoryHasNoItems").'
\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 '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + + print '
'; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($objects); $nbtotalofrecords = ''; $newcardbutton = ''; + + print_barre_liste($langs->trans("Users"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'user', 0, $newcardbutton, '', $limit); + print "\n"; print ''."\n"; @@ -962,7 +957,7 @@ if ($type == Categorie::TYPE_USER) { print ""; 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"; @@ -970,12 +965,81 @@ if ($type == Categorie::TYPE_USER) } else { - print ''; + print ''; } print "
'.$langs->trans("Users").' '.count($users).'
'.$langs->trans("ThisCategoryHasNoUsers").'
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; + + 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 '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + + print '
'; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($objects); $nbtotalofrecords = ''; $newcardbutton = ''; + + print_barre_liste($langs->trans("Warehouses"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit); + + print "\n"; + print ''."\n"; + + if (count($objects) > 0) + { + $i = 0; + foreach ($objects as $key => $project) + { + $i++; + if ($i > $limit) break; + + print "\t".''."\n"; + print '\n"; + print '\n"; + print '\n"; + // Link to delete from category + print '\n"; + } + } + else + { + print ''; + } + print "
'.$langs->trans("Ref").'
'; + print $project->getNomUrl(1); + print "'.$project->ref."'.$project->title."'; + if ($permission) + { + print ""; + print $langs->trans("DeleteFromCat"); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); + print ""; + } + print "
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; + + 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