dolibarr 25.0.0-alpha
viewcat.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
3 * Copyright (C) 2006-2024 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
5 * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
6 * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
7 * Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
8 * Copyright (C) 2020 Josep Lluís Amador <joseplluis@lliuretic.cat>
9 * Copyright (C) 2022-2023 Solution Libre SAS <contact@solution-libre.fr>
10 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
11 * Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
12 * Copyright (C) 2024-2025 Alexandre Spangaro <alexandre@inovea-conseil.com>
13 * Copyright (C) 2023-2024 Charlene Benke <charlene@patas-monkey.com>
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 3 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program. If not, see <https://www.gnu.org/licenses/>.
27 */
28
35// Load Dolibarr environment
36require '../main.inc.php';
45require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
46require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php';
47require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
48
49// Load translation files required by the page
50$langs->loadLangs(array("categories", "compta", "mrp", "stocks"));
51
52$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
53$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
54$show_files = GETPOSTINT('show_files'); // Show files area generated by bulk actions ?
55$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
56$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
57$toselect = GETPOST('toselect', 'array:int'); // Array of ids of elements selected into a list
58$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'categorylist'; // To manage different context of search
59$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
60$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
61
62$id = GETPOSTINT('id');
63$label = GETPOST('label', 'alpha');
64$removeelem = GETPOSTINT('removeelem');
65$elemid = GETPOSTINT('elemid');
66
67if (GETPOST('addintocategory')) {
68 $action = 'addintocategory';
69}
70
71
72// Load variable for pagination
73$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
74$sortfield = GETPOST('sortfield', 'aZ09comma');
75$sortorder = GETPOST('sortorder', 'aZ09comma');
76$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
77if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) {
78 $page = 0;
79} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
80$offset = $limit * $page;
81$pageprev = $page - 1;
82$pagenext = $page + 1;
83
84if ($id == "" && $label == "") {
85 dol_print_error(null, 'Missing parameter id');
86 exit();
87}
88
89// Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array array
90$hookmanager->initHooks(array('categorycard', 'globalcard'));
91
92$object = new Categorie($db);
93$result = $object->fetch($id, $label);
94if ($result <= 0) {
95 dol_print_error($db, $object->error);
96 exit;
97}
98
99// Security check
100$result = restrictedArea($user, 'categorie', $object->id, '&category');
101
102$type = $object->type;
103if (is_numeric($type)) {
104 $type = array_search($type, $object->MAP_ID); // For backward compatibility
105}
106
107$extrafields->fetch_name_optionals_label($object->table_element);
108
109/*
110 * Actions
111 */
112
113if ($confirm == 'no') {
114 if ($backtopage) {
115 header("Location: ".$backtopage);
116 exit;
117 }
118}
119$parameters = array('type' => $type, 'id' => $id, 'label' => $label);
120$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
121// Remove element from category
122if ($id > 0 && $removeelem > 0 && $action == 'unlink') { // Test on permission not required here. Done later according to type of object.
123 $tmpobject = null;
124 $elementtype = '';
125 if ($type == Categorie::TYPE_PRODUCT && ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer'))) {
126 require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
127 $tmpobject = new Product($db);
128 $result = $tmpobject->fetch($removeelem);
129 $elementtype = 'product';
130 } elseif ($type == Categorie::TYPE_SUPPLIER && $user->hasRight('societe', 'creer')) {
131 $tmpobject = new Societe($db);
132 $result = $tmpobject->fetch($removeelem);
133 $elementtype = 'supplier';
134 } elseif ($type == Categorie::TYPE_CUSTOMER && $user->hasRight('societe', 'creer')) {
135 $tmpobject = new Societe($db);
136 $result = $tmpobject->fetch($removeelem);
137 $elementtype = 'customer';
138 } elseif ($type == Categorie::TYPE_MEMBER && $user->hasRight('adherent', 'creer')) {
139 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
140 $tmpobject = new Adherent($db);
141 $result = $tmpobject->fetch($removeelem);
142 $elementtype = 'member';
143 } elseif ($type == Categorie::TYPE_CONTACT && $user->hasRight('societe', 'creer')) {
144 require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
145 $tmpobject = new Contact($db);
146 $result = $tmpobject->fetch($removeelem);
147 $elementtype = 'contact';
148 } elseif ($type == Categorie::TYPE_ACCOUNT && $user->hasRight('banque', 'configurer')) {
149 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
150 $tmpobject = new Account($db);
151 $result = $tmpobject->fetch($removeelem);
152 $elementtype = 'account';
153 } elseif ($type == Categorie::TYPE_PROJECT && $user->hasRight('projet', 'creer')) {
154 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
155 $tmpobject = new Project($db);
156 $result = $tmpobject->fetch($removeelem);
157 $elementtype = 'project';
158 } elseif ($type == Categorie::TYPE_USER && $user->hasRight('user', 'user', 'creer')) {
159 require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
160 $tmpobject = new User($db);
161 $result = $tmpobject->fetch($removeelem);
162 $elementtype = 'user';
163 } elseif ($type == Categorie::TYPE_TICKET && $user->hasRight('ticket', 'write')) {
164 require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
165 $tmpobject = new Ticket($db);
166 $result = $tmpobject->fetch($removeelem);
167 $elementtype = 'ticket';
168 } elseif ($type == Categorie::TYPE_FICHINTER && $user->hasRight('ficheinter', 'write')) {
169 require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
170 $tmpobject = new Fichinter($db);
171 $result = $tmpobject->fetch($removeelem);
172 $elementtype = 'fichinter';
173 } elseif ($type == Categorie::TYPE_ORDER && $user->hasRight('commande', 'creer')) {
174 require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
175 $tmpobject = new Commande($db);
176 $result = $tmpobject->fetch($removeelem);
177 $elementtype = 'order';
178 } elseif ($type == Categorie::TYPE_MO && $user->hasRight('mrp', 'write')) {
179 require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php';
180 $tmpobject = new Mo($db);
181 $result = $tmpobject->fetch($removeelem);
182 $elementtype = 'mo';
183 } elseif ($type == Categorie::TYPE_INVOICE && $user->hasRight('facture', 'creer')) {
184 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
185 $tmpobject = new Facture($db);
186 $result = $tmpobject->fetch($removeelem);
187 $elementtype = 'invoice';
188 } elseif ($type == Categorie::TYPE_SUPPLIER_ORDER && $user->hasRight('fournisseur', 'commande', 'creer')) {
189 require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
190 $tmpobject = new CommandeFournisseur($db);
191 $result = $tmpobject->fetch($removeelem);
192 $elementtype = 'supplier_order';
193 } else {
194 dol_print_error(null, "Not supported value of type = ".$type);
195 $result = -100;
196 }
197
198 if ($tmpobject !== null) {
199 // also enter here when item was not found to report error
200 $result = $object->del_type($tmpobject, $elementtype);
201 if ($result < 0) {
202 dol_print_error(null, $object->error);
203 }
204 }
205}
206
207if ($user->hasRight('categorie', 'supprimer') && $action == 'confirm_delete' && $confirm == 'yes') {
208 $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
209 if ($object->delete($user) >= 0) {
210 if ($backtopage) {
211 header("Location: ".$backtopage);
212 exit;
213 } else {
214 header("Location: ".dolBuildUrl(DOL_URL_ROOT.'/categories/categorie_list.php', ['type' => $type]));
215 exit;
216 }
217 } else {
218 setEventMessages($object->error, $object->errors, 'errors');
219 }
220}
221
222if ($elemid && $action == 'addintocategory') { // Test on permission not required here. Done just after depending on object type
223 $newobject = null;
224 $elementtype = '';
225 if ($type == Categorie::TYPE_PRODUCT && ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer'))) {
226 require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
227 $newobject = new Product($db);
228 $elementtype = 'product';
229 } elseif ($type == Categorie::TYPE_CUSTOMER && $user->hasRight('societe', 'creer')) {
230 require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
231 $newobject = new Societe($db);
232 $elementtype = 'customer';
233 } elseif ($type == Categorie::TYPE_SUPPLIER && $user->hasRight('societe', 'creer')) {
234 require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
235 $newobject = new Societe($db);
236 $elementtype = 'supplier';
237 } elseif ($type == Categorie::TYPE_TICKET && $user->hasRight('ticket', 'write')) {
238 require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
239 $newobject = new Ticket($db);
240 $elementtype = 'ticket';
241 } elseif ($type == Categorie::TYPE_FICHINTER && $user->hasRight('ficheinter', 'write')) {
242 require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
243 $newobject = new Fichinter($db);
244 $elementtype = 'fichinter';
245 } elseif ($type == Categorie::TYPE_PROJECT && $user->hasRight('projet', 'creer')) {
246 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
247 $newobject = new Project($db);
248 $elementtype = 'project';
249 } elseif ($type == Categorie::TYPE_MEMBER && $user->hasRight('adherent', 'creer')) {
250 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
251 $newobject = new Adherent($db);
252 $elementtype = 'member';
253 } elseif ($type == Categorie::TYPE_CONTACT && $user->hasRight('societe', 'creer')) {
254 require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
255 $newobject = new Contact($db);
256 $elementtype = 'contact';
257 } elseif ($type == Categorie::TYPE_USER && $user->hasRight('user', 'user', 'creer')) {
258 require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
259 $newobject = new User($db);
260 $elementtype = 'user';
261 } elseif ($type == Categorie::TYPE_ACCOUNT && $user->hasRight('banque', 'configurer')) {
262 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
263 $newobject = new Account($db);
264 $elementtype = 'bank_account';
265 } elseif ($type == Categorie::TYPE_ORDER && $user->hasRight('commande', 'creer')) {
266 require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
267 $newobject = new Commande($db);
268 $elementtype = 'order';
269 } elseif ($type == Categorie::TYPE_MO && $user->hasRight('mrp', 'write')) {
270 require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php';
271 $newobject = new Mo($db);
272 $elementtype = 'mo';
273 } elseif ($type == Categorie::TYPE_INVOICE && $user->hasRight('facture', 'creer')) {
274 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
275 $newobject = new Facture($db);
276 $elementtype = 'invoice';
277 } elseif ($type == Categorie::TYPE_SUPPLIER_ORDER && $user->hasRight('fournisseur', 'commande', 'creer')) {
278 require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
279 $newobject = new CommandeFournisseur($db);
280 $elementtype = 'supplier_order';
281 } elseif ($type == Categorie::TYPE_SUPPLIER_INVOICE && $user->hasRight('fournisseur', 'facture', 'creer')) {
282 require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
283 $newobject = new FactureFournisseur($db);
284 $elementtype = 'supplier_invoice';
285 } else {
286 dol_print_error(null, "Not supported value of type = ".$type);
287 }
288 if ($newobject !== null) {
289 $result = $newobject->fetch($elemid);
290 }
291
292 if ($result >= 0 && $newobject !== null) {
293 // Add into category
294 $result = $object->add_type($newobject, $elementtype);
295 }
296 if ($result >= 0) {
297 setEventMessages($langs->trans("WasAddedSuccessfully", $newobject->ref), null, 'mesgs');
298 } else {
299 if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
300 setEventMessages($langs->trans("ObjectAlreadyLinkedToCategory"), null, 'warnings');
301 } else {
302 setEventMessages($object->error, $object->errors, 'errors');
303 }
304 }
305}
306
307
308/*
309 * View
310 */
311
312$form = new Form($db);
313$formother = new FormOther($db);
314
315$arrayofjs = array(
316 '/public/includes/jquery/plugins/jquerytreeview/jquery.treeview.js',
317 '/public/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'
318);
319$arrayofcss = array('/public/includes/jquery/plugins/jquerytreeview/jquery.treeview.css');
320
321$help_url = '';
322
323llxHeader("", $langs->trans("Categories"), $help_url, '', 0, 0, $arrayofjs, $arrayofcss);
324
325$title = $langs->trans("Categories");
326$title .= ' ('.$langs->trans(empty(Categorie::$MAP_TYPE_TITLE_AREA[$type]) ? ucfirst($type) : Categorie::$MAP_TYPE_TITLE_AREA[$type]).')';
327
328$head = categories_prepare_head($object, $type);
329print dol_get_fiche_head($head, 'card', $langs->trans($title), -1, 'category');
330
331$backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/categorie_list.php?leftmenu=cat&type='.urlencode($type));
332$linkback = '<a href="'.dol_sanitizeUrl($backtolist).'">'.$langs->trans("BackToList").'</a>';
333$object->next_prev_filter = 'type:=:'.((int) $object->type);
334$object->ref = $object->label;
335$morehtmlref = '<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/categorie_list.php?leftmenu=cat&type='.urlencode($type).'">'.$langs->trans("Root").'</a>';
336$morehtmlref .= ' > ';
337$ways = $object->print_all_ways("auto", '', 1, 0, 1);
338foreach ($ways as $way) {
339 $morehtmlref .= $way."<br>\n";
340}
341$morehtmlref .= '</div>';
342
343dol_banner_tab($object, 'label', $linkback, ($user->socid ? 0 : 1), 'label', 'label', $morehtmlref, '&type='.urlencode($type), 0, '', '', 1);
344
345
346// Confirmation of deletion
347if ($action == 'delete') {
348 if ($backtopage) {
349 print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.urlencode($type).'&backtopage='.urlencode($backtopage), $langs->trans('DeleteCategory'), $langs->trans('ConfirmDeleteCategory'), 'confirm_delete', '', '', 2);
350 } else {
351 print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.urlencode($type), $langs->trans('DeleteCategory'), $langs->trans('ConfirmDeleteCategory'), 'confirm_delete', '', '', 1);
352 }
353}
354
355print '<br>';
356
357print '<div class="fichecenter">';
358print '<div class="underbanner clearboth"></div>';
359print '<table class="border centpercent tableforfield">';
360
361// Description
362print '<tr><td class="titlefield notopnoleft tdtop">';
363print $langs->trans("Description").'</td><td>';
364print dol_htmlentitiesbr($object->description);
365print '</td></tr>';
366
367// Color
368print '<tr><td class="notopnoleft">';
369print $langs->trans("Color").'</td><td>';
370print $formother->showColor($object->color);
371print '</td></tr>';
372
373// Position
374print '<tr><td class="titlefield notopnoleft">';
375print $langs->trans("Position").'</td><td>';
376print $object->position ? $object->position : '';
377print '</td></tr>';
378
379// Other attributes
380include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
381
382print '</table>';
383print '</div>';
384
385print dol_get_fiche_end();
386
387
388/*
389 * Boutons actions
390 */
391
392print "<div class='tabsAction'>\n";
393$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
394if ($reshook < 0) {
395 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
396}
397if (empty($reshook)) {
398 if ($user->hasRight('categorie', 'creer')) {
399 $socid = ($object->socid ? $object->socid : "");
400 print '<a class="butAction" href="'.dolBuildUrl(DOL_URL_ROOT.'/categories/edit.php', ['id' => $object->id, 'socid' => $socid, 'type' => $type]).'">'.$langs->trans("Modify").'</a>';
401 }
402
403 if ($user->hasRight('categorie', 'supprimer')) {
404 print dolGetButtonAction($langs->trans("Delete"), $langs->trans("Delete"), 'delete', dolBuildUrl($_SERVER["PHP_SELF"], ['action' => 'delete', 'id' => $object->id, 'type' => $type, 'backtolist' => $backtolist], true), '', true, array('attr' => array('class' => 'reposition')))."\n";
405 }
406}
407
408print "</div>";
409
410$newcardbutton = '';
411if ($user->hasRight('categorie', 'creer')) {
412 $link = dolBuildUrl(DOL_URL_ROOT.'/categories/card.php', ['action'=> 'create', 'type' => $type, 'catorigin' => $object->id, 'backtopage' => dolBuildUrl($_SERVER["PHP_SELF"], ['type' => $type, 'id' => $id])]);
413
414 $newcardbutton = '<div class="right">';
415 $newcardbutton .= dolGetButtonTitle($langs->trans('NewCategory'), '', 'fa fa-plus-circle', $link);
416 $newcardbutton .= '</div>';
417}
418
419
420/*
421 * Sub-category tree view of this category
422 */
423
424print '<div class="fichecenter">';
425
426print load_fiche_titre($langs->trans("SubCats"), $newcardbutton, 'object_category');
427
428$cats = $object->get_filles();
429
430print '<table class="liste nohover noborder centpercent borderbottom">';
431
432print '<tr class="liste_titre">';
433print '<td>'.$langs->trans("SubCats").'</td>';
434print '<td></td>';
435print '<td class="right">';
436
437if (is_array($cats) && count($cats) > 1 && !empty($conf->use_javascript_ajax)) {
438 print '<div id="iddivjstreecontrol">';
439 print '<a class="notasortlink" href="#">'.img_picto('', 'folder').' '.$langs->trans("UndoExpandAll").'</a>';
440 print " | ";
441 print '<a class="notasortlink" href="#">'.img_picto('', 'folder-open').' '.$langs->trans("ExpandAll").'</a>';
442 print '</div>';
443}
444
445print '</td>';
446print '</tr>';
447
448if (is_numeric($cats) && $cats < 0) {
449 dol_print_error($db, $object->error, $object->errors);
450} elseif (count($cats) < 1) {
451 print '<tr class="oddeven nobottom nohover">';
452 print '<td colspan="3"><span class="opacitymedium">'.$langs->trans("NoSubCat").'</span></td>';
453 print '</tr>';
454} else {
455 $categstatic = new Categorie($db);
456
457 $fulltree = $categstatic->get_full_arbo($type, $object->id, 1);
458
459 // Load possible missing includes
460 if (getDolGlobalString('CATEGORY_SHOW_COUNTS')) {
461 if ($type == Categorie::TYPE_MEMBER) {
462 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
463 }
464 if ($type == Categorie::TYPE_ACCOUNT) {
465 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
466 }
467 if ($type == Categorie::TYPE_PROJECT) {
468 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
469 }
470 if ($type == Categorie::TYPE_USER) {
471 require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
472 }
473 }
474
475 // Define data (format for treeview)
476 $data = array();
477 $data[] = array('rowid' => 0, 'fk_menu' => -1, 'title' => 'racine', 'mainmenu' => '', 'leftmenu' => '', 'fk_mainmenu' => '', 'fk_leftmenu' => '');
478 foreach ($fulltree as $key => $val) {
479 $categstatic->id = $val['id'];
480 $categstatic->ref = $val['label'];
481 $categstatic->color = $val['color'];
482 $categstatic->type = $type;
483 //$desc = dol_htmlcleanlastbr($val['description']);
484
485 $counter = '';
486 if (getDolGlobalString('CATEGORY_SHOW_COUNTS')) {
487 // we need only a count of the elements, so it is enough to consume only the id's from the database
488 $elements = $categstatic->getObjectsInCateg($type, 1);
489
490 $counter = "<td class='left' width='40px;'>".(is_array($elements) ? count($elements) : '0')."</td>";
491 }
492
493 if ($categstatic->color) {
494 $stylecolor = ' style="background: #'.sprintf("%06s", $categstatic->color).';"';
495 } else {
496 $stylecolor = ' style="background: #bbb;"';
497 }
498 $li = $categstatic->getNomUrl(1, '', 60, '&backtolist='.urlencode($_SERVER["PHP_SELF"].'?id='.((int) $id).'&type='.urlencode($type)), 0);
499
500 $entry = '<table class="nobordernopadding centpercent">';
501 $entry .= '<tr>';
502
503 $entry .= '<td>';
504 $entry .= '<span class="noborderoncategories" '.$stylecolor.'>'.$li.'</span>';
505 $entry .= '</td>';
506
507 $entry .= $counter;
508
509 $entry .= '<td class="right" width="20px;">';
510 $entry .= '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.urlencode($type).'&backtolist='.urlencode($_SERVER["PHP_SELF"].'?id='.$id.'&type='.urlencode($type)).'">'.img_view().'</a>';
511 $entry .= '</td>';
512 $entry .= '<td class="right" width="20px;">';
513 $entry .= '<a class="editfielda" href="'.DOL_URL_ROOT.'/categories/edit.php?id='.$val['id'].'&type='.urlencode($type).'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$id.'&type='.urlencode($type)).'">'.img_edit().'</a>';
514 $entry .= '</td>';
515 $entry .= '<td class="right" width="20px;">';
516 $entry .= '<a class="deletefilelink" href="'.DOL_URL_ROOT.'/categories/viewcat.php?action=delete&token='.newToken().'&id='.$val['id'].'&type='.urlencode($type).'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$id.'&type='.urlencode($type)).'&backtolist='.urlencode($_SERVER["PHP_SELF"].'?id='.$id.'&type='.urlencode($type)).'">'.img_delete().'</a>';
517 $entry .= '</td>';
518
519 $entry .= '</tr>';
520 $entry .= '</table>';
521
522 $data[] = array('rowid' => $val['rowid'], 'fk_menu' => $val['fk_parent'], 'entry' => $entry);
523 }
524
525 $nbofentries = (count($data) - 1);
526 if ($nbofentries > 0) {
527 require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php';
528 print '<tr class="pair">';
529 print '<td colspan="3">';
530
531 // $data[0] is the current shown category, to don'T show the current category use $data[1] instead
532 tree_recur($data, $data[1], 0);
533
534 print '</td>';
535 print '</tr>';
536 } else {
537 print '<tr class="pair">';
538 print '<td colspan="3">';
539 print '<table class="nobordernopadding">';
540
541 print '<tr class="nobordernopadding">';
542 print '<td>'.img_picto_common('', 'treemenu/branchbottom.gif').'</td>';
543 print '<td class="valignmiddle"><span class="opacitymedium">'.$langs->trans("NoCategoryYet").'</span></td>';
544 print '<td>&nbsp;</td>';
545 print '</tr>';
546
547 print '</table>';
548 print '</td>';
549 print '</tr>';
550 }
551}
552
553print "</table>";
554print "</div>";
555
556// List of mass actions available
557$arrayofmassactions = array(
558 //'validate'=>$langs->trans("Validate"),
559 //'generate_doc'=>$langs->trans("ReGeneratePDF"),
560 //'builddoc'=>$langs->trans("PDFMerge"),
561 //'presend'=>$langs->trans("SendByMail"),
562);
563$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
564
565$typeid = $type; // warning, typeid can be a string
566
567
568// List of products or services (type is type of category)
569if ($type == Categorie::TYPE_PRODUCT) {
570 if ($user->hasRight("product", "read") || $user->hasRight("service", "read")) {
571 $permission = ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer'));
572 $showclassifyform = ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer'));
573
574 $prods = $object->getObjectsInCateg($type, 0, $limit, $offset, 'ref');
575 if ($prods < 0) {
576 dol_print_error($db, $object->error, $object->errors);
577 } else {
579 '@phan-var-force Product[] $prods';
580 // Form to add record into the category
581 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
582 print '<input type="hidden" name="token" value="'.newToken().'">';
583 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
584 print '<input type="hidden" name="type" value="'.$typeid.'">';
585 print '<input type="hidden" name="id" value="'.$object->id.'">';
586 print '<input type="hidden" name="page_y" value="">';
587 print '<input type="hidden" name="action" value="list">';
588
589 print '<br>';
590 $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
591 $num = count($prods);
592 $nbtotalofrecords = '';
593 $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->hasRight('societe', 'creer'));
594
595 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
596 print_barre_liste($langs->trans("ProductsAndServices"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'products', 0, $newcardbutton, '', $limit);
597
598 if ($showclassifyform) {
599 print '<table class="noborder centpercent">';
600 print '<tr class="liste_titre"><td>';
601 print $langs->trans("AddProductServiceIntoCategory").' &nbsp;';
602 $form->select_produits(0, 'elemid', '', 0, 0, -1, 2, '', 1, array(), 0, 1, 0, '', 0, '', null);
603 print '<input type="submit" class="button buttongen" name="addintocategory" value="'.$langs->trans("ClassifyInCategory").'"></td>';
604 print '</tr>';
605 print '</table>';
606 }
607
608 print '<table class="noborder centpercent">'."\n";
609 print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Ref").'</td></tr>'."\n";
610
611 if (count($prods) > 0) {
612 $i = 0;
613 foreach ($prods as $prod) {
614 $i++;
615 if ($i > $limit) {
616 break;
617 }
618
619 print '<tr class="oddeven">'."\n";
620 print '<td class="nowrap tdtop">';
621 print $prod->getNomUrl(1);
622 print "</td>\n";
623
624 $product_thumbnail_html = '';
625 if (!empty($prod->entity)) {
626 $product_thumbnail = $prod->show_photos('product', $conf->product->multidir_output[(int) $prod->entity], 1, 1, 0, 0, 0, 80);
627 if ($prod->nbphoto > 0) {
628 $product_thumbnail_html = $product_thumbnail;
629 }
630 }
631 print '<td class="left">' . $product_thumbnail_html . '</td>';
632 $product_stock_info = "";
633 if (isModEnabled("stock") && ($user->hasRight("stock", "read"))) {
634 $product_stock_info = "<br>" . $langs->trans("Stock") . ": " . $prod->stock_reel;
635 }
636
637 print '<td class="tdtop">' . dolPrintHTML($prod->label) . "<br>" . dolPrintHTML($prod->description) . $product_stock_info . "</td>\n";
638
639 // Link to delete from category
640 print '<td class="right">';
641 if ($permission) {
642 print '<a class="reposition" href= "'.$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".((int) $object->id)."&type=".urlencode($typeid)."&action=unlink&token=".newToken()."&removeelem=".((int) $prod->id).($limit ? '&limit='.$limit : '').'">';
643 //print $langs->trans("DeleteFromCat");
644 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
645 print "</a>";
646 }
647 print '</td>';
648 print "</tr>\n";
649 }
650 } else {
651 print '<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</span></td></tr>';
652 }
653 print "</table>\n";
654
655 print "</form>\n";
656 }
657 } else {
658 print_barre_liste($langs->trans("ProductsAndServices"), null, $_SERVER["PHP_SELF"], '', '', '', '', 0, '', 'products');
659 accessforbidden("NotEnoughPermissions", 0, 0);
660 }
661}
662
663// List of customers
664if ($type == Categorie::TYPE_CUSTOMER) {
665 if ($user->hasRight("societe", "read")) {
666 $permission = $user->hasRight('societe', 'creer');
667 $showclassifyform = $user->hasRight('societe', 'creer');
668
669 $socs = $object->getObjectsInCateg($type, 0, $limit, $offset, 'nom');
670 if ($socs < 0) {
671 dol_print_error($db, $object->error, $object->errors);
672 } else {
674 '@phan-var-force Societe[] $socs';
675 // Form to add record into a category
676 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
677 print '<input type="hidden" name="token" value="'.newToken().'">';
678 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
679 print '<input type="hidden" name="type" value="'.$typeid.'">';
680 print '<input type="hidden" name="id" value="'.$object->id.'">';
681 print '<input type="hidden" name="action" value="list">';
682 print '<input type="hidden" name="page_y" value="">';
683
684 print '<br>';
685 $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
686 $num = count($socs);
687 $nbtotalofrecords = '';
688 $newcardbutton = dolGetButtonTitle($langs->trans("AddThirdParty"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/societe/card.php?action=create&customer=3&custcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->hasRight('societe', 'creer'));
689
690 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
691 print_barre_liste($langs->trans("Customers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'companies', 0, $newcardbutton, '', $limit);
692
693 if ($showclassifyform) {
694 print '<table class="noborder centpercent">';
695 print '<tr class="liste_titre"><td>';
696 print $langs->trans("AddCustomerIntoCategory").' &nbsp;';
697 $filter = '(s.client:IN:1,2,3)';
698 print $form->select_company('', 'elemid', $filter);
699 print '<input type="submit" class="reposition button buttongen" name="addintocategory" value="'.$langs->trans("ClassifyInCategory").'"></td>';
700 print '</tr>';
701 print '</table>';
702 }
703
704 print '<table class="noborder centpercent">'."\n";
705 print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Name").'</td></tr>'."\n";
706
707 if (count($socs) > 0) {
708 $i = 0;
709 foreach ($socs as $key => $soc) {
710 $i++;
711 if ($i > $limit) {
712 break;
713 }
714
715 print "\t".'<tr class="oddeven">'."\n";
716 print '<td class="nowrap tdtop tdoverflowmax250">';
717 print $soc->getNomUrl(1);
718 print "</td>\n";
719 // Link to delete from category
720 print '<td class="right">';
721 if ($permission) {
722 print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".urlencode($typeid)."&action=unlink&token=".newToken()."&removeelem=".((int) $soc->id).($limit ? '&limit='.$limit : '')."'>";
723 //print $langs->trans("DeleteFromCat");
724 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
725 print "</a>";
726 }
727 print '</td>';
728 print "</tr>\n";
729 }
730 } else {
731 print '<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</span></td></tr>';
732 }
733 print "</table>\n";
734
735 print "</form>\n";
736 }
737 } else {
738 print_barre_liste($langs->trans("Customers"), null, $_SERVER["PHP_SELF"], '', '', '', '', 0, '', 'companies');
739 accessforbidden("NotEnoughPermissions", 0, 0);
740 }
741}
742
743// List of suppliers
744if ($type == Categorie::TYPE_SUPPLIER) {
745 if ($user->hasRight("fournisseur", "read")) {
746 $permission = $user->hasRight('societe', 'creer');
747 $showclassifyform = $user->hasRight('societe', 'creer');
748
749 $socs = $object->getObjectsInCateg($type, 0, $limit, $offset, 'nom');
750
751 if ($socs < 0) {
752 dol_print_error($db, $object->error, $object->errors);
753 } else {
755 '@phan-var-force Fournisseur[] $socs';
756 // Form to add record into a category
757 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
758 print '<input type="hidden" name="token" value="'.newToken().'">';
759 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
760 print '<input type="hidden" name="type" value="'.$typeid.'">';
761 print '<input type="hidden" name="id" value="'.$object->id.'">';
762 print '<input type="hidden" name="page_y" value="">';
763 print '<input type="hidden" name="action" value="list">';
764
765 print '<br>';
766 $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
767 $num = count($socs);
768 $nbtotalofrecords = '';
769 $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->hasRight('societe', 'creer'));
770
771 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
772 print_barre_liste($langs->trans("Suppliers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'companies', 0, $newcardbutton, '', $limit);
773
774 if ($showclassifyform) {
775 print '<table class="noborder centpercent">';
776 print '<tr class="liste_titre"><td>';
777 print $langs->trans("AddSupplierIntoCategory").' &nbsp;';
778 $filter = '(s.fournisseur:=:1)';
779 print $form->select_company('', 'elemid', $filter);
780 print '<input type="submit" class="button buttongen" name="addintocategory" value="'.$langs->trans("ClassifyInCategory").'"></td>';
781 print '</tr>';
782 print '</table>';
783 }
784
785 print '<table class="noborder centpercent">'."\n";
786 print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Name")."</td></tr>\n";
787
788 if (count($socs) > 0) {
789 $i = 0;
790 foreach ($socs as $soc) {
791 $i++;
792 if ($i > $limit) {
793 break;
794 }
795
796 print "\t".'<tr class="oddeven">'."\n";
797 print '<td class="nowrap tdtop">';
798 print $soc->getNomUrl(1);
799 print "</td>\n";
800 // Link to delete from category
801 print '<td class="right">';
802 if ($permission) {
803 print '<a class="reposition" href="'.$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".urlencode($typeid)."&action=unlink&token=".newToken()."&removeelem=".((int) $soc->id).($limit ? '&limit='.$limit : '').'">';
804 //print $langs->trans("DeleteFromCat");
805 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
806 print "</a>";
807 }
808 print '</td>';
809
810 print "</tr>\n";
811 }
812 } else {
813 print '<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</span></td></tr>';
814 }
815 print "</table>\n";
816
817 print "</form>\n";
818 }
819 } else {
820 print_barre_liste($langs->trans("Suppliers"), null, $_SERVER["PHP_SELF"], '', '', '', '', 0, '', 'companies');
821 accessforbidden("NotEnoughPermissions", 0, 0);
822 }
823}
824
825// List of members
826if ($type == Categorie::TYPE_MEMBER) {
827 if ($user->hasRight("adherent", "read")) {
828 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
829
830 $permission = $user->hasRight('adherent', 'creer');
831 $showclassifyform = $user->hasRight('adherent', 'creer');
832
833 $members = $object->getObjectsInCateg($type, 0, $limit, $offset, 'lastname');
834 if ($members < 0) {
835 dol_print_error($db, $object->error, $object->errors);
836 } else {
838 '@phan-var-force Adherent[] $members';
839 // Form to add record into a category
840 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
841 print '<input type="hidden" name="token" value="'.newToken().'">';
842 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
843 print '<input type="hidden" name="type" value="'.$typeid.'">';
844 print '<input type="hidden" name="id" value="'.$object->id.'">';
845 print '<input type="hidden" name="page_y" value="">';
846 print '<input type="hidden" name="action" value="list">';
847
848 print '<br>';
849 $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
850 $num = count($members);
851 $nbtotalofrecords = '';
852 $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'));
853
854 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
855 print_barre_liste($langs->trans("Member"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit);
856
857 if ($showclassifyform) {
858 print '<table class="noborder centpercent">';
859 print '<tr class="liste_titre"><td>';
860 print $langs->trans("AssignCategoryTo").' &nbsp;';
861 print $form->selectMembers('', 'elemid');
862 print '<input type="submit" class="button buttongen" value="'.$langs->trans("Save").'"></td>';
863 print '</tr>';
864 print '</table>';
865 }
866
867 print '<table class="noborder centpercent">'."\n";
868 print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Name").'</td></tr>'."\n";
869
870 if (count($members) > 0) {
871 $i = 0;
872 foreach ($members as $key => $member) {
873 $i++;
874 if ($i > $limit) {
875 break;
876 }
877
878 print "\t".'<tr class="oddeven">'."\n";
879 print '<td class="nowrap tdtop">';
880 $member->ref = $member->login;
881 print $member->getNomUrl(1, 0);
882 print "</td>\n";
883 print '<td class="tdtop">'.$member->lastname."</td>\n";
884 print '<td class="tdtop">'.$member->firstname."</td>\n";
885 // Link to delete from category
886 print '<td class="right">';
887 if ($permission) {
888 print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".urlencode($typeid)."&action=unlink&token=".newToken()."&removeelem=".((int) $member->id).($limit ? '&limit='.$limit : '')."'>";
889 //print $langs->trans("DeleteFromCat");
890 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
891 print "</a>";
892 }
893 print '</td>';
894 print "</tr>\n";
895 }
896 } else {
897 print '<tr class="oddeven"><td colspan="4"><span class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</span></td></tr>';
898 }
899 print "</table>\n";
900
901 print "</form>\n";
902 }
903 } else {
904 print_barre_liste($langs->trans("Member"), null, $_SERVER["PHP_SELF"], '', '', '', '', 0, '', 'members');
905 accessforbidden("NotEnoughPermissions", 0, 0);
906 }
907}
908
909// List of contacts
910if ($type == Categorie::TYPE_CONTACT) {
911 if ($user->hasRight("societe", "read")) {
912 $permission = $user->hasRight('societe', 'creer');
913 $showclassifyform = $user->hasRight('societe', 'creer');
914
915 $contacts = $object->getObjectsInCateg($type, 0, $limit, $offset, 'lastname');
916 if (is_numeric($contacts) && $contacts < 0) {
917 dol_print_error($db, $object->error, $object->errors);
918 } else {
920 '@phan-var-force Contact[] $contacts';
921 // Form to add record into a category
922 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
923 print '<input type="hidden" name="token" value="'.newToken().'">';
924 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
925 print '<input type="hidden" name="type" value="'.$typeid.'">';
926 print '<input type="hidden" name="id" value="'.$object->id.'">';
927 print '<input type="hidden" name="page_y" value="">';
928 print '<input type="hidden" name="action" value="list">';
929
930 print '<br>';
931 $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
932 $num = count($contacts);
933 $nbtotalofrecords = '';
934 $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->hasRight('societe', 'creer'));
935
936 $objsoc = new Societe($db);
937
938 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
939 print_barre_liste($langs->trans("Contact"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contact', 0, $newcardbutton, '', $limit);
940
941 if ($showclassifyform) {
942 print '<table class="noborder centpercent">';
943 print '<tr class="liste_titre"><td>';
944 print $langs->trans("AssignCategoryTo").' &nbsp;';
945 print $form->select_contact(0, '', 'elemid', '', '', '', 0, 'maxwidth300 widthcentpercentminusx');
946 print '<input type="submit" class="button buttongen" name="addintocategory" value="'.$langs->trans("ClassifyInCategory").'"></td>';
947 print '</tr>';
948 print '</table>';
949 }
950
951 print '<table class="noborder centpercent">'."\n";
952 print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Ref").'</td></tr>'."\n";
953
954 if (is_array($contacts) && count($contacts) > 0) {
955 $i = 0;
956 foreach ($contacts as $key => $contact) {
957 $i++;
958 if ($i > $limit) {
959 break;
960 }
961
962 print "\t".'<tr class="oddeven">'."\n";
963 print '<td class="nowrap tdtop">';
964 print $contact->getNomUrl(1, 'category');
965 if ($contact->socid > 0) {
966 $objsoc->fetch($contact->socid);
967 print ' - ';
968 print $objsoc->getNomUrl(1, 'contact');
969 }
970 print "</td>\n";
971 // Link to delete from category
972 print '<td class="right">';
973 if ($permission) {
974 print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".urlencode($typeid)."&action=unlink&token=".newToken()."&removeelem=".((int) $contact->id).($limit ? '&limit='.$limit : '')."'>";
975 //print $langs->trans("DeleteFromCat");
976 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
977 print "</a>";
978 }
979 print '</td>';
980 print "</tr>\n";
981 }
982 } else {
983 print '<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</span></td></tr>';
984 }
985 print "</table>\n";
986
987 print "</form>\n";
988 }
989 } else {
990 print_barre_liste($langs->trans("Contact"), null, $_SERVER["PHP_SELF"], '', '', '', '', 0, '', 'contact');
991 accessforbidden("NotEnoughPermissions", 0, 0);
992 }
993}
994
995// List of bank accounts
996if ($type == Categorie::TYPE_ACCOUNT) {
997 if ($user->hasRight("banque", "read")) {
998 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
999
1000 $permission = $user->hasRight('banque', 'creer');
1001 $showclassifyform = $user->hasRight('banque', 'creer');
1002
1003 $accounts = $object->getObjectsInCateg($type, 0, $limit, $offset);
1004 if ($accounts < 0) {
1005 dol_print_error($db, $object->error, $object->errors);
1006 } else {
1008 '@phan-var-force Account[] $accounts';
1009 // Form to add record into a category
1010 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1011 print '<input type="hidden" name="token" value="'.newToken().'">';
1012 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1013 print '<input type="hidden" name="type" value="'.$typeid.'">';
1014 print '<input type="hidden" name="id" value="'.$object->id.'">';
1015 print '<input type="hidden" name="page_y" value="">';
1016 print '<input type="hidden" name="action" value="list">';
1017
1018 print '<br>';
1019 $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
1020 $num = count($accounts);
1021 $nbtotalofrecords = '';
1022 $newcardbutton = '';
1023
1024 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
1025 print_barre_liste($langs->trans("Account"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bank_account', 0, $newcardbutton, '', $limit);
1026
1027 if ($showclassifyform) {
1028 print '<table class="noborder centpercent">';
1029 print '<tr class="liste_titre"><td>';
1030 print $langs->trans("AddObjectIntoCategory").' &nbsp;';
1031 print $form->select_comptes('', 'elemid', 0, '', 0, '', 0, '', 1);
1032 print '<input type="submit" class="button buttongen" name="addintocategory" value="'.$langs->trans("ClassifyInCategory").'"></td>';
1033 print '</tr>';
1034 print '</table>';
1035 }
1036
1037 print '<table class="noborder centpercent">'."\n";
1038 print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Ref").'</td></tr>'."\n";
1039
1040 if (count($accounts) > 0) {
1041 $i = 0;
1042 foreach ($accounts as $key => $account) {
1043 $i++;
1044 if ($i > $limit) {
1045 break;
1046 }
1047
1048 print "\t".'<tr class="oddeven">'."\n";
1049 print '<td class="nowrap tdtop">';
1050 print $account->getNomUrl(1, '0');
1051 print "</td>\n";
1052 print '<td class="tdtop">'.$account->bank."</td>\n";
1053 print '<td class="tdtop">'.$account->number."</td>\n";
1054 // Link to delete from category
1055 print '<td class="right">';
1056 if ($permission) {
1057 print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".urlencode($typeid)."&action=unlink&token=".newToken()."&removeelem=".((int) $account->id).($limit ? '&limit='.$limit : '')."'>";
1058 //print $langs->trans("DeleteFromCat");
1059 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
1060 print "</a>";
1061 }
1062 print '</td>';
1063 print "</tr>\n";
1064 }
1065 } else {
1066 print '<tr class="oddeven"><td colspan="4"><span class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</span></td></tr>';
1067 }
1068 print "</table>\n";
1069
1070 print "</form>\n";
1071 }
1072 } else {
1073 print_barre_liste($langs->trans("Banque"), null, $_SERVER["PHP_SELF"], '', '', '', '', 0, '', 'bank');
1074 accessforbidden("NotEnoughPermissions", 0, 0);
1075 }
1076}
1077
1078// List of Project
1079if ($type == Categorie::TYPE_PROJECT) {
1080 if ($user->hasRight("project", "read")) {
1081 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
1082
1083 $permission = $user->hasRight('projet', 'creer');
1084 $showclassifyform = $user->hasRight('projet', 'creer');
1085
1086 $objects = $object->getObjectsInCateg($type, 0, $limit, $offset);
1087 if ($objects < 0) {
1088 dol_print_error($db, $object->error, $object->errors);
1089 } else {
1091 '@phan-var-force Project[] $objects';
1092 // Form to add record into a category
1093 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1094 print '<input type="hidden" name="token" value="'.newToken().'">';
1095 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1096 print '<input type="hidden" name="type" value="'.$typeid.'">';
1097 print '<input type="hidden" name="id" value="'.$object->id.'">';
1098 print '<input type="hidden" name="page_y" value="">';
1099 print '<input type="hidden" name="action" value="list">';
1100
1101 print '<br>';
1102 $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
1103 $num = count($objects);
1104 $nbtotalofrecords = '';
1105 $newcardbutton = '';
1106
1107 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
1108 print_barre_liste($langs->trans("Project"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'project', 0, $newcardbutton, '', $limit);
1109
1110 if ($showclassifyform) {
1111 print '<table class="noborder centpercent">';
1112 print '<tr class="liste_titre"><td>';
1113 print $langs->trans("AddObjectIntoCategory").' &nbsp;';
1114 $form->selectProjects('', 'elemid');
1115 print '<input type="submit" class="button buttongen" name="addintocategory" value="'.$langs->trans("ClassifyInCategory").'"></td>';
1116 print '</tr>';
1117 print '</table>';
1118 }
1119
1120 print '<table class="noborder centpercent">'."\n";
1121 print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Ref").'</td></tr>'."\n";
1122
1123 if (count($objects) > 0) {
1124 $i = 0;
1125 foreach ($objects as $key => $project) {
1126 $i++;
1127 if ($i > $limit) {
1128 break;
1129 }
1130
1131 print "\t".'<tr class="oddeven">'."\n";
1132 print '<td class="nowrap tdtop">';
1133 print $project->getNomUrl(1);
1134 print "</td>\n";
1135 print '<td class="tdtop">'.$project->title."</td>\n";
1136 // Link to delete from category
1137 print '<td class="right">';
1138 if ($permission) {
1139 print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".urlencode($typeid)."&action=unlink&token=".newToken()."&removeelem=".((int) $project->id).($limit ? '&limit='.$limit : '')."'>";
1140 //print $langs->trans("DeleteFromCat");
1141 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
1142 print "</a>";
1143 }
1144 print '</td>';
1145 print "</tr>\n";
1146 }
1147 } else {
1148 print '<tr class="oddeven"><td colspan="4"><span class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</span></td></tr>';
1149 }
1150 print "</table>\n";
1151
1152 print "</form>\n";
1153 }
1154 } else {
1155 print_barre_liste($langs->trans("Project"), null, $_SERVER["PHP_SELF"], '', '', '', '', 0, '', 'project');
1156 accessforbidden("NotEnoughPermissions", 0, 0);
1157 }
1158}
1159
1160// List of users
1161if ($type == Categorie::TYPE_USER) {
1162 if ($user->hasRight("user", "user", "read")) {
1163 require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
1164 $showclassifyform = $user->hasRight("user", "user", "creer");
1165
1166 $users = $object->getObjectsInCateg($type, 0, 0, 0, 'lastname');
1167 if ($users < 0) {
1168 dol_print_error($db, $object->error, $object->errors);
1169 } else {
1171 '@phan-var-force User[] $users';
1172
1173 // Form to add record into a category
1174 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1175 print '<input type="hidden" name="token" value="'.newToken().'">';
1176 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1177 print '<input type="hidden" name="type" value="'.$typeid.'">';
1178 print '<input type="hidden" name="id" value="'.$object->id.'">';
1179 print '<input type="hidden" name="page_y" value="">';
1180 print '<input type="hidden" name="action" value="list">';
1181
1182 print '<br>';
1183
1184 $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
1185 $num = count($users);
1186 $nbtotalofrecords = '';
1187 $newcardbutton = '';
1188
1189 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
1190 print_barre_liste($langs->trans("Users"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'user', 0, '', '', $limit);
1191
1192 if ($showclassifyform) {
1193 print '<table class="noborder centpercent">';
1194 print '<tr class="liste_titre"><td>';
1195 $force_entity = getEntity($object->element); // So we will get same filter than the getObjectsInCateg()
1196 print img_picto('', $type, 'class="pictofixedwidth"');
1197 print $form->select_dolusers('', 'elemid', 1, null, 0, '', '', $force_entity);
1198 print '<input type="submit" class="button buttongen" name="addintocategory" value="'.$langs->trans("ClassifyInCategory").'"></td>';
1199 print '</tr>';
1200 print '</table>';
1201 }
1202
1203 print '<table class="noborder centpercent">'."\n";
1204 print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Users").' <span class="badge">'.$num.'</span></td></tr>'."\n";
1205
1206 if (count($users) > 0) {
1207 // Use "$userentry" here, because "$user" is the current user
1208 foreach ($users as $key => $userentry) {
1209 print "\t".'<tr class="oddeven">'."\n";
1210 print '<td class="nowrap tdtop">';
1211 print $userentry->getNomUrl(-1);
1212 print "</td>\n";
1213 print '<td class="tdtop">'.$userentry->job."</td>\n";
1214
1215 // Link to delete from category
1216 print '<td class="right">';
1217 if ($user->hasRight('user', 'user', 'creer')) {
1218 print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".urlencode($typeid)."&action=unlink&token=".newToken()."&removeelem=".((int) $userentry->id).($limit ? '&limit='.$limit : '')."'>";
1219 //print $langs->trans("DeleteFromCat");
1220 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
1221 print "</a>";
1222 }
1223 print '</td>';
1224 print "</tr>\n";
1225 }
1226 } else {
1227 print '<tr class="oddeven"><td colspan="3"><span class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</span></td></tr>';
1228 }
1229 print "</table>\n";
1230
1231 print "</form>\n";
1232 }
1233 } else {
1234 print_barre_liste($langs->trans("Users"), null, $_SERVER["PHP_SELF"], '', '', '', '', 0, '', 'user');
1235 accessforbidden("NotEnoughPermissions", 0, 0);
1236 }
1237}
1238
1239// List of warehouses
1240if ($type == Categorie::TYPE_WAREHOUSE) {
1241 if ($user->hasRight("stock", "read")) {
1242 $permission = $user->hasRight('stock', 'creer');
1243 $showclassifyform = $user->hasRight('stock', 'creer');
1244
1245 require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
1246
1247 $objects = $object->getObjectsInCateg($type, 0, $limit, $offset);
1248 if ($objects < 0) {
1249 dol_print_error($db, $object->error, $object->errors);
1250 } else {
1252 '@phan-var-force Entrepot[] $objects';
1253 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1254 print '<input type="hidden" name="token" value="'.newToken().'">';
1255 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1256 print '<input type="hidden" name="type" value="'.$typeid.'">';
1257 print '<input type="hidden" name="id" value="'.$object->id.'">';
1258 print '<input type="hidden" name="page_y" value="">';
1259 print '<input type="hidden" name="action" value="list">';
1260
1261 print '<br>';
1262 $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
1263 $num = count($objects);
1264 $nbtotalofrecords = '';
1265 $newcardbutton = '';
1266
1267 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
1268 print_barre_liste($langs->trans("Warehouses"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'stock', 0, $newcardbutton, '', $limit);
1269
1270 if ($showclassifyform) {
1271 print '<table class="noborder centpercent">';
1272 print '<tr class="liste_titre"><td>';
1273 print $langs->trans("AddTicketIntoCategory").' &nbsp;';
1274 print $form->selectForForms('Entrepot:product/stock/class/entrepot.class.php', 'elemid', 0, 1, '', '', 'maxwidth500');
1275 print '<input type="submit" class="button buttongen" name="addintocategory" value="'.$langs->trans("ClassifyInCategory").'"></td>';
1276 print '</tr>';
1277 print '</table>';
1278 }
1279
1280 print '<table class="noborder centpercent">'."\n";
1281 print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Ref").'</td></tr>'."\n";
1282
1283 if (count($objects) > 0) {
1284 $i = 0;
1285 foreach ($objects as $key => $warehouse) {
1286 $i++;
1287 if ($i > $limit) {
1288 break;
1289 }
1290
1291 print "\t".'<tr class="oddeven">'."\n";
1292 print '<td class="nowrap tdtop">';
1293 print $warehouse->getNomUrl(1);
1294 print "</td>\n";
1295 print '<td class="tdtop">'.$warehouse->ref."</td>\n";
1296 print '<td class="tdtop">'.$warehouse->lieu."</td>\n";
1297 // Link to delete from category
1298 print '<td class="right">';
1299 if ($permission) {
1300 print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".urlencode($typeid)."&action=unlink&token=".newToken()."&removeelem=".((int) $warehouse->id).($limit ? '&limit='.$limit : '')."'>";
1301 //print $langs->trans("DeleteFromCat");
1302 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
1303 print "</a>";
1304 }
1305 print '</td>';
1306 print "</tr>\n";
1307 }
1308 } else {
1309 print '<tr class="oddeven"><td colspan="4"><span class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</span></td></tr>';
1310 }
1311 print "</table>\n";
1312
1313 print "</form>\n";
1314 }
1315 } else {
1316 print_barre_liste($langs->trans("Warehouse"), null, $_SERVER["PHP_SELF"], '', '', '', '', 0, '', 'stock');
1317 accessforbidden("NotEnoughPermissions", 0, 0);
1318 }
1319}
1320
1321// List of tickets
1322if ($type == Categorie::TYPE_TICKET) {
1323 if ($user->hasRight("ticket", "read")) {
1324 $permission = $user->hasRight('categorie', 'creer');
1325 $showclassifyform = $user->hasRight('categorie', 'creer');
1326
1327 $tickets = $object->getObjectsInCateg($type, 0, $limit, $offset);
1328 if ($tickets < 0) {
1329 dol_print_error($db, $object->error, $object->errors);
1330 } else {
1332 '@phan-var-force Ticket[] $tickets';
1333 // Form to add record into a category
1334 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1335 print '<input type="hidden" name="token" value="'.newToken().'">';
1336 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1337 print '<input type="hidden" name="type" value="'.$typeid.'">';
1338 print '<input type="hidden" name="id" value="'.$object->id.'">';
1339 print '<input type="hidden" name="page_y" value="">';
1340 print '<input type="hidden" name="action" value="list">';
1341
1342 print '<br>';
1343 $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
1344 $num = count($tickets);
1345 $nbtotalofrecords = '';
1346 $newcardbutton = '';
1347
1348 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
1349 print_barre_liste($langs->trans("Ticket"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'ticket', 0, $newcardbutton, '', $limit);
1350
1351 if ($showclassifyform) {
1352 print '<table class="noborder centpercent">';
1353 print '<tr class="liste_titre"><td>';
1354 print $langs->trans("AddTicketIntoCategory").' &nbsp;';
1355 $form->selectTickets('', 'elemid');
1356 print '<input type="submit" class="button buttongen" name="addintocategory" value="'.$langs->trans("ClassifyInCategory").'"></td>';
1357 print '</tr>';
1358 print '</table>';
1359 }
1360
1361 print '<table class="noborder centpercent">'."\n";
1362 print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Ref").'</td></tr>'."\n";
1363
1364 if (count($tickets) > 0) {
1365 $i = 0;
1366 foreach ($tickets as $ticket) {
1367 $i++;
1368 if ($i > $limit) {
1369 break;
1370 }
1371
1372 print "\t".'<tr class="oddeven">'."\n";
1373 print '<td class="nowrap tdtop">';
1374 print $ticket->getNomUrl(1);
1375 print "</td>\n";
1376 print '<td class="tdtop">'.$ticket->track_id."</td>\n";
1377 // Link to delete from category
1378 print '<td class="right">';
1379 if ($permission) {
1380 print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".urlencode($typeid)."&action=unlink&token=".newToken()."&removeelem=".((int) $ticket->id).($limit ? '&limit='.$limit : '')."'>";
1381 //print $langs->trans("DeleteFromCat");
1382 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
1383 print "</a>";
1384 }
1385 print '</td>';
1386 print "</tr>\n";
1387 }
1388 } else {
1389 print '<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</span></td></tr>';
1390 }
1391 print "</table>\n";
1392
1393 print "</form>\n";
1394 }
1395 } else {
1396 print_barre_liste($langs->trans("Ticket"), null, $_SERVER["PHP_SELF"], '', '', '', '', 0, '', 'ticket');
1397 accessforbidden("NotEnoughPermissions", 0, 0);
1398 }
1399}
1400
1401// List of Interventions
1402if ($type == Categorie::TYPE_FICHINTER) {
1403 if ($user->hasRight("fichinter", "lire")) {
1404 $permission = $user->hasRight('categorie', 'creer');
1405 $showclassifyform = $user->hasRight('categorie', 'creer');
1406
1407 $fichinters = $object->getObjectsInCateg($type, 0, $limit, $offset);
1408 if ($fichinters < 0) {
1409 dol_print_error($db, $object->error, $object->errors);
1410 } else {
1412 '@phan-var-force Fichinter[] $fichinters';
1413
1414 // Form to add record into a category
1415 if ($showclassifyform) {
1416 print '<br>';
1417 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1418 print '<input type="hidden" name="token" value="'.newToken().'">';
1419 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1420 print '<input type="hidden" name="type" value="'.$typeid.'">';
1421 print '<input type="hidden" name="id" value="'.$object->id.'">';
1422 print '<input type="hidden" name="action" value="addintocategory">';
1423 print '<table class="noborder centpercent">';
1424 print '<tr class="liste_titre"><td>';
1425 print $langs->trans("AddFichinterIntoCategory").' &nbsp;';
1426 print $form->selectForForms('Fichinter:fichinter/class/fichinter.class.php', 'elemid', 0, 1, '', '', 'maxwidth500');
1427 print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
1428 print '</tr>';
1429 print '</table>';
1430 print '</form>';
1431 }
1432
1433 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1434 print '<input type="hidden" name="token" value="'.newToken().'">';
1435 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1436 print '<input type="hidden" name="type" value="'.$typeid.'">';
1437 print '<input type="hidden" name="id" value="'.$object->id.'">';
1438 print '<input type="hidden" name="action" value="list">';
1439
1440 print '<br>';
1441 $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
1442 $num = count($fichinters);
1443 $nbtotalofrecords = '';
1444 $newcardbutton = '';
1445
1446 $langs->load('interventions');
1447 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
1448 print_barre_liste($langs->trans("Intervention"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_intervention', 0, $newcardbutton, '', $limit);
1449 print '<table class="noborder centpercent">'."\n";
1450 print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Ref").'</td></tr>'."\n";
1451
1452 if (count($fichinters) > 0) {
1453 $i = 0;
1454 foreach ($fichinters as $fichinter) {
1455 $i++;
1456 if ($i > $limit) {
1457 break;
1458 }
1459
1460 print "\t".'<tr class="oddeven">'."\n";
1461 print '<td class="nowrap tdtop">';
1462 print $fichinter->getNomUrl(1);
1463 print "</td>\n";
1464 print '<td class="tdtop">'.$fichinter->description."</td>\n";
1465 // Link to delete from category
1466 print '<td class="right">';
1467 if ($permission) {
1468 print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".((int) $object->id)."&type=".urlencode($typeid)."&action=unlink&token=".newToken()."&removeelem=".((int) $fichinter->id).($limit ? '&limit='.$limit : '')."'>";
1469 print $langs->trans("DeleteFromCat");
1470 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
1471 print "</a>";
1472 }
1473 print '</td>';
1474 print "</tr>\n";
1475 }
1476 } else {
1477 print '<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</span></td></tr>';
1478 }
1479 print "</table>\n";
1480 print "</form>\n";
1481 }
1482 } else {
1483 print_barre_liste($langs->trans("Intervention"), null, $_SERVER["PHP_SELF"], '', '', '', '', 0, '', 'fichinter');
1484 accessforbidden("NotEnoughPermissions", 0, 0);
1485 }
1486}
1487
1488// List of Orders
1489if ($type == Categorie::TYPE_ORDER) {
1490 require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
1491
1492 $permission = $user->hasRight('commande', 'creer');
1493
1494 $objects = $object->getObjectsInCateg($type, 0, $limit, $offset);
1495 if ($objects < 0) {
1496 dol_print_error($db, $object->error, $object->errors);
1497 } else {
1499 '@phan-var-force Commande[] $objects';
1500 // Form to add record into a category
1501 $showclassifyform = $user->hasRight('order', 'write');
1502 if ($showclassifyform) {
1503 print '<br>';
1504 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1505 print '<input type="hidden" name="token" value="'.newToken().'">';
1506 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1507 print '<input type="hidden" name="type" value="'.$typeid.'">';
1508 print '<input type="hidden" name="id" value="'.$object->id.'">';
1509 print '<input type="hidden" name="action" value="addintocategory">';
1510 print '<table class="noborder centpercent">';
1511 print '<tr class="liste_titre"><td>';
1512 print $langs->trans("AddOrderIntoCategory").' &nbsp;';
1513 print $form->selectForForms('Commande:commande/class/commande.class.php', 'elemid', 0, 1, '', '', 'maxwidth500');
1514 print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
1515 print '</tr>';
1516 print '</table>';
1517 print '</form>';
1518 }
1519
1520 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1521 print '<input type="hidden" name="token" value="'.newToken().'">';
1522 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1523 print '<input type="hidden" name="type" value="'.$typeid.'">';
1524 print '<input type="hidden" name="id" value="'.$object->id.'">';
1525 print '<input type="hidden" name="action" value="list">';
1526
1527 print '<br>';
1528 $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
1529 $num = count($objects);
1530 $nbtotalofrecords = '';
1531 $newcardbutton = '';
1532
1533 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
1534 print_barre_liste($langs->trans("Orders"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bill', 0, $newcardbutton, '', $limit);
1535
1536 print "<table class='noborder centpercent'>\n";
1537 print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Ref").'</td></tr>'."\n";
1538
1539 if (count($objects) > 0) {
1540 $i = 0;
1541 foreach ($objects as $key => $order) {
1542 $i++;
1543 if ($i > $limit) {
1544 break;
1545 }
1546
1547 print "\t".'<tr class="oddeven">'."\n";
1548 print '<td class="nowrap tdtop">';
1549 print $order->getNomUrl(1);
1550 print "</td>\n";
1551 print '<td class="tdtop">'.$order->ref."</td>\n";
1552 // Link to delete from category
1553 print '<td class="right">';
1554 if ($permission) {
1555 print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&action=unlink&token=".newToken()."&removeelem=".$order->id."'>";
1556 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
1557 print "</a>";
1558 }
1559 print "</tr>\n";
1560 }
1561 } else {
1562 print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</td></tr>';
1563 }
1564 print "</table>\n";
1565
1566 print "</form>\n";
1567 }
1568}
1569
1570// List of Manufacturing Orders
1571if ($type == Categorie::TYPE_MO) {
1572 require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php';
1573
1574 $permission = $user->hasRight('mrp', 'write');
1575
1576 $objects = $object->getObjectsInCateg($type, 0, $limit, $offset);
1577 if ($objects < 0) {
1578 dol_print_error($db, $object->error, $object->errors);
1579 } else {
1581 '@phan-var-force Mo[] $objects';
1582 // Form to add record into a category
1583 $showclassifyform = $user->hasRight('mrp', 'write');
1584 if ($showclassifyform) {
1585 print '<br>';
1586 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1587 print '<input type="hidden" name="token" value="'.newToken().'">';
1588 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1589 print '<input type="hidden" name="type" value="'.$typeid.'">';
1590 print '<input type="hidden" name="id" value="'.$object->id.'">';
1591 print '<input type="hidden" name="action" value="addintocategory">';
1592 print '<table class="noborder centpercent">';
1593 print '<tr class="liste_titre"><td>';
1594 print $langs->trans("AddMoIntoCategory").' &nbsp;';
1595 print $form->selectForForms('Mo:mrp/class/mo.class.php', 'elemid', 0, 1, '', '', 'maxwidth500');
1596 print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
1597 print '</tr>';
1598 print '</table>';
1599 print '</form>';
1600 }
1601
1602 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1603 print '<input type="hidden" name="token" value="'.newToken().'">';
1604 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1605 print '<input type="hidden" name="type" value="'.$typeid.'">';
1606 print '<input type="hidden" name="id" value="'.$object->id.'">';
1607 print '<input type="hidden" name="action" value="list">';
1608
1609 print '<br>';
1610 $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
1611 $num = count($objects);
1612 $nbtotalofrecords = '';
1613 $newcardbutton = '';
1614
1615 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
1616 print_barre_liste($langs->trans("MOs"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'mrp', 0, $newcardbutton, '', $limit);
1617
1618 print "<table class='noborder centpercent'>\n";
1619 print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Ref").'</td></tr>'."\n";
1620
1621 if (count($objects) > 0) {
1622 $i = 0;
1623 foreach ($objects as $key => $mo) {
1624 $i++;
1625 if ($i > $limit) {
1626 break;
1627 }
1628
1629 print "\t".'<tr class="oddeven">'."\n";
1630 print '<td class="nowrap tdtop">';
1631 print $mo->getNomUrl(1);
1632 print "</td>\n";
1633 print '<td class="tdtop">'.$mo->ref."</td>\n";
1634 // Link to delete from category
1635 print '<td class="right">';
1636 if ($permission) {
1637 print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&action=unlink&token=".newToken()."&removeelem=".$mo->id."'>";
1638 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
1639 print "</a>";
1640 }
1641 print "</tr>\n";
1642 }
1643 } else {
1644 print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</td></tr>';
1645 }
1646 print "</table>\n";
1647
1648 print "</form>\n";
1649 }
1650}
1651
1652// List of Invoices
1653if ($type == Categorie::TYPE_INVOICE) {
1654 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
1655
1656 $permission = $user->hasRight('facture', 'creer');
1657
1658 $objects = $object->getObjectsInCateg($type, 0, $limit, $offset);
1659 if ($objects < 0) {
1660 dol_print_error($db, $object->error, $object->errors);
1661 } else {
1662 // Form to add record into a category
1663 $showclassifyform = $user->hasRight('facture', 'write');
1664 if ($showclassifyform) {
1665 print '<br>';
1666 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1667 print '<input type="hidden" name="token" value="'.newToken().'">';
1668 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1669 print '<input type="hidden" name="type" value="'.$typeid.'">';
1670 print '<input type="hidden" name="id" value="'.$object->id.'">';
1671 print '<input type="hidden" name="action" value="addintocategory">';
1672 print '<table class="noborder centpercent">';
1673 print '<tr class="liste_titre"><td>';
1674 print $langs->trans("AddInvoiceIntoCategory").' &nbsp;';
1675 print $form->selectForForms('Facture:compta/facture/class/facture.class.php', 'elemid', 0, 1, '', '', 'maxwidth500');
1676 print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
1677 print '</tr>';
1678 print '</table>';
1679 print '</form>';
1680 }
1681
1682 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1683 print '<input type="hidden" name="token" value="'.newToken().'">';
1684 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1685 print '<input type="hidden" name="type" value="'.$typeid.'">';
1686 print '<input type="hidden" name="id" value="'.$object->id.'">';
1687 print '<input type="hidden" name="action" value="list">';
1688
1689 print '<br>';
1690 $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
1691 $num = count($objects);
1692 $nbtotalofrecords = '';
1693 $newcardbutton = '';
1694
1695 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
1696 print_barre_liste($langs->trans("BillsCustomers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bill', 0, $newcardbutton, '', $limit);
1697
1698 print "<table class='noborder centpercent'>\n";
1699 print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Ref").'</td></tr>'."\n";
1700
1701 if (count($objects) > 0) {
1702 $i = 0;
1703 foreach ($objects as $key => $invoice) {
1704 $i++;
1705 if ($i > $limit) {
1706 break;
1707 }
1708
1709 print "\t".'<tr class="oddeven">'."\n";
1710 print '<td class="nowrap tdtop">';
1711 print $invoice->getNomUrl(1);
1712 print "</td>\n";
1713 print '<td class="tdtop">'.$invoice->ref."</td>\n";
1714 // Link to delete from category
1715 print '<td class="right">';
1716 if ($permission) {
1717 print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&action=unlink&token=".newToken()."&removeelem=".$invoice->id."'>";
1718 print $langs->trans("DeleteFromCat");
1719 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
1720 print "</a>";
1721 }
1722 print "</tr>\n";
1723 }
1724 } else {
1725 print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</td></tr>';
1726 }
1727 print "</table>\n";
1728
1729 print "</form>\n";
1730 }
1731}
1732
1733// List of Supplier Orders
1734if ($type == Categorie::TYPE_SUPPLIER_ORDER) {
1735 require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
1736
1737 $permission = $user->hasRight('fournisseur', 'commande', 'creer');
1738
1739 $objects = $object->getObjectsInCateg($type, 0, $limit, $offset);
1740 if ($objects < 0) {
1741 dol_print_error($db, $object->error, $object->errors);
1742 } else {
1743 // Form to add record into a category
1744 $showclassifyform = $user->hasRight('fournisseur', 'commande', 'creer');
1745 ;
1746 if ($showclassifyform) {
1747 print '<br>';
1748 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1749 print '<input type="hidden" name="token" value="'.newToken().'">';
1750 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1751 print '<input type="hidden" name="type" value="'.$typeid.'">';
1752 print '<input type="hidden" name="id" value="'.$object->id.'">';
1753 print '<input type="hidden" name="action" value="addintocategory">';
1754 print '<table class="noborder centpercent">';
1755 print '<tr class="liste_titre"><td>';
1756 print $langs->trans("AddSupplierOrderIntoCategory").' &nbsp;';
1757 print $form->selectForForms('CommandeFournisseur:fourn/class/fournisseur.commande.class.php', 'elemid', 0, 1, '', '', 'maxwidth500');
1758 print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
1759 print '</tr>';
1760 print '</table>';
1761 print '</form>';
1762 }
1763
1764 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1765 print '<input type="hidden" name="token" value="'.newToken().'">';
1766 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1767 print '<input type="hidden" name="type" value="'.$typeid.'">';
1768 print '<input type="hidden" name="id" value="'.$object->id.'">';
1769 print '<input type="hidden" name="action" value="list">';
1770
1771 print '<br>';
1772 $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
1773 $num = count($objects);
1774 $nbtotalofrecords = '';
1775 $newcardbutton = '';
1776
1777 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
1778 print_barre_liste($langs->trans("SuppliersOrders"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'supplier_order', 0, $newcardbutton, '', $limit);
1779
1780 print "<table class='noborder centpercent'>\n";
1781 print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Ref").'</td></tr>'."\n";
1782
1783 if (count($objects) > 0) {
1784 $i = 0;
1785 foreach ($objects as $key => $supplier_order) {
1786 $i++;
1787 if ($i > $limit) {
1788 break;
1789 }
1790
1791 print "\t".'<tr class="oddeven">'."\n";
1792 print '<td class="nowrap tdtop">';
1793 print $supplier_order->getNomUrl(1);
1794 print "</td>\n";
1795 print '<td class="tdtop">'.$supplier_order->ref."</td>\n";
1796 // Link to delete from category
1797 print '<td class="right">';
1798 if ($permission) {
1799 print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&action=unlink&token=".newToken()."&removeelem=".$supplier_order->id."'>";
1800 print $langs->trans("DeleteFromCat");
1801 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
1802 print "</a>";
1803 }
1804 print "</tr>\n";
1805 }
1806 } else {
1807 print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</td></tr>';
1808 }
1809 print "</table>\n";
1810
1811 print "</form>\n";
1812 }
1813}
1814
1815// List of Supplier Invoices
1816if ($type == Categorie::TYPE_SUPPLIER_INVOICE) {
1817 require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
1818
1819 $permission = $user->hasRight('fournisseur', 'facture', 'creer');
1820
1821 $objects = $object->getObjectsInCateg($type, 0, $limit, $offset);
1822 if ($objects < 0) {
1823 dol_print_error($db, $object->error, $object->errors);
1824 } else {
1825 // Form to add record into a category
1826 $showclassifyform = $user->hasRight('fournisseur', 'facture', 'creer');;
1827 if ($showclassifyform) {
1828 print '<br>';
1829 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1830 print '<input type="hidden" name="token" value="'.newToken().'">';
1831 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1832 print '<input type="hidden" name="type" value="'.$typeid.'">';
1833 print '<input type="hidden" name="id" value="'.$object->id.'">';
1834 print '<input type="hidden" name="action" value="addintocategory">';
1835 print '<table class="noborder centpercent">';
1836 print '<tr class="liste_titre"><td>';
1837 print $langs->trans("AddSupplierInvoiceIntoCategory").' &nbsp;';
1838 print $form->selectForForms('FactureFournisseur:fourn/class/fournisseur.facture.class.php', 'elemid', 0, 1, '', '', 'maxwidth500');
1839 print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
1840 print '</tr>';
1841 print '</table>';
1842 print '</form>';
1843 }
1844
1845 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1846 print '<input type="hidden" name="token" value="'.newToken().'">';
1847 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1848 print '<input type="hidden" name="type" value="'.$typeid.'">';
1849 print '<input type="hidden" name="id" value="'.$object->id.'">';
1850 print '<input type="hidden" name="action" value="list">';
1851
1852 print '<br>';
1853 $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($objects); $nbtotalofrecords = ''; $newcardbutton = '';
1854
1855 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
1856 print_barre_liste($langs->trans("SuppliersOrders"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'supplier_order', 0, $newcardbutton, '', $limit);
1857
1858 print "<table class='noborder centpercent'>\n";
1859 print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Ref").'</td></tr>'."\n";
1860
1861 if (count($objects) > 0) {
1862 $i = 0;
1863 foreach ($objects as $key => $supplier_invoice) {
1864 $i++;
1865 if ($i > $limit) {
1866 break;
1867 }
1868
1869 print "\t".'<tr class="oddeven">'."\n";
1870 print '<td class="nowrap tdtop">';
1871 print $supplier_invoice->getNomUrl(1);
1872 print "</td>\n";
1873 print '<td class="tdtop">'.$supplier_invoice->ref."</td>\n";
1874 // Link to delete from category
1875 print '<td class="right">';
1876 if ($permission) {
1877 print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&action=unlink&token=".newToken()."&removeelem=".$supplier_invoice->id."'>";
1878 print $langs->trans("DeleteFromCat");
1879 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
1880 print "</a>";
1881 }
1882 print "</tr>\n";
1883 }
1884 } else {
1885 print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</td></tr>';
1886 }
1887 print "</table>\n";
1888
1889 print "</form>\n";
1890 }
1891}
1892
1893// Note that $action and $object may have been modified by some hooks
1894$parameters = array('type' => $type, 'id' => $id, 'label' => $label);
1895$reshook = $hookmanager->executeHooks('addMoreCategoriesList', $parameters, $object, $action);
1896
1897// End of page
1898llxFooter();
1899$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
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 predefined suppliers products.
Class to manage customers orders.
Class to manage contact/addresses.
Class to manage suppliers invoices.
Class to manage invoices.
Class to manage generation of HTML components Only common components must be here.
Class to help generate other html components Only common components are here.
Class for Mo.
Definition mo.class.php:35
Class to manage products or services.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
dolBuildUrl($url, $params=[], $addtoken=false, $anchor='')
Return path of url.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
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 a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
Definition html.lib.php:540
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.
Definition html.lib.php:738
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
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, $nodie=0, $mode='')
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.