32 require
'../main.inc.php';
33 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/categories.lib.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
39 $langs->loadLangs(array(
"categories",
"compta"));
42 $label =
GETPOST(
'label',
'alpha');
46 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
47 $massaction =
GETPOST(
'massaction',
'alpha');
49 $confirm =
GETPOST(
'confirm',
'alpha');
50 $cancel =
GETPOST(
'cancel',
'alpha');
51 $toselect =
GETPOST(
'toselect',
'array');
52 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'categorylist';
53 $backtopage =
GETPOST(
'backtopage',
'alpha');
54 $optioncss =
GETPOST(
'optioncss',
'aZ');
59 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
60 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
62 if (empty($page) || $page == -1 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') || (empty($toselect) && $massaction ===
'0')) {
65 $offset = $limit * $page;
66 $pageprev = $page - 1;
67 $pagenext = $page + 1;
69 if ($id ==
"" && $label ==
"") {
78 $result =
$object->fetch($id, $label);
85 if (is_numeric($type)) {
86 $type = Categorie::$MAP_ID_TO_CODE[$type];
90 $extrafields->fetch_name_optionals_label(
$object->table_element);
93 $hookmanager->initHooks(array(
'categorycard',
'globalcard'));
99 if ($confirm ==
'no') {
101 header(
"Location: ".$backtopage);
106 $parameters = array(
'type' => $type,
'id' => $id,
'label' => $label);
107 $reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
109 if ($id > 0 && $removeelem > 0 && $action ==
'unlink') {
110 if ($type == Categorie::TYPE_PRODUCT && ($user->hasRight(
'produit',
'creer') || $user->hasRight(
'service',
'creer'))) {
111 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
113 $result = $tmpobject->fetch($removeelem);
114 $elementtype =
'product';
115 } elseif ($type == Categorie::TYPE_SUPPLIER && $user->hasRight(
'societe',
'creer')) {
117 $result = $tmpobject->fetch($removeelem);
118 $elementtype =
'supplier';
119 } elseif ($type == Categorie::TYPE_CUSTOMER && $user->hasRight(
'societe',
'creer')) {
121 $result = $tmpobject->fetch($removeelem);
122 $elementtype =
'customer';
123 } elseif ($type == Categorie::TYPE_MEMBER && $user->hasRight(
'adherent',
'creer')) {
124 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
126 $result = $tmpobject->fetch($removeelem);
127 $elementtype =
'member';
128 } elseif ($type == Categorie::TYPE_CONTACT && $user->hasRight(
'societe',
'creer')) {
129 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
131 $result = $tmpobject->fetch($removeelem);
132 $elementtype =
'contact';
133 } elseif ($type == Categorie::TYPE_ACCOUNT && $user->hasRight(
'banque',
'configurer')) {
134 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
136 $result = $tmpobject->fetch($removeelem);
137 $elementtype =
'account';
138 } elseif ($type == Categorie::TYPE_PROJECT && $user->hasRight(
'projet',
'creer')) {
139 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
141 $result = $tmpobject->fetch($removeelem);
142 $elementtype =
'project';
143 } elseif ($type == Categorie::TYPE_USER && $user->hasRight(
'user',
'user',
'creer')) {
144 require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
145 $tmpobject =
new User($db);
146 $result = $tmpobject->fetch($removeelem);
147 $elementtype =
'user';
148 } elseif ($type == Categorie::TYPE_TICKET && $user->hasRight(
'ticket',
'write')) {
149 require_once DOL_DOCUMENT_ROOT.
'/ticket/class/ticket.class.php';
150 $tmpobject =
new Ticket($db);
151 $result = $tmpobject->fetch($removeelem);
152 $elementtype =
'ticket';
155 $result =
$object->del_type($tmpobject, $elementtype);
161 if ($user->hasRight(
'categorie',
'supprimer') && $action ==
'confirm_delete' && $confirm ==
'yes') {
162 if (
$object->delete($user) >= 0) {
164 header(
"Location: ".$backtopage);
167 header(
"Location: ".DOL_URL_ROOT.
'/categories/index.php?type='.$type);
175 if ($elemid && $action ==
'addintocategory' &&
177 ($type == Categorie::TYPE_PRODUCT && ($user->hasRight(
'produit',
'creer') || $user->hasRight(
'service',
'creer'))) ||
178 ($type == Categorie::TYPE_CUSTOMER && $user->hasRight(
'societe',
'creer')) ||
179 ($type == Categorie::TYPE_SUPPLIER && $user->hasRight(
'societe',
'creer')) ||
180 ($type == Categorie::TYPE_TICKET && $user->hasRight(
'ticket',
'write')) ||
181 ($type == Categorie::TYPE_PROJECT && $user->hasRight(
'projet',
'creer')) ||
182 ($type == Categorie::TYPE_MEMBER && $user->hasRight(
'adherent',
'creer')) ||
183 ($type == Categorie::TYPE_CONTACT && $user->hasRight(
'societe',
'creer')) ||
184 ($type == Categorie::TYPE_USER && $user->hasRight(
'user',
'user',
'creer')) ||
185 ($type == Categorie::TYPE_ACCOUNT && $user->hasRight(
'banque',
'configurer'))
187 if ($type == Categorie::TYPE_PRODUCT) {
188 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
190 $elementtype =
'product';
191 } elseif ($type == Categorie::TYPE_CUSTOMER) {
192 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
194 $elementtype =
'customer';
195 } elseif ($type == Categorie::TYPE_SUPPLIER) {
196 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
198 $elementtype =
'supplier';
199 } elseif ($type == Categorie::TYPE_TICKET) {
200 require_once DOL_DOCUMENT_ROOT.
'/ticket/class/ticket.class.php';
201 $newobject =
new Ticket($db);
202 $elementtype =
'ticket';
203 } elseif ($type == Categorie::TYPE_PROJECT) {
204 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
206 $elementtype =
'project';
207 } elseif ($type == Categorie::TYPE_MEMBER) {
208 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
210 $elementtype =
'member';
211 } elseif ($type == Categorie::TYPE_CONTACT) {
212 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
214 $elementtype =
'contact';
215 } elseif ($type == Categorie::TYPE_USER) {
216 require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
217 $newobject =
new User($db);
218 $elementtype =
'user';
219 } elseif ($type == Categorie::TYPE_ACCOUNT) {
220 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
222 $elementtype =
'bank_account';
226 $result = $newobject->fetch($elemid);
229 $result =
$object->add_type($newobject, $elementtype);
231 setEventMessages($langs->trans(
"WasAddedSuccessfully", $newobject->ref),
null,
'mesgs');
233 if (
$object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
234 setEventMessages($langs->trans(
"ObjectAlreadyLinkedToCategory"),
null,
'warnings');
246 $form =
new Form($db);
249 $arrayofjs = array(
'/includes/jquery/plugins/jquerytreeview/jquery.treeview.js',
'/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
250 $arrayofcss = array(
'/includes/jquery/plugins/jquerytreeview/jquery.treeview.css');
254 llxHeader(
"", $langs->trans(
"Categories"), $help_url,
'', 0, 0, $arrayofjs, $arrayofcss);
256 $title = Categorie::$MAP_TYPE_TITLE_AREA[$type];
261 $backtolist = (
GETPOST(
'backtolist') ?
GETPOST(
'backtolist') : DOL_URL_ROOT.
'/categories/index.php?leftmenu=cat&type='.urlencode($type));
262 $linkback =
'<a href="'.dol_sanitizeUrl($backtolist).
'">'.$langs->trans(
"BackToList").
'</a>';
265 $morehtmlref =
'<br><div class="refidno"><a href="'.DOL_URL_ROOT.
'/categories/index.php?leftmenu=cat&type='.urlencode($type).
'">'.$langs->trans(
"Root").
'</a> >> ';
266 $ways =
$object->print_all_ways(
" >> ",
'', 1);
267 foreach ($ways as $way) {
268 $morehtmlref .= $way.
"<br>\n";
270 $morehtmlref .=
'</div>';
272 dol_banner_tab(
$object,
'label', $linkback, ($user->socid ? 0 : 1),
'label',
'label', $morehtmlref,
'&type='.urlencode($type), 0,
'',
'', 1);
279 if ($action ==
'delete') {
281 print $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&type='.$type.
'&backtopage='.urlencode($backtopage), $langs->trans(
'DeleteCategory'), $langs->trans(
'ConfirmDeleteCategory'),
'confirm_delete',
'',
'', 2);
283 print $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&type='.$type, $langs->trans(
'DeleteCategory'), $langs->trans(
'ConfirmDeleteCategory'),
'confirm_delete',
'',
'', 1);
289 print
'<div class="fichecenter">';
290 print
'<div class="underbanner clearboth"></div>';
291 print
'<table class="border centpercent tableforfield">';
294 print
'<tr><td class="titlefield notopnoleft tdtop">';
295 print $langs->trans(
"Description").
'</td><td>';
300 print
'<tr><td class="notopnoleft">';
301 print $langs->trans(
"Color").
'</td><td>';
302 print $formother->showColor(
$object->color);
306 print
'<tr><td class="titlefield notopnoleft">';
307 print $langs->trans(
"Position").
'</td><td>';
312 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
324 print
"<div class='tabsAction'>\n";
325 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
329 if (empty($reshook)) {
330 if ($user->hasRight(
'categorie',
'creer')) {
331 $socid = (
$object->socid ?
"&socid=".$object->socid :
"");
332 print
'<a class="butAction" href="edit.php?id='.$object->id.$socid.
'&type='.$type.
'">'.$langs->trans(
"Modify").
'</a>';
335 if ($user->hasRight(
'categorie',
'supprimer')) {
336 print
'<a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?action=delete&token='.
newToken().
'&id='.
$object->id.
'&type='.$type.
'&backtolist='.urlencode($backtolist).
'">'.$langs->trans(
"Delete").
'</a>';
343 if ($user->hasRight(
'categorie',
'creer')) {
344 $link = DOL_URL_ROOT.
'/categories/card.php';
345 $link .=
'?action=create';
346 $link .=
'&type='.$type;
347 $link .=
'&catorigin='.$object->id;
348 $link .=
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?type='.$type.
'&id='.$id);
350 $newcardbutton =
'<div class="right">';
351 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewCategory'),
'',
'fa fa-plus-circle', $link);
352 $newcardbutton .=
'</div>';
360 print
'<div class="fichecenter">';
362 print
load_fiche_titre($langs->trans(
"SubCats"), $newcardbutton,
'object_category');
365 print
'<table class="liste nohover centpercent borderbottom">';
367 print
'<tr class="liste_titre">';
368 print
'<td>'.$langs->trans(
"SubCats").
'</td>';
370 print
'<td class="right">';
372 if (!empty($conf->use_javascript_ajax)) {
373 print
'<div id="iddivjstreecontrol">';
374 print
'<a class="notasortlink" href="#">'.img_picto(
'',
'folder').
' '.$langs->trans(
"UndoExpandAll").
'</a>';
376 print
'<a class="notasortlink" href="#">'.img_picto(
'',
'folder-open').
' '.$langs->trans(
"ExpandAll").
'</a>';
386 } elseif (count($cats) < 1) {
387 print
'<tr class="oddeven nobottom">';
388 print
'<td colspan="3"><span class="opacitymedium">'.$langs->trans(
"NoSubCat").
'</span></td>';
393 $fulltree = $categstatic->get_full_arbo($type,
$object->id, 1);
397 if ($type == Categorie::TYPE_MEMBER) {
398 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
400 if ($type == Categorie::TYPE_ACCOUNT) {
401 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
403 if ($type == Categorie::TYPE_PROJECT) {
404 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
406 if ($type == Categorie::TYPE_USER) {
407 require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
413 $data[] = array(
'rowid' => 0,
'fk_menu' => -1,
'title' =>
"racine",
'mainmenu' =>
'',
'leftmenu' =>
'',
'fk_mainmenu' =>
'',
'fk_leftmenu' =>
'');
414 foreach ($fulltree as $key => $val) {
415 $categstatic->id = $val[
'id'];
416 $categstatic->ref = $val[
'label'];
417 $categstatic->color = $val[
'color'];
418 $categstatic->type = $type;
424 $elements = $categstatic->getObjectsInCateg($type, 1);
426 $counter =
"<td class='left' width='40px;'>".(is_array($elements) ? count($elements) :
'0').
"</td>";
429 $color = $categstatic->color ?
' style="background: #'.sprintf(
"%06s", $categstatic->color).
';"' :
' style="background: #bbb"';
430 $li = $categstatic->getNomUrl(1,
'', 60,
'&backtolist='.urlencode($_SERVER[
"PHP_SELF"].
'?id='.$id.
'&type='.$type));
432 $entry =
'<table class="nobordernopadding centpercent">';
436 $entry .=
'<span class="noborderoncategories" '.$color.
'>'.$li.
'</span>';
441 $entry .=
'<td class="right" width="20px;">';
442 $entry .=
'<a href="'.DOL_URL_ROOT.
'/categories/viewcat.php?id='.$val[
'id'].
'&type='.$type.
'&backtolist='.urlencode($_SERVER[
"PHP_SELF"].
'?id='.$id.
'&type='.$type).
'">'.
img_view().
'</a>';
444 $entry .=
'<td class="right" width="20px;">';
445 $entry .=
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/categories/edit.php?id='.$val[
'id'].
'&type='.$type.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?id='.$id.
'&type='.$type).
'">'.
img_edit().
'</a>';
447 $entry .=
'<td class="right" width="20px;">';
448 $entry .=
'<a class="deletefilelink" href="'.DOL_URL_ROOT.
'/categories/viewcat.php?action=delete&token='.
newToken().
'&id='.$val[
'id'].
'&type='.$type.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?id='.$id.
'&type='.$type).
'&backtolist='.urlencode($_SERVER[
"PHP_SELF"].
'?id='.$id.
'&type='.$type).
'">'.
img_delete().
'</a>';
452 $entry .=
'</table>';
454 $data[] = array(
'rowid' => $val[
'rowid'],
'fk_menu' => $val[
'fk_parent'],
'entry' => $entry);
457 $nbofentries = (count($data) - 1);
458 if ($nbofentries > 0) {
459 require_once DOL_DOCUMENT_ROOT.
'/core/lib/treeview.lib.php';
460 print
'<tr class="pair">';
461 print
'<td colspan="3">';
469 print
'<tr class="pair">';
470 print
'<td colspan="3">';
471 print
'<table class="nobordernopadding">';
473 print
'<tr class="nobordernopadding">';
474 print
'<td>'.img_picto_common(
'',
'treemenu/branchbottom.gif').
'</td>';
475 print
'<td class="valignmiddle"><span class="opacitymedium">'.$langs->trans(
"NoCategoryYet").
'</span></td>';
476 print
'<td> </td>';
489 $arrayofmassactions = array(
495 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
501 if ($type == Categorie::TYPE_PRODUCT) {
502 if ($user->hasRight(
"product",
"read") || $user->hasRight(
"service",
"read")) {
503 $permission = ($user->hasRight(
'produit',
'creer') || $user->hasRight(
'service',
'creer'));
505 $prods =
$object->getObjectsInCateg($type, 0, $limit, $offset);
510 '@phan-var-force Product[] $prods';
512 $showclassifyform = 1;
513 if ($showclassifyform) {
515 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
516 print
'<input type="hidden" name="token" value="'.newToken().
'">';
517 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
518 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
519 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
520 print
'<input type="hidden" name="action" value="addintocategory">';
521 print
'<table class="noborder centpercent">';
522 print
'<tr class="liste_titre"><td>';
523 print $langs->trans(
"AddProductServiceIntoCategory").
' ';
524 $form->select_produits(
'',
'elemid',
'', 0, 0, -1, 2,
'', 1, array(), 0, 1, 0,
'', 0,
'',
null);
525 print
'<input type="submit" class="button buttongen" value="'.$langs->trans(
"ClassifyInCategory").
'"></td>';
531 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
532 print
'<input type="hidden" name="token" value="'.newToken().
'">';
533 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
534 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
535 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
536 print
'<input type="hidden" name="action" value="list">';
539 $param =
'&limit='.$limit.
'&id='.$id.
'&type='.$type;
540 $num = count($prods);
541 $nbtotalofrecords =
'';
542 $newcardbutton =
dolGetButtonTitle($langs->trans(
"AddProduct"),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/product/card.php?action=create&categories[]='.
$object->id.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?id='.
$object->id),
'', $user->rights->societe->creer);
545 print_barre_liste($langs->trans(
"ProductsAndServices"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'products', 0, $newcardbutton,
'', $limit);
548 print
'<table class="noborder centpercent">'.
"\n";
549 print
'<tr class="liste_titre"><td colspan="3">'.$langs->trans(
"Ref").
'</td></tr>'.
"\n";
551 if (count($prods) > 0) {
553 foreach ($prods as $prod) {
559 print
"\t".
'<tr class="oddeven">'.
"\n";
560 print
'<td class="nowrap" valign="top">';
561 print $prod->getNomUrl(1);
563 print
'<td class="tdtop">'.$prod->label.
"</td>\n";
565 print
'<td class="right">';
567 print
'<a class="reposition" href= "'.$_SERVER[
'PHP_SELF'].
"?".(empty($socid) ?
'id' :
'socid').
"=".((
int)
$object->id).
"&type=".urlencode($typeid).
"&action=unlink&token=".
newToken().
"&removeelem=".$prod->id.
'">';
568 print $langs->trans(
"DeleteFromCat");
569 print
img_picto($langs->trans(
"DeleteFromCat"),
'unlink',
'',
false, 0, 0,
'',
'paddingleft');
576 print
'<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans(
"ThisCategoryHasNoItems").
'</span></td></tr>';
580 print
'</form>'.
"\n";
583 print_barre_liste($langs->trans(
"ProductsAndServices"),
null, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'',
'',
'',
'products');
589 if ($type == Categorie::TYPE_CUSTOMER) {
590 if ($user->hasRight(
"societe",
"read")) {
591 $permission = $user->hasRight(
'societe',
'creer');
593 $socs =
$object->getObjectsInCateg($type, 0, $limit, $offset);
598 '@phan-var-force Societe[] $socs';
600 $showclassifyform = 1;
601 if ($showclassifyform) {
603 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
604 print
'<input type="hidden" name="token" value="'.newToken().
'">';
605 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
606 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
607 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
608 print
'<input type="hidden" name="action" value="addintocategory">';
609 print
'<table class="noborder centpercent">';
610 print
'<tr class="liste_titre"><td>';
611 print $langs->trans(
"AddCustomerIntoCategory").
' ';
612 $filter =
'(s.client:IN:1,3)';
613 print $form->select_company(
'',
'elemid', $filter);
614 print
'<input type="submit" class="button buttongen" value="'.$langs->trans(
"ClassifyInCategory").
'"></td>';
620 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
621 print
'<input type="hidden" name="token" value="'.newToken().
'">';
622 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
623 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
624 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
625 print
'<input type="hidden" name="action" value="list">';
628 $param =
'&limit='.$limit.
'&id='.$id.
'&type='.$type;
630 $nbtotalofrecords =
'';
631 $newcardbutton =
dolGetButtonTitle($langs->trans(
"AddThirdParty"),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/societe/card.php?action=create&client=3&custcats[]='.
$object->id.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?id='.
$object->id),
'', $user->rights->societe->creer);
634 print_barre_liste($langs->trans(
"Customers"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'companies', 0, $newcardbutton,
'', $limit);
636 print
'<table class="noborder centpercent">'.
"\n";
637 print
'<tr class="liste_titre"><td colspan="2">'.$langs->trans(
"Name").
'</td></tr>'.
"\n";
639 if (count($socs) > 0) {
641 foreach ($socs as $key => $soc) {
647 print
"\t".
'<tr class="oddeven">'.
"\n";
648 print
'<td class="nowrap tdtop">';
649 print $soc->getNomUrl(1);
652 print
'<td class="right">';
654 print
"<a href= '".$_SERVER[
'PHP_SELF'].
"?".(empty($socid) ?
'id' :
'socid').
"=".
$object->id.
"&type=".$typeid.
"&action=unlink&token=".
newToken().
"&removeelem=".$soc->id.
"'>";
655 print $langs->trans(
"DeleteFromCat");
656 print
img_picto($langs->trans(
"DeleteFromCat"),
'unlink',
'',
false, 0, 0,
'',
'paddingleft');
663 print
'<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans(
"ThisCategoryHasNoItems").
'</span></td></tr>';
667 print
'</form>'.
"\n";
670 print_barre_liste($langs->trans(
"Customers"),
null, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'',
'',
'',
'companies');
676 if ($type == Categorie::TYPE_SUPPLIER) {
677 if ($user->hasRight(
"fournisseur",
"read")) {
678 $permission = $user->hasRight(
'societe',
'creer');
680 $socs =
$object->getObjectsInCateg($type, 0, $limit, $offset);
686 '@phan-var-force Fournisseur[] $socs';
688 $showclassifyform = 1;
689 if ($showclassifyform) {
691 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
692 print
'<input type="hidden" name="token" value="'.newToken().
'">';
693 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
694 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
695 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
696 print
'<input type="hidden" name="action" value="addintocategory">';
697 print
'<table class="noborder centpercent">';
698 print
'<tr class="liste_titre"><td>';
699 print $langs->trans(
"AddSupplierIntoCategory").
' ';
700 $filter =
'(s.fournisseur:=:1)';
701 print $form->select_company(
'',
'elemid', $filter);
702 print
'<input type="submit" class="button buttongen" value="'.$langs->trans(
"ClassifyInCategory").
'"></td>';
708 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
709 print
'<input type="hidden" name="token" value="'.newToken().
'">';
710 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
711 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
712 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
713 print
'<input type="hidden" name="action" value="list">';
716 $param =
'&limit='.$limit.
'&id='.$id.
'&type='.$type;
718 $nbtotalofrecords =
'';
719 $newcardbutton =
dolGetButtonTitle($langs->trans(
"AddSupplier"),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/societe/card.php?action=create&fournisseur=1&suppcats[]='.
$object->id.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?id='.
$object->id),
'', $user->rights->societe->creer);
722 print_barre_liste($langs->trans(
"Suppliers"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'companies', 0, $newcardbutton,
'', $limit);
724 print
'<table class="noborder centpercent">'.
"\n";
725 print
'<tr class="liste_titre"><td colspan="2">'.$langs->trans(
"Name").
"</td></tr>\n";
727 if (count($socs) > 0) {
729 foreach ($socs as $soc) {
735 print
"\t".
'<tr class="oddeven">'.
"\n";
736 print
'<td class="nowrap tdtop">';
737 print $soc->getNomUrl(1);
740 print
'<td class="right">';
742 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
"?".(empty($socid) ?
'id' :
'socid').
"=".
$object->id.
"&type=".$typeid.
"&action=unlink&token=".
newToken().
"&removeelem=".$soc->id.($limit?
'&limit='.$limit:
'').
'">';
743 print $langs->trans(
"DeleteFromCat");
744 print
img_picto($langs->trans(
"DeleteFromCat"),
'unlink',
'',
false, 0, 0,
'',
'paddingleft');
752 print
'<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans(
"ThisCategoryHasNoItems").
'</span></td></tr>';
756 print
'</form>'.
"\n";
759 print_barre_liste($langs->trans(
"Suppliers"),
null, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'',
'',
'',
'companies');
765 if ($type == Categorie::TYPE_MEMBER) {
766 if ($user->hasRight(
"adherent",
"read")) {
767 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
769 $permission = $user->hasRight(
'adherent',
'creer');
771 $members =
$object->getObjectsInCateg($type, 0, $limit, $offset);
776 '@phan-var-force Adherent[] $members';
778 $showclassifyform = 1;
779 if ($showclassifyform) {
781 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
782 print
'<input type="hidden" name="token" value="'.newToken().
'">';
783 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
784 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
785 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
786 print
'<input type="hidden" name="action" value="addintocategory">';
787 print
'<table class="noborder centpercent">';
788 print
'<tr class="liste_titre"><td>';
789 print $langs->trans(
"AssignCategoryTo").
' ';
790 print $form->selectMembers(
'',
'elemid');
791 print
'<input type="submit" class="button buttongen" value="'.$langs->trans(
"Save").
'"></td>';
797 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
798 print
'<input type="hidden" name="token" value="'.newToken().
'">';
799 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
800 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
801 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
802 print
'<input type="hidden" name="action" value="list">';
805 $param =
'&limit='.$limit.
'&id='.$id.
'&type='.$type;
806 $num = count($members);
807 $nbtotalofrecords =
'';
808 $newcardbutton =
dolGetButtonTitle($langs->trans(
"AddMember"),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/adherents/card.php?action=create&memcats[]='.
$object->id.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?id='.
$object->id),
'', $user->hasRight(
'adherent',
'creer'));
811 print_barre_liste($langs->trans(
"Member"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'members', 0, $newcardbutton,
'', $limit);
813 print
'<table class="noborder centpecent">'.
"\n";
814 print
'<tr class="liste_titre"><td colspan="4">'.$langs->trans(
"Name").
'</td></tr>'.
"\n";
816 if (count($members) > 0) {
818 foreach ($members as $key => $member) {
824 print
"\t".
'<tr class="oddeven">'.
"\n";
825 print
'<td class="nowrap tdtop">';
826 $member->ref = $member->login;
827 print $member->getNomUrl(1, 0);
829 print
'<td class="tdtop">'.$member->lastname.
"</td>\n";
830 print
'<td class="tdtop">'.$member->firstname.
"</td>\n";
832 print
'<td class="right">';
834 print
"<a href= '".$_SERVER[
'PHP_SELF'].
"?".(empty($socid) ?
'id' :
'socid').
"=".
$object->id.
"&type=".$typeid.
"&action=unlink&token=".
newToken().
"&removeelem=".$member->id.
"'>";
835 print $langs->trans(
"DeleteFromCat");
836 print
img_picto($langs->trans(
"DeleteFromCat"),
'unlink',
'',
false, 0, 0,
'',
'paddingleft');
843 print
'<tr class="oddeven"><td colspan="4"><span class="opacitymedium">'.$langs->trans(
"ThisCategoryHasNoItems").
'</span></td></tr>';
847 print
'</form>'.
"\n";
850 print_barre_liste($langs->trans(
"Member"),
null, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'',
'',
'',
'members');
856 if ($type == Categorie::TYPE_CONTACT) {
857 if ($user->hasRight(
"societe",
"read")) {
858 $permission = $user->hasRight(
'societe',
'creer');
860 $contacts =
$object->getObjectsInCateg($type, 0, $limit, $offset);
861 if (is_numeric($contacts) && $contacts < 0) {
865 '@phan-var-force Contact[] $contacts';
867 $showclassifyform = 1;
868 if ($showclassifyform) {
870 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
871 print
'<input type="hidden" name="token" value="'.newToken().
'">';
872 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
873 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
874 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
875 print
'<input type="hidden" name="action" value="addintocategory">';
876 print
'<table class="noborder centpercent">';
877 print
'<tr class="liste_titre"><td>';
878 print $langs->trans(
"AssignCategoryTo").
' ';
880 print $form->select_contact(0,
'',
'elemid',
'',
'',
'', 0,
'maxwidth300 widthcentpercentminusx');
881 print
'<input type="submit" class="button buttongen" value="'.$langs->trans(
"ClassifyInCategory").
'"></td>';
886 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
887 print
'<input type="hidden" name="token" value="'.newToken().
'">';
888 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
889 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
890 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
891 print
'<input type="hidden" name="action" value="list">';
894 $param =
'&limit='.$limit.
'&id='.$id.
'&type='.$type;
895 $num = count($contacts);
896 $nbtotalofrecords =
'';
897 $newcardbutton =
dolGetButtonTitle($langs->trans(
"AddContact"),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/contact/card.php?action=create&contcats[]='.
$object->id.
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?id='.
$object->id),
'', $user->rights->societe->creer);
900 print_barre_liste($langs->trans(
"Contact"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'contact', 0, $newcardbutton,
'', $limit);
904 print
'<table class="noborder centpercent">'.
"\n";
905 print
'<tr class="liste_titre"><td colspan="2">'.$langs->trans(
"Ref").
'</td></tr>'.
"\n";
907 if (is_array($contacts) && count($contacts) > 0) {
909 foreach ($contacts as $key => $contact) {
915 print
"\t".
'<tr class="oddeven">'.
"\n";
916 print
'<td class="nowrap tdtop">';
917 print $contact->getNomUrl(1,
'category');
918 if ($contact->socid > 0) {
919 $objsoc->fetch($contact->socid);
921 print $objsoc->getNomUrl(1,
'contact');
925 print
'<td class="right">';
927 print
"<a href= '".$_SERVER[
'PHP_SELF'].
"?".(empty($socid) ?
'id' :
'socid').
"=".
$object->id.
"&type=".$typeid.
"&action=unlink&token=".
newToken().
"&removeelem=".$contact->id.
"'>";
928 print $langs->trans(
"DeleteFromCat");
929 print
img_picto($langs->trans(
"DeleteFromCat"),
'unlink',
'',
false, 0, 0,
'',
'paddingleft');
936 print
'<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans(
"ThisCategoryHasNoItems").
'</span></td></tr>';
940 print
'</form>'.
"\n";
943 print_barre_liste($langs->trans(
"Contact"),
null, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'',
'',
'',
'contact');
949 if ($type == Categorie::TYPE_ACCOUNT) {
950 if ($user->hasRight(
"banque",
"read")) {
951 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
953 $permission = $user->hasRight(
'banque',
'creer');
955 $accounts =
$object->getObjectsInCateg($type, 0, $limit, $offset);
960 '@phan-var-force Account[] $accounts';
962 $showclassifyform = 1;
963 if ($showclassifyform) {
965 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
966 print
'<input type="hidden" name="token" value="'.newToken().
'">';
967 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
968 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
969 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
970 print
'<input type="hidden" name="action" value="addintocategory">';
971 print
'<table class="noborder centpercent">';
972 print
'<tr class="liste_titre"><td>';
973 print $langs->trans(
"AddObjectIntoCategory").
' ';
974 print $form->select_comptes(
'',
'elemid', 0,
'', 0,
'', 0,
'', 1);
975 print
'<input type="submit" class="button buttongen" value="'.$langs->trans(
"ClassifyInCategory").
'"></td>';
981 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
982 print
'<input type="hidden" name="token" value="'.newToken().
'">';
983 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
984 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
985 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
986 print
'<input type="hidden" name="action" value="list">';
989 $param =
'&limit='.$limit.
'&id='.$id.
'&type='.$type;
990 $num = count($accounts);
991 $nbtotalofrecords =
'';
995 print_barre_liste($langs->trans(
"Account"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'bank_account', 0, $newcardbutton,
'', $limit);
997 print
'<table class="noborder centpecent">'.
"\n";
998 print
'<tr class="liste_titre"><td colspan="4">'.$langs->trans(
"Ref").
'</td></tr>'.
"\n";
1000 if (count($accounts) > 0) {
1002 foreach ($accounts as $key => $account) {
1008 print
"\t".
'<tr class="oddeven">'.
"\n";
1009 print
'<td class="nowrap tdtop">';
1010 print $account->getNomUrl(1, 0);
1012 print
'<td class="tdtop">'.$account->bank.
"</td>\n";
1013 print
'<td class="tdtop">'.$account->number.
"</td>\n";
1015 print
'<td class="right">';
1017 print
"<a href= '".$_SERVER[
'PHP_SELF'].
"?".(empty($socid) ?
'id' :
'socid').
"=".
$object->id.
"&type=".$typeid.
"&action=unlink&token=".
newToken().
"&removeelem=".$account->id.
"'>";
1018 print $langs->trans(
"DeleteFromCat");
1019 print
img_picto($langs->trans(
"DeleteFromCat"),
'unlink',
'',
false, 0, 0,
'',
'paddingleft');
1026 print
'<tr class="oddeven"><td colspan="4"><span class="opacitymedium">'.$langs->trans(
"ThisCategoryHasNoItems").
'</span></td></tr>';
1030 print
'</form>'.
"\n";
1033 print_barre_liste($langs->trans(
"Banque"),
null, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'',
'',
'',
'bank');
1039 if ($type == Categorie::TYPE_PROJECT) {
1040 if ($user->hasRight(
"project",
"read")) {
1041 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
1043 $permission = $user->hasRight(
'projet',
'creer');
1045 $objects =
$object->getObjectsInCateg($type, 0, $limit, $offset);
1050 '@phan-var-force Project $object';
1052 $showclassifyform = 1;
1053 if ($showclassifyform) {
1055 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
1056 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1057 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
1058 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
1059 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
1060 print
'<input type="hidden" name="action" value="addintocategory">';
1061 print
'<table class="noborder centpercent">';
1062 print
'<tr class="liste_titre"><td>';
1063 print $langs->trans(
"AddObjectIntoCategory").
' ';
1064 $form->selectProjects(
'',
'elemid');
1065 print
'<input type="submit" class="button buttongen" value="'.$langs->trans(
"ClassifyInCategory").
'"></td>';
1071 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
1072 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1073 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
1074 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
1075 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
1076 print
'<input type="hidden" name="action" value="list">';
1079 $param =
'&limit='.$limit.
'&id='.$id.
'&type='.$type;
1080 $num = count($objects);
1081 $nbtotalofrecords =
'';
1082 $newcardbutton =
'';
1085 print_barre_liste($langs->trans(
"Project"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'project', 0, $newcardbutton,
'', $limit);
1087 print
'<table class="noborder centpecent">'.
"\n";
1088 print
'<tr class="liste_titre"><td colspan="4">'.$langs->trans(
"Ref").
'</td></tr>'.
"\n";
1090 if (count($objects) > 0) {
1092 foreach ($objects as $key => $project) {
1098 print
"\t".
'<tr class="oddeven">'.
"\n";
1099 print
'<td class="nowrap tdtop">';
1100 print $project->getNomUrl(1);
1102 print
'<td class="tdtop">'.$project->ref.
"</td>\n";
1103 print
'<td class="tdtop">'.$project->title.
"</td>\n";
1105 print
'<td class="right">';
1107 print
"<a href= '".$_SERVER[
'PHP_SELF'].
"?".(empty($socid) ?
'id' :
'socid').
"=".
$object->id.
"&type=".$typeid.
"&action=unlink&token=".
newToken().
"&removeelem=".$project->id.
"'>";
1108 print $langs->trans(
"DeleteFromCat");
1109 print
img_picto($langs->trans(
"DeleteFromCat"),
'unlink',
'',
false, 0, 0,
'',
'paddingleft');
1116 print
'<tr class="oddeven"><td colspan="4"><span class="opacitymedium">'.$langs->trans(
"ThisCategoryHasNoItems").
'</span></td></tr>';
1120 print
'</form>'.
"\n";
1123 print_barre_liste($langs->trans(
"Project"),
null, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'',
'',
'',
'project');
1129 if ($type == Categorie::TYPE_USER) {
1130 if ($user->hasRight(
"user",
"user",
"read")) {
1131 require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
1133 $users =
$object->getObjectsInCateg($type);
1138 '@phan-var-force User[] $users';
1140 $showclassifyform = 1;
1141 if ($showclassifyform) {
1143 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
1144 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1145 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
1146 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
1147 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
1148 print
'<input type="hidden" name="action" value="addintocategory">';
1149 print
'<table class="noborder centpercent">';
1150 print
'<tr class="liste_titre"><td>';
1152 print
img_picto(
'', $type,
'class="pictofixedwidth"');
1153 print $form->select_dolusers(
'',
'elemid', 1,
null, 0,
'',
'', $force_entity);
1154 print
'<input type="submit" class="button buttongen" value="'.$langs->trans(
"ClassifyInCategory").
'"></td>';
1159 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
1160 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1161 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
1162 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
1163 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
1164 print
'<input type="hidden" name="action" value="list">';
1168 $param =
'&limit='.$limit.
'&id='.$id.
'&type='.$type;
1169 $num = count($users);
1170 $nbtotalofrecords =
'';
1171 $newcardbutton =
'';
1174 print_barre_liste($langs->trans(
"Users"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'user', 0,
'',
'', $limit);
1176 print
'<table class="noborder centpecent">'.
"\n";
1177 print
'<tr class="liste_titre"><td colspan="3">'.$langs->trans(
"Users").
' <span class="badge">'.$num.
'</span></td></tr>'.
"\n";
1179 if (count($users) > 0) {
1181 foreach ($users as $key => $userentry) {
1182 print
"\t".
'<tr class="oddeven">'.
"\n";
1183 print
'<td class="nowrap tdtop">';
1184 print $userentry->getNomUrl(-1);
1186 print
'<td class="tdtop">'.$userentry->job.
"</td>\n";
1189 print
'<td class="right">';
1190 if ($user->hasRight(
'user',
'user',
'creer')) {
1191 print
"<a href= '".$_SERVER[
'PHP_SELF'].
"?".(empty($socid) ?
'id' :
'socid').
"=".
$object->id.
"&type=".$typeid.
"&action=unlink&token=".
newToken().
"&removeelem=".$userentry->id.
"'>";
1192 print $langs->trans(
"DeleteFromCat");
1193 print
img_picto($langs->trans(
"DeleteFromCat"),
'unlink',
'',
false, 0, 0,
'',
'paddingleft');
1200 print
'<tr class="oddeven"><td colspan="3"><span class="opacitymedium">'.$langs->trans(
"ThisCategoryHasNoItems").
'</span></td></tr>';
1204 print
'</form>'.
"\n";
1207 print_barre_liste($langs->trans(
"Users"),
null, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'',
'',
'',
'user');
1214 if ($type == Categorie::TYPE_WAREHOUSE) {
1215 if ($user->hasRight(
"stock",
"read")) {
1216 $permission = $user->hasRight(
'stock',
'creer');
1218 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
1220 $objects =
$object->getObjectsInCateg($type, 0, $limit, $offset);
1225 '@phan-var-force Entrepot[] $objects';
1226 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
1227 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1228 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
1229 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
1230 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
1231 print
'<input type="hidden" name="action" value="list">';
1234 $param =
'&limit='.$limit.
'&id='.$id.
'&type='.$type;
1235 $num = count($objects);
1236 $nbtotalofrecords =
'';
1237 $newcardbutton =
'';
1240 print_barre_liste($langs->trans(
"Warehouses"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'stock', 0, $newcardbutton,
'', $limit);
1242 print
'<table class="noborder centpecent">'.
"\n";
1243 print
'<tr class="liste_titre"><td colspan="4">'.$langs->trans(
"Ref").
'</td></tr>'.
"\n";
1245 if (count($objects) > 0) {
1247 foreach ($objects as $key => $warehouse) {
1253 print
"\t".
'<tr class="oddeven">'.
"\n";
1254 print
'<td class="nowrap tdtop">';
1255 print $warehouse->getNomUrl(1);
1257 print
'<td class="tdtop">'.$warehouse->ref.
"</td>\n";
1258 print
'<td class="tdtop">'.$warehouse->lieu.
"</td>\n";
1260 print
'<td class="right">';
1262 print
"<a href= '".$_SERVER[
'PHP_SELF'].
"?".(empty($socid) ?
'id' :
'socid').
"=".
$object->id.
"&type=".$typeid.
"&action=unlink&token=".
newToken().
"&removeelem=".$warehouse->id.
"'>";
1263 print $langs->trans(
"DeleteFromCat");
1264 print
img_picto($langs->trans(
"DeleteFromCat"),
'unlink',
'',
false, 0, 0,
'',
'paddingleft');
1271 print
'<tr class="oddeven"><td colspan="4"><span class="opacitymedium">'.$langs->trans(
"ThisCategoryHasNoItems").
'</span></td></tr>';
1275 print
'</form>'.
"\n";
1278 print_barre_liste($langs->trans(
"Warehouse"),
null, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'',
'',
'',
'stock');
1284 if ($type == Categorie::TYPE_TICKET) {
1285 if ($user->hasRight(
"ticket",
"read")) {
1286 $permission = ($user->rights->categorie->creer || $user->rights->categorie->creer);
1288 $tickets =
$object->getObjectsInCateg($type, 0, $limit, $offset);
1293 '@phan-var-force Ticket[] $tickets';
1295 $showclassifyform = 1;
1296 if ($showclassifyform) {
1298 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
1299 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1300 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
1301 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
1302 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
1303 print
'<input type="hidden" name="action" value="addintocategory">';
1304 print
'<table class="noborder centpercent">';
1305 print
'<tr class="liste_titre"><td>';
1306 print $langs->trans(
"AddTicketIntoCategory").
' ';
1307 $form->selectTickets(
'',
'elemid');
1308 print
'<input type="submit" class="button buttongen" value="'.$langs->trans(
"ClassifyInCategory").
'"></td>';
1314 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
1315 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1316 print
'<input type="hidden" name="typeid" value="'.$typeid.
'">';
1317 print
'<input type="hidden" name="type" value="'.$typeid.
'">';
1318 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
1319 print
'<input type="hidden" name="action" value="list">';
1322 $param =
'&limit='.$limit.
'&id='.$id.
'&type='.$type;
1323 $num = count($tickets);
1324 $nbtotalofrecords =
'';
1325 $newcardbutton =
'';
1328 print_barre_liste($langs->trans(
"Ticket"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'ticket', 0, $newcardbutton,
'', $limit);
1331 print
'<table class="noborder centpercent">'.
"\n";
1332 print
'<tr class="liste_titre"><td colspan="3">'.$langs->trans(
"Ref").
'</td></tr>'.
"\n";
1334 if (count($tickets) > 0) {
1336 foreach ($tickets as $ticket) {
1342 print
"\t".
'<tr class="oddeven">'.
"\n";
1343 print
'<td class="nowrap tdtop">';
1344 print $ticket->getNomUrl(1);
1346 print
'<td class="tdtop">'.$ticket->label.
"</td>\n";
1348 print
'<td class="right">';
1350 print
"<a href= '".$_SERVER[
'PHP_SELF'].
"?".(empty($socid) ?
'id' :
'socid').
"=".
$object->id.
"&type=".$typeid.
"&action=unlink&token=".
newToken().
"&removeelem=".$ticket->id.
"'>";
1351 print $langs->trans(
"DeleteFromCat");
1352 print
img_picto($langs->trans(
"DeleteFromCat"),
'unlink',
'',
false, 0, 0,
'',
'paddingleft');
1359 print
'<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans(
"ThisCategoryHasNoItems").
'</span></td></tr>';
1363 print
'</form>'.
"\n";
1366 print_barre_liste($langs->trans(
"Ticket"),
null, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'',
'',
'',
'ticket');
1372 $parameters = array(
'type' => $type,
'id' => $id,
'label' => $label);
1373 $reshook = $hookmanager->executeHooks(
'addMoreCategoriesList', $parameters,
$object, $action);
if($user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
categories_prepare_head(Categorie $object, $type)
Prepare array with list of tabs.
Class to manage bank accounts.
Class to manage members of a foundation.
Class to manage categories.
Class to manage products or services.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_view($titlealt='default', $float=0, $other='class="valignmiddle"')
Show logo view card.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_htmlcleanlastbr($stringtodecode)
This function remove all ending and br at end.
print_barre_liste($title, $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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
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...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
Class to generate the form for creating a new ticket.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree', $donoresetalreadyloaded=0, $showfk=0, $moreparam='')
Recursive function to output a tree.