30 require
'../main.inc.php';
31 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/categories.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
37 $langs->load(
"categories");
40 $label =
GETPOST(
'label',
'alpha');
41 $type =
GETPOST(
'type',
'aZ09');
42 $removeelem =
GETPOST(
'removeelem',
'int');
43 $elemid =
GETPOST(
'elemid',
'int');
45 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
46 $massaction =
GETPOST(
'massaction',
'alpha');
47 $show_files =
GETPOST(
'show_files',
'int');
48 $confirm =
GETPOST(
'confirm',
'alpha');
49 $cancel =
GETPOST(
'cancel',
'alpha');
50 $toselect =
GETPOST(
'toselect',
'array');
51 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'categorylist';
52 $backtopage =
GETPOST(
'backtopage',
'alpha');
53 $optioncss =
GETPOST(
'optioncss',
'aZ');
57 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
58 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
59 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
61 if (empty($page) || $page == -1 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') || (empty($toselect) && $massaction ===
'0')) { $page = 0; }
62 $offset = $limit * $page;
63 $pageprev = $page - 1;
64 $pagenext = $page + 1;
66 if ($id ==
"" && $label ==
"")
76 $result = $object->fetch($id, $label, $type);
80 $object->fetch_optionals();
85 $objecttype = $object->type;
86 if (is_numeric($objecttype)) $objecttype = Categorie::$MAP_ID_TO_CODE[$objecttype];
87 if ($type ===
'') $type = $objecttype;
89 if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type];
92 $extrafields->fetch_name_optionals_label($object->table_element);
95 $hookmanager->initHooks(array(
'categorycard',
'globalcard'));
98 if ($objecttype != $type) {
99 print 'Error: Value for type parameter does not match value of the type of the category with id='.$id;
107 $parameters = array();
108 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
110 if ($id > 0 && $removeelem > 0)
112 if ($type == Categorie::TYPE_PRODUCT && ($user->rights->produit->creer || $user->rights->service->creer))
114 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
116 $result = $tmpobject->fetch($removeelem);
117 $elementtype =
'product';
118 } elseif ($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer)
121 $result = $tmpobject->fetch($removeelem);
122 $elementtype =
'supplier';
123 } elseif ($type == Categorie::TYPE_CUSTOMER && $user->rights->societe->creer)
126 $result = $tmpobject->fetch($removeelem);
127 $elementtype =
'customer';
128 } elseif ($type == Categorie::TYPE_MEMBER && $user->rights->adherent->creer)
130 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
132 $result = $tmpobject->fetch($removeelem);
133 $elementtype =
'member';
134 } elseif ($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer) {
135 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
137 $result = $tmpobject->fetch($removeelem);
138 $elementtype =
'contact';
139 } elseif ($type == Categorie::TYPE_ACCOUNT && $user->rights->banque->configurer)
141 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
143 $result = $tmpobject->fetch($removeelem);
144 $elementtype =
'account';
145 } elseif ($type == Categorie::TYPE_PROJECT && $user->rights->projet->creer)
147 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
149 $result = $tmpobject->fetch($removeelem);
150 $elementtype =
'project';
151 } elseif ($type == Categorie::TYPE_USER && $user->rights->user->user->creer)
153 require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
154 $tmpobject =
new User($db);
155 $result = $tmpobject->fetch($removeelem);
156 $elementtype =
'user';
159 $result = $object->del_type($tmpobject, $elementtype);
163 if ($user->rights->categorie->supprimer && $action ==
'confirm_delete' && $confirm ==
'yes')
165 if ($object->delete($user) >= 0)
167 header(
"Location: ".DOL_URL_ROOT.
'/categories/index.php?type='.$type);
174 if ($elemid && $action ==
'addintocategory' &&
175 (($type == Categorie::TYPE_PRODUCT && ($user->rights->produit->creer || $user->rights->service->creer)) ||
176 ($type == Categorie::TYPE_CUSTOMER && $user->rights->societe->creer) ||
177 ($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer)
180 if ($type == Categorie::TYPE_PRODUCT)
182 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
184 $elementtype =
'product';
185 } elseif ($type == Categorie::TYPE_CUSTOMER)
187 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
189 $elementtype =
'customer';
190 } elseif ($type == Categorie::TYPE_SUPPLIER)
192 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
194 $elementtype =
'supplier';
196 $result = $newobject->fetch($elemid);
199 $result = $object->add_type($newobject, $elementtype);
202 setEventMessages($langs->trans(
"WasAddedSuccessfully", $newobject->ref), null,
'mesgs');
204 if ($cat->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS')
206 setEventMessages($langs->trans(
"ObjectAlreadyLinkedToCategory"), null,
'warnings');
218 $form =
new Form($db);
221 $arrayofjs = array(
'/includes/jquery/plugins/jquerytreeview/jquery.treeview.js',
'/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
222 $arrayofcss = array(
'/includes/jquery/plugins/jquerytreeview/jquery.treeview.css');
224 llxHeader(
"", $langs->trans(
"Categories"), $helpurl,
'', 0, 0, $arrayofjs, $arrayofcss);
226 $title = Categorie::$MAP_TYPE_TITLE_AREA[$type];
232 $backtolist = (
GETPOST(
'backtolist') ?
GETPOST(
'backtolist') : DOL_URL_ROOT.
'/categories/index.php?leftmenu=cat&type='.$type);
233 $linkback =
'<a href="'.$backtolist.
'">'.$langs->trans(
"BackToList").
'</a>';
234 $object->next_prev_filter =
' type = '.$object->type;
235 $object->ref = $object->label;
236 $morehtmlref =
'<br><div class="refidno"><a href="'.DOL_URL_ROOT.
'/categories/index.php?leftmenu=cat&type='.$type.
'">'.$langs->trans(
"Root").
'</a> >> ';
237 $ways = $object->print_all_ways(
" >> ",
'', 1);
238 foreach ($ways as $way)
240 $morehtmlref .= $way.
"<br>\n";
242 $morehtmlref .=
'</div>';
244 dol_banner_tab($object,
'label', $linkback, ($user->socid ? 0 : 1),
'label',
'label', $morehtmlref,
'&type='.$type, 0,
'',
'', 1);
251 if ($action ==
'delete')
253 print $form->formconfirm(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&type='.$type, $langs->trans(
'DeleteCategory'), $langs->trans(
'ConfirmDeleteCategory'),
'confirm_delete',
'',
'', 1);
258 print '<div class="fichecenter">';
259 print '<div class="underbanner clearboth"></div>';
260 print '<table class="border centpercent tableforfield">';
263 print '<tr><td class="titlefield notopnoleft tdtop">';
264 print $langs->trans(
"Description").
'</td><td>';
269 print '<tr><td class="notopnoleft">';
270 print $langs->trans(
"Color").
'</td><td>';
271 print $formother->showColor($object->color);
275 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
287 print "<div class='tabsAction'>\n";
288 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
289 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
290 if (empty($reshook)) {
291 if ($user->rights->categorie->creer)
293 $socid = ($object->socid ?
"&socid=".$object->socid :
"");
294 print '<a class="butAction" href="edit.php?id='.$object->id.$socid.
'&type='.$type.
'">'.$langs->trans(
"Modify").
'</a>';
297 if ($user->rights->categorie->supprimer)
299 print '<a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?action=delete&token='.
newToken().
'&id='.$object->id.
'&type='.$type.
'">'.$langs->trans(
"Delete").
'</a>';
306 if (!empty($user->rights->categorie->creer))
308 $link = DOL_URL_ROOT.
'/categories/card.php';
309 $link .=
'?action=create';
310 $link .=
'&type='.$type;
311 $link .=
'&catorigin='.$object->id;
312 $link .=
'&backtopage='.urlencode(
$_SERVER[
"PHP_SELF"].
'?type='.$type.
'&id='.$id);
314 $newcardbutton =
'<div class="right">';
315 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewCategory'),
'',
'fa fa-plus-circle', $link);
316 $newcardbutton .=
'</div>';
324 print '<div class="fichecenter">';
329 print '<table class="liste nohover" width="100%">';
331 print
'<tr class="liste_titre">';
332 print
'<td>'.$langs->trans(
"SubCats").
'</td>';
334 print
'<td class="right">';
336 if (!empty($conf->use_javascript_ajax))
338 print
'<div id="iddivjstreecontrol">';
339 print
'<a class="notasortlink" href="#">'.img_picto(
'',
'folder').
' '.$langs->trans(
"UndoExpandAll").
'</a>';
341 print
'<a class="notasortlink" href="#">'.img_picto(
'',
'folder-open').
' '.$langs->trans(
"ExpandAll").
'</a>';
348 $cats = $object->get_filles();
352 } elseif (count($cats) < 1)
354 print
'<tr class="oddeven">';
355 print
'<td colspan="3" class="opacitymedium">'.$langs->trans(
"NoSubCat").
'</td>';
360 $fulltree = $categstatic->get_full_arbo($type, $object->id, 1);
363 if ($conf->global->CATEGORY_SHOW_COUNTS)
365 if ($type == Categorie::TYPE_MEMBER) require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
366 if ($type == Categorie::TYPE_ACCOUNT) require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
367 if ($type == Categorie::TYPE_PROJECT) require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
368 if ($type == Categorie::TYPE_USER) require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
373 $data[] = array(
'rowid'=>0,
'fk_menu'=>-1,
'title'=>
"racine",
'mainmenu'=>
'',
'leftmenu'=>
'',
'fk_mainmenu'=>
'',
'fk_leftmenu'=>
'');
374 foreach ($fulltree as $key => $val)
376 $categstatic->id = $val[
'id'];
377 $categstatic->ref = $val[
'label'];
378 $categstatic->color = $val[
'color'];
379 $categstatic->type = $type;
384 if ($conf->global->CATEGORY_SHOW_COUNTS)
387 $elements = $type == Categorie::TYPE_ACCOUNT
388 ? $categstatic->getObjectsInCateg(
"account", 1)
389 : $categstatic->getObjectsInCateg($type, 1);
391 $counter = is_countable($elements) ? count($elements) : 0;
394 $color = $categstatic->color ?
' style="background: #'.$categstatic->color.
';"' :
' style="background: #aaa"';
396 $entry =
'<table class="nobordernopadding centpercent">';
400 $entry .=
'<span class="noborderoncategories" '.$color.
'>'.$categstatic->getNomUrl(1,
'', 60).
'</span>';
403 $entry .=
'<td class="left" width="40px;">'.$counter.
'</td>';
405 $entry .=
'<td class="right" width="20px;">';
406 $entry .=
'<a href="'.DOL_URL_ROOT.
'/categories/viewcat.php?id='.$val[
'id'].
'&type='.$type.
'">'.
img_view().
'</a>';
410 $entry .=
'</table>';
412 $data[] = array(
'rowid' => $val[
'rowid'],
'fk_menu' => $val[
'fk_parent'],
'entry' => $entry);
415 if ((count($data) - 1))
417 require_once DOL_DOCUMENT_ROOT.
'/core/lib/treeview.lib.php';
418 print
'<tr class="pair">';
419 print
'<td colspan="3">';
427 print
'<tr class="pair">';
428 print
'<td colspan="3">';
429 print
'<table class="nobordernopadding">';
431 print
'<tr class="nobordernopadding">';
432 print
'<td>'.img_picto_common(
'',
'treemenu/branchbottom.gif').
'</td>';
433 print
'<td valign="middle">'.$langs->trans(
"NoCategoryYet").
'</td>';
434 print
'<td> </td>';
447 $arrayofmassactions = array(
453 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
459 if ($type == Categorie::TYPE_PRODUCT)
461 $permission = ($user->rights->produit->creer || $user->rights->service->creer);
463 $prods = $object->getObjectsInCateg($type, 0, $limit, $offset);
469 $showclassifyform = 1;
470 if ($showclassifyform)
473 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
474 print
'<input type="hidden" name="token" value="'.newToken().
'">';
475 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
476 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
477 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
478 print
'<input type="hidden" name="action" value="addintocategory">';
479 print
'<table class="noborder centpercent">';
480 print
'<tr class="liste_titre"><td>';
481 print $langs->trans(
"AddProductServiceIntoCategory").
' ';
482 $form->select_produits(
'',
'elemid',
'', 0, 0, -1, 2,
'', 1);
483 print
'<input type="submit" class="button buttongen" value="'.$langs->trans(
"ClassifyInCategory").
'"></td>';
489 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
490 print
'<input type="hidden" name="token" value="'.newToken().
'">';
491 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
492 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
493 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
494 print
'<input type="hidden" name="action" value="list">';
497 $param =
'&limit='.$limit.
'&id='.$id.
'&type='.$type; $num = count($prods); $nbtotalofrecords =
''; $newcardbutton =
'';
498 print_barre_liste($langs->trans(
"ProductsAndServices"), $page,
$_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'products', 0, $newcardbutton,
'', $limit);
501 print
'<table class="noborder centpercent">'.
"\n";
502 print
'<tr class="liste_titre"><td colspan="3">'.$langs->trans(
"Ref").
'</td></tr>'.
"\n";
504 if (count($prods) > 0)
507 foreach ($prods as $prod)
510 if ($i > $limit)
break;
512 print
"\t".
'<tr class="oddeven">'.
"\n";
513 print
'<td class="nowrap" valign="top">';
514 print $prod->getNomUrl(1);
516 print
'<td class="tdtop">'.$prod->label.
"</td>\n";
518 print
'<td class="right">';
521 print
"<a href= '".$_SERVER[
'PHP_SELF'].
"?".(empty($socid) ?
'id' :
'socid').
"=".$object->id.
"&type=".$typeid.
"&removeelem=".$prod->id.
"'>";
522 print $langs->trans(
"DeleteFromCat");
523 print
img_picto($langs->trans(
"DeleteFromCat"),
'unlink',
'',
false, 0, 0,
'',
'paddingleft');
530 print
'<tr class="oddeven"><td colspan="2" class="opacitymedium">'.$langs->trans(
"ThisCategoryHasNoItems").
'</td></tr>';
534 print
'</form>'.
"\n";
538 if ($type == Categorie::TYPE_CUSTOMER)
540 $permission = $user->rights->societe->creer;
542 $socs = $object->getObjectsInCateg($type, 0, $limit, $offset);
548 $showclassifyform = 1;
549 if ($showclassifyform)
552 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
553 print
'<input type="hidden" name="token" value="'.newToken().
'">';
554 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
555 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
556 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
557 print
'<input type="hidden" name="action" value="addintocategory">';
558 print
'<table class="noborder centpercent">';
559 print
'<tr class="liste_titre"><td>';
560 print $langs->trans(
"AddCustomerIntoCategory").
' ';
561 print $form->select_company(
'',
'elemid',
's.client IN (1,3)');
562 print
'<input type="submit" class="button buttongen" value="'.$langs->trans(
"ClassifyInCategory").
'"></td>';
568 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
569 print
'<input type="hidden" name="token" value="'.newToken().
'">';
570 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
571 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
572 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
573 print
'<input type="hidden" name="action" value="list">';
576 $param =
'&limit='.$limit.
'&id='.$id.
'&type='.$type; $num = count($socs); $nbtotalofrecords =
''; $newcardbutton =
'';
577 print_barre_liste($langs->trans(
"Customers"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'companies', 0, $newcardbutton,
'', $limit);
579 print
'<table class="noborder centpercent">'.
"\n";
580 print
'<tr class="liste_titre"><td colspan="2">'.$langs->trans(
"Name").
'</td></tr>'.
"\n";
582 if (count($socs) > 0)
585 foreach ($socs as $key => $soc)
588 if ($i > $limit)
break;
590 print
"\t".
'<tr class="oddeven">'.
"\n";
591 print
'<td class="nowrap" valign="top">';
592 print $soc->getNomUrl(1);
595 print
'<td class="right">';
598 print
"<a href= '".$_SERVER[
'PHP_SELF'].
"?".(empty($socid) ?
'id' :
'socid').
"=".$object->id.
"&type=".$typeid.
"&removeelem=".$soc->id.
"'>";
599 print $langs->trans(
"DeleteFromCat");
600 print
img_picto($langs->trans(
"DeleteFromCat"),
'unlink',
'',
false, 0, 0,
'',
'paddingleft');
607 print
'<tr class="oddeven"><td colspan="2" class="opacitymedium">'.$langs->trans(
"ThisCategoryHasNoItems").
'</td></tr>';
611 print
'</form>'.
"\n";
616 if ($type == Categorie::TYPE_SUPPLIER)
618 $permission = $user->rights->societe->creer;
620 $socs = $object->getObjectsInCateg($type, 0, $limit, $offset);
626 $showclassifyform = 1;
627 if ($showclassifyform)
630 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
631 print
'<input type="hidden" name="token" value="'.newToken().
'">';
632 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
633 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
634 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
635 print
'<input type="hidden" name="action" value="addintocategory">';
636 print
'<table class="noborder centpercent">';
637 print
'<tr class="liste_titre"><td>';
638 print $langs->trans(
"AddSupplierIntoCategory").
' ';
639 print $form->select_company(
'',
'elemid',
's.fournisseur = 1');
640 print
'<input type="submit" class="button buttongen" value="'.$langs->trans(
"ClassifyInCategory").
'"></td>';
646 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
647 print
'<input type="hidden" name="token" value="'.newToken().
'">';
648 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
649 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
650 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
651 print
'<input type="hidden" name="action" value="list">';
654 $param =
'&limit='.$limit.
'&id='.$id.
'&type='.$type; $num = count($socs); $nbtotalofrecords =
''; $newcardbutton =
'';
655 print_barre_liste($langs->trans(
"Suppliers"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'companies', 0, $newcardbutton,
'', $limit);
657 print
'<table class="noborder centpercent">'.
"\n";
658 print
'<tr class="liste_titre"><td colspan="2">'.$langs->trans(
"Name").
"</td></tr>\n";
660 if (count($socs) > 0)
663 foreach ($socs as $soc)
666 if ($i > $limit)
break;
668 print
"\t".
'<tr class="oddeven">'.
"\n";
669 print
'<td class="nowrap" valign="top">';
670 print $soc->getNomUrl(1);
673 print
'<td class="right">';
676 print
"<a href= '".$_SERVER[
'PHP_SELF'].
"?".(empty($socid) ?
'id' :
'socid').
"=".$object->id.
"&type=".$typeid.
"&removeelem=".$soc->id.
"'>";
677 print $langs->trans(
"DeleteFromCat");
678 print
img_picto($langs->trans(
"DeleteFromCat"),
'unlink',
'',
false, 0, 0,
'',
'paddingleft');
686 print
'<tr class="oddeven"><td colspan="2" class="opacitymedium">'.$langs->trans(
"ThisCategoryHasNoItems").
'</td></tr>';
690 print
'</form>'.
"\n";
695 if ($type == Categorie::TYPE_MEMBER)
697 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
699 $permission = $user->rights->adherent->creer;
701 $prods = $object->getObjectsInCateg($type, 0, $limit, $offset);
706 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
707 print
'<input type="hidden" name="token" value="'.newToken().
'">';
708 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
709 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
710 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
711 print
'<input type="hidden" name="action" value="list">';
714 $param =
'&limit='.$limit.
'&id='.$id.
'&type='.$type; $num = count($prods); $nbtotalofrecords =
''; $newcardbutton =
'';
715 print_barre_liste($langs->trans(
"Member"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'members', 0, $newcardbutton,
'', $limit);
717 print
"<table class='noborder' width='100%'>\n";
718 print
'<tr class="liste_titre"><td colspan="4">'.$langs->trans(
"Name").
'</td></tr>'.
"\n";
720 if (count($prods) > 0)
723 foreach ($prods as $key => $member)
726 if ($i > $limit)
break;
728 print
"\t".
'<tr class="oddeven">'.
"\n";
729 print
'<td class="nowrap" valign="top">';
730 $member->ref = $member->login;
731 print $member->getNomUrl(1, 0);
733 print
'<td class="tdtop">'.$member->lastname.
"</td>\n";
734 print
'<td class="tdtop">'.$member->firstname.
"</td>\n";
736 print
'<td class="right">';
739 print
"<a href= '".$_SERVER[
'PHP_SELF'].
"?".(empty($socid) ?
'id' :
'socid').
"=".$object->id.
"&type=".$typeid.
"&removeelem=".$member->id.
"'>";
740 print $langs->trans(
"DeleteFromCat");
741 print
img_picto($langs->trans(
"DeleteFromCat"),
'unlink',
'',
false, 0, 0,
'',
'paddingleft');
747 print
'<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans(
"ThisCategoryHasNoItems").
'</td></tr>';
751 print
'</form>'.
"\n";
756 if ($type == Categorie::TYPE_CONTACT)
758 $permission = $user->rights->societe->creer;
760 $contacts = $object->getObjectsInCateg($type, 0, $limit, $offset);
765 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
766 print
'<input type="hidden" name="token" value="'.newToken().
'">';
767 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
768 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
769 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
770 print
'<input type="hidden" name="action" value="list">';
773 $param =
'&limit='.$limit.
'&id='.$id.
'&type='.$type;
774 $num = count($contacts);
775 $nbtotalofrecords =
'';
777 print_barre_liste($langs->trans(
"Contact"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'contact', 0, $newcardbutton,
'', $limit);
779 print
'<table class="noborder centpercent">'.
"\n";
780 print
'<tr class="liste_titre"><td colspan="2">'.$langs->trans(
"Ref").
'</td></tr>'.
"\n";
782 if (count($contacts) > 0)
785 foreach ($contacts as $key => $contact)
788 if ($i > $limit)
break;
790 print
"\t".
'<tr class="oddeven">'.
"\n";
791 print
'<td class="nowrap" valign="top">';
792 print $contact->getNomUrl(1,
'category');
795 print
'<td class="right">';
798 print
"<a href= '".$_SERVER[
'PHP_SELF'].
"?".(empty($socid) ?
'id' :
'socid').
"=".$object->id.
"&type=".$typeid.
"&removeelem=".$contact->id.
"'>";
799 print $langs->trans(
"DeleteFromCat");
800 print
img_picto($langs->trans(
"DeleteFromCat"),
'unlink',
'',
false, 0, 0,
'',
'paddingleft');
807 print
'<tr class="oddeven"><td colspan="2" class="opacitymedium">'.$langs->trans(
"ThisCategoryHasNoItems").
'</td></tr>';
811 print
'</form>'.
"\n";
816 if ($type == Categorie::TYPE_ACCOUNT)
818 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
820 $permission = $user->rights->banque->creer;
822 $accounts = $object->getObjectsInCateg($type, 0, $limit, $offset);
827 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
828 print
'<input type="hidden" name="token" value="'.newToken().
'">';
829 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
830 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
831 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
832 print
'<input type="hidden" name="action" value="list">';
835 $param =
'&limit='.$limit.
'&id='.$id.
'&type='.$type; $num = count($accounts); $nbtotalofrecords =
''; $newcardbutton =
'';
836 print_barre_liste($langs->trans(
"Account"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'bank_account', 0, $newcardbutton,
'', $limit);
838 print
"<table class='noborder' width='100%'>\n";
839 print
'<tr class="liste_titre"><td colspan="4">'.$langs->trans(
"Ref").
'</td></tr>'.
"\n";
841 if (count($accounts) > 0)
844 foreach ($accounts as $key => $account)
847 if ($i > $limit)
break;
849 print
"\t".
'<tr class="oddeven">'.
"\n";
850 print
'<td class="nowrap" valign="top">';
851 print $account->getNomUrl(1, 0);
853 print
'<td class="tdtop">'.$account->bank.
"</td>\n";
854 print
'<td class="tdtop">'.$account->number.
"</td>\n";
856 print
'<td class="right">';
859 print
"<a href= '".$_SERVER[
'PHP_SELF'].
"?".(empty($socid) ?
'id' :
'socid').
"=".$object->id.
"&type=".$typeid.
"&removeelem=".$account->id.
"'>";
860 print $langs->trans(
"DeleteFromCat");
861 print
img_picto($langs->trans(
"DeleteFromCat"),
'unlink',
'',
false, 0, 0,
'',
'paddingleft');
867 print
'<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans(
"ThisCategoryHasNoItems").
'</td></tr>';
871 print
'</form>'.
"\n";
876 if ($type == Categorie::TYPE_PROJECT)
878 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
880 $permission = $user->rights->projet->creer;
882 $objects = $object->getObjectsInCateg($type, 0, $limit, $offset);
887 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
888 print
'<input type="hidden" name="token" value="'.newToken().
'">';
889 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
890 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
891 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
892 print
'<input type="hidden" name="action" value="list">';
895 $param =
'&limit='.$limit.
'&id='.$id.
'&type='.$type; $num = count($objects); $nbtotalofrecords =
''; $newcardbutton =
'';
897 print_barre_liste($langs->trans(
"Project"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'project', 0, $newcardbutton,
'', $limit);
899 print
"<table class='noborder' width='100%'>\n";
900 print
'<tr class="liste_titre"><td colspan="4">'.$langs->trans(
"Ref").
'</td></tr>'.
"\n";
902 if (count($objects) > 0)
905 foreach ($objects as $key => $project)
908 if ($i > $limit)
break;
910 print
"\t".
'<tr class="oddeven">'.
"\n";
911 print
'<td class="nowrap" valign="top">';
912 print $project->getNomUrl(1);
914 print
'<td class="tdtop">'.$project->ref.
"</td>\n";
915 print
'<td class="tdtop">'.$project->title.
"</td>\n";
917 print
'<td class="right">';
920 print
"<a href= '".$_SERVER[
'PHP_SELF'].
"?".(empty($socid) ?
'id' :
'socid').
"=".$object->id.
"&type=".$typeid.
"&removeelem=".$project->id.
"'>";
921 print $langs->trans(
"DeleteFromCat");
922 print
img_picto($langs->trans(
"DeleteFromCat"),
'unlink',
'',
false, 0, 0,
'',
'paddingleft');
928 print
'<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans(
"ThisCategoryHasNoItems").
'</td></tr>';
932 print
'</form>'.
"\n";
937 if ($type == Categorie::TYPE_USER)
939 require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
941 $users = $object->getObjectsInCateg($type);
946 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
947 print
'<input type="hidden" name="token" value="'.newToken().
'">';
948 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
949 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
950 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
951 print
'<input type="hidden" name="action" value="list">';
955 $param =
'&limit='.$limit.
'&id='.$id.
'&type='.$type;
956 $num = count($users);
958 print_barre_liste($langs->trans(
"Users"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num,
'',
'user', 0,
'',
'', $limit);
960 print
"<table class='noborder' width='100%'>\n";
961 print
'<tr class="liste_titre"><td colspan="4">'.$langs->trans(
"Users").
' <span class="badge">'.$num.
'</span></td></tr>'.
"\n";
963 if (count($users) > 0)
966 foreach ($users as $key => $userentry)
968 print
"\t".
'<tr class="oddeven">'.
"\n";
969 print
'<td class="nowrap" valign="top">';
970 print $userentry->getNomUrl(1);
972 print
'<td class="tdtop">'.$userentry->job.
"</td>\n";
975 print
'<td class="right">';
976 if ($user->rights->user->user->creer)
978 print
"<a href= '".$_SERVER[
'PHP_SELF'].
"?".(empty($socid) ?
'id' :
'socid').
"=".$object->id.
"&type=".$type.
"&removeelem=".$userentry->id.
"'>";
979 print $langs->trans(
"DeleteFromCat");
980 print
img_picto($langs->trans(
"DeleteFromCat"),
'unlink',
'',
false, 0, 0,
'',
'paddingleft');
986 print
'<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans(
"ThisCategoryHasNoItems").
'</td></tr>';
990 print
'</form>'.
"\n";
996 if ($type == Categorie::TYPE_WAREHOUSE)
998 $permission = $user->rights->stock->creer;
1000 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
1002 $objects = $object->getObjectsInCateg($type, 0, $limit, $offset);
1007 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
1008 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1009 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
1010 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
1011 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
1012 print
'<input type="hidden" name="action" value="list">';
1015 $param =
'&limit='.$limit.
'&id='.$id.
'&type='.$type; $num = count($objects); $nbtotalofrecords =
''; $newcardbutton =
'';
1017 print_barre_liste($langs->trans(
"Warehouses"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'stock', 0, $newcardbutton,
'', $limit);
1019 print
"<table class='noborder' width='100%'>\n";
1020 print
'<tr class="liste_titre"><td colspan="4">'.$langs->trans(
"Ref").
'</td></tr>'.
"\n";
1022 if (count($objects) > 0)
1025 foreach ($objects as $key => $project)
1028 if ($i > $limit)
break;
1030 print
"\t".
'<tr class="oddeven">'.
"\n";
1031 print
'<td class="nowrap" valign="top">';
1032 print $project->getNomUrl(1);
1034 print
'<td class="tdtop">'.$project->ref.
"</td>\n";
1035 print
'<td class="tdtop">'.$project->title.
"</td>\n";
1037 print
'<td class="right">';
1040 print
"<a href= '".$_SERVER[
'PHP_SELF'].
"?".(empty($socid) ?
'id' :
'socid').
"=".$object->id.
"&type=".$typeid.
"&removeelem=".$project->id.
"'>";
1041 print $langs->trans(
"DeleteFromCat");
1042 print
img_picto($langs->trans(
"DeleteFromCat"),
'unlink',
'',
false, 0, 0,
'',
'paddingleft');
1048 print
'<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans(
"ThisCategoryHasNoItems").
'</td></tr>';
1052 print
'</form>'.
"\n";
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dolGetButtonTitle($label, $helpText= '', $iconClass= 'fa fa-file', $url= '', $id= '', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
Class to manage products or services.
Class to manage Dolibarr users.
categories_prepare_head(Categorie $object, $type)
Prepare array with list of tabs.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom= 'UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
Class to manage bank accounts.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options= '', $sortfield= '', $sortorder= '', $morehtmlcenter= '', $num=-1, $totalnboflines= '', $picto= 'generic', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow= '')
Print a title with navigation controls for pagination.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage categories.
Class to manage projects.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Class to manage members of a foundation.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
dol_htmlcleanlastbr($stringtodecode)
This function remove all ending and br at end.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_view($titlealt= 'default', $float=0, $other= '')
Show logo view card.
dol_banner_tab($object, $paramid, $morehtml= '', $shownav=1, $fieldid= 'rowid', $fieldref= 'ref', $morehtmlref= '', $moreparam= '', $nodbprefix=0, $morehtmlleft= '', $morehtmlstatus= '', $onlybanner=0, $morehtmlright= '')
Show tab footer of a card.
tree_recur($tab, $pere, $rang, $iddivjstree= 'iddivjstree', $donoresetalreadyloaded=0, $showfk=0, $moreparam= '')
Recursive function to output a tree.