dolibarr 24.0.0-beta
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) {
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 if ($object->delete($user) >= 0) {
209 if ($backtopage) {
210 header("Location: ".$backtopage);
211 exit;
212 } else {
213 header("Location: ".dolBuildUrl(DOL_URL_ROOT.'/categories/categorie_list.php', ['type' => $type]));
214 exit;
215 }
216 } else {
217 setEventMessages($object->error, $object->errors, 'errors');
218 }
219}
220
221if ($elemid && $action == 'addintocategory') { // Test on permission not required here. Done just after depending on object type
222 $newobject = null;
223 $elementtype = '';
224 if ($type == Categorie::TYPE_PRODUCT && ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer'))) {
225 require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
226 $newobject = new Product($db);
227 $elementtype = 'product';
228 } elseif ($type == Categorie::TYPE_CUSTOMER && $user->hasRight('societe', 'creer')) {
229 require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
230 $newobject = new Societe($db);
231 $elementtype = 'customer';
232 } elseif ($type == Categorie::TYPE_SUPPLIER && $user->hasRight('societe', 'creer')) {
233 require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
234 $newobject = new Societe($db);
235 $elementtype = 'supplier';
236 } elseif ($type == Categorie::TYPE_TICKET && $user->hasRight('ticket', 'write')) {
237 require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
238 $newobject = new Ticket($db);
239 $elementtype = 'ticket';
240 } elseif ($type == Categorie::TYPE_FICHINTER && $user->hasRight('ficheinter', 'write')) {
241 require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
242 $newobject = new Fichinter($db);
243 $elementtype = 'fichinter';
244 } elseif ($type == Categorie::TYPE_PROJECT && $user->hasRight('projet', 'creer')) {
245 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
246 $newobject = new Project($db);
247 $elementtype = 'project';
248 } elseif ($type == Categorie::TYPE_MEMBER && $user->hasRight('adherent', 'creer')) {
249 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
250 $newobject = new Adherent($db);
251 $elementtype = 'member';
252 } elseif ($type == Categorie::TYPE_CONTACT && $user->hasRight('societe', 'creer')) {
253 require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
254 $newobject = new Contact($db);
255 $elementtype = 'contact';
256 } elseif ($type == Categorie::TYPE_USER && $user->hasRight('user', 'user', 'creer')) {
257 require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
258 $newobject = new User($db);
259 $elementtype = 'user';
260 } elseif ($type == Categorie::TYPE_ACCOUNT && $user->hasRight('banque', 'configurer')) {
261 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
262 $newobject = new Account($db);
263 $elementtype = 'bank_account';
264 } elseif ($type == Categorie::TYPE_ORDER && $user->hasRight('commande', 'creer')) {
265 require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
266 $newobject = new Commande($db);
267 $elementtype = 'order';
268 } elseif ($type == Categorie::TYPE_MO && $user->hasRight('mrp', 'write')) {
269 require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php';
270 $newobject = new Mo($db);
271 $elementtype = 'mo';
272 } elseif ($type == Categorie::TYPE_INVOICE && $user->hasRight('facture', 'creer')) {
273 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
274 $newobject = new Facture($db);
275 $elementtype = 'invoice';
276 } elseif ($type == Categorie::TYPE_SUPPLIER_ORDER && $user->hasRight('fournisseur', 'commande', 'creer')) {
277 require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
278 $newobject = new CommandeFournisseur($db);
279 $elementtype = 'supplier_order';
280 } elseif ($type == Categorie::TYPE_SUPPLIER_INVOICE && $user->hasRight('fournisseur', 'facture', 'creer')) {
281 require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
282 $newobject = new FactureFournisseur($db);
283 $elementtype = 'supplier_invoice';
284 } else {
285 dol_print_error(null, "Not supported value of type = ".$type);
286 }
287 if ($newobject !== null) {
288 $result = $newobject->fetch($elemid);
289 }
290
291 if ($result >= 0 && $newobject !== null) {
292 // Add into category
293 $result = $object->add_type($newobject, $elementtype);
294 }
295 if ($result >= 0) {
296 setEventMessages($langs->trans("WasAddedSuccessfully", $newobject->ref), null, 'mesgs');
297 } else {
298 if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
299 setEventMessages($langs->trans("ObjectAlreadyLinkedToCategory"), null, 'warnings');
300 } else {
301 setEventMessages($object->error, $object->errors, 'errors');
302 }
303 }
304}
305
306
307/*
308 * View
309 */
310
311$form = new Form($db);
312$formother = new FormOther($db);
313
314$arrayofjs = array(
315 '/public/includes/jquery/plugins/jquerytreeview/jquery.treeview.js',
316 '/public/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'
317);
318$arrayofcss = array('/public/includes/jquery/plugins/jquerytreeview/jquery.treeview.css');
319
320$help_url = '';
321
322llxHeader("", $langs->trans("Categories"), $help_url, '', 0, 0, $arrayofjs, $arrayofcss);
323
324$title = $langs->trans("Categories");
325$title .= ' ('.$langs->trans(empty(Categorie::$MAP_TYPE_TITLE_AREA[$type]) ? ucfirst($type) : Categorie::$MAP_TYPE_TITLE_AREA[$type]).')';
326
327$head = categories_prepare_head($object, $type);
328print dol_get_fiche_head($head, 'card', $langs->trans($title), -1, 'category');
329
330$backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/categorie_list.php?leftmenu=cat&type='.urlencode($type));
331$linkback = '<a href="'.dol_sanitizeUrl($backtolist).'">'.$langs->trans("BackToList").'</a>';
332$object->next_prev_filter = 'type:=:'.((int) $object->type);
333$object->ref = $object->label;
334$morehtmlref = '<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/categorie_list.php?leftmenu=cat&type='.urlencode($type).'">'.$langs->trans("Root").'</a>';
335$morehtmlref .= ' > ';
336$ways = $object->print_all_ways("auto", '', 1, 0, 1);
337foreach ($ways as $way) {
338 $morehtmlref .= $way."<br>\n";
339}
340$morehtmlref .= '</div>';
341
342dol_banner_tab($object, 'label', $linkback, ($user->socid ? 0 : 1), 'label', 'label', $morehtmlref, '&type='.urlencode($type), 0, '', '', 1);
343
344
345// Confirmation of deletion
346if ($action == 'delete') {
347 if ($backtopage) {
348 print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.urlencode($type).'&backtopage='.urlencode($backtopage), $langs->trans('DeleteCategory'), $langs->trans('ConfirmDeleteCategory'), 'confirm_delete', '', '', 2);
349 } else {
350 print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.urlencode($type), $langs->trans('DeleteCategory'), $langs->trans('ConfirmDeleteCategory'), 'confirm_delete', '', '', 1);
351 }
352}
353
354print '<br>';
355
356print '<div class="fichecenter">';
357print '<div class="underbanner clearboth"></div>';
358print '<table class="border centpercent tableforfield">';
359
360// Description
361print '<tr><td class="titlefield notopnoleft tdtop">';
362print $langs->trans("Description").'</td><td>';
363print dol_htmlentitiesbr($object->description);
364print '</td></tr>';
365
366// Color
367print '<tr><td class="notopnoleft">';
368print $langs->trans("Color").'</td><td>';
369print $formother->showColor($object->color);
370print '</td></tr>';
371
372// Position
373print '<tr><td class="titlefield notopnoleft">';
374print $langs->trans("Position").'</td><td>';
375print $object->position ? $object->position : '';
376print '</td></tr>';
377
378// Other attributes
379include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
380
381print '</table>';
382print '</div>';
383
384print dol_get_fiche_end();
385
386
387/*
388 * Boutons actions
389 */
390
391print "<div class='tabsAction'>\n";
392$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
393if ($reshook < 0) {
394 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
395}
396if (empty($reshook)) {
397 if ($user->hasRight('categorie', 'creer')) {
398 $socid = ($object->socid ? $object->socid : "");
399 print '<a class="butAction" href="'.dolBuildUrl(DOL_URL_ROOT.'/categories/edit.php', ['id' => $object->id, 'socid' => $socid, 'type' => $type]).'">'.$langs->trans("Modify").'</a>';
400 }
401
402 if ($user->hasRight('categorie', 'supprimer')) {
403 print '<a class="butActionDelete" href="'.dolBuildUrl($_SERVER["PHP_SELF"], ['action' => 'delete', 'id' => $object->id, 'type' => $type, 'backtolist' => $backtolist], true).'">'.$langs->trans("Delete").'</a>';
404 }
405}
406
407print "</div>";
408
409$newcardbutton = '';
410if ($user->hasRight('categorie', 'creer')) {
411 $link = dolBuildUrl(DOL_URL_ROOT.'/categories/card.php', ['action'=> 'create', 'type' => $type, 'catorigin' => $object->id, 'backtopage' => dolBuildUrl($_SERVER["PHP_SELF"], ['type' => $type, 'id' => $id])]);
412
413 $newcardbutton = '<div class="right">';
414 $newcardbutton .= dolGetButtonTitle($langs->trans('NewCategory'), '', 'fa fa-plus-circle', $link);
415 $newcardbutton .= '</div>';
416}
417
418
419/*
420 * Sub-category tree view of this category
421 */
422
423print '<div class="fichecenter">';
424
425print load_fiche_titre($langs->trans("SubCats"), $newcardbutton, 'object_category');
426
427$cats = $object->get_filles();
428
429print '<table class="liste nohover noborder centpercent borderbottom">';
430
431print '<tr class="liste_titre">';
432print '<td>'.$langs->trans("SubCats").'</td>';
433print '<td></td>';
434print '<td class="right">';
435
436if (is_array($cats) && count($cats) > 1 && !empty($conf->use_javascript_ajax)) {
437 print '<div id="iddivjstreecontrol">';
438 print '<a class="notasortlink" href="#">'.img_picto('', 'folder').' '.$langs->trans("UndoExpandAll").'</a>';
439 print " | ";
440 print '<a class="notasortlink" href="#">'.img_picto('', 'folder-open').' '.$langs->trans("ExpandAll").'</a>';
441 print '</div>';
442}
443
444print '</td>';
445print '</tr>';
446
447if (is_numeric($cats) && $cats < 0) {
448 dol_print_error($db, $object->error, $object->errors);
449} elseif (count($cats) < 1) {
450 print '<tr class="oddeven nobottom nohover">';
451 print '<td colspan="3"><span class="opacitymedium">'.$langs->trans("NoSubCat").'</span></td>';
452 print '</tr>';
453} else {
454 $categstatic = new Categorie($db);
455
456 $fulltree = $categstatic->get_full_arbo($type, $object->id, 1);
457
458 // Load possible missing includes
459 if (getDolGlobalString('CATEGORY_SHOW_COUNTS')) {
460 if ($type == Categorie::TYPE_MEMBER) {
461 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
462 }
463 if ($type == Categorie::TYPE_ACCOUNT) {
464 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
465 }
466 if ($type == Categorie::TYPE_PROJECT) {
467 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
468 }
469 if ($type == Categorie::TYPE_USER) {
470 require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
471 }
472 }
473
474 // Define data (format for treeview)
475 $data = array();
476 $data[] = array('rowid' => 0, 'fk_menu' => -1, 'title' => 'racine', 'mainmenu' => '', 'leftmenu' => '', 'fk_mainmenu' => '', 'fk_leftmenu' => '');
477 foreach ($fulltree as $key => $val) {
478 $categstatic->id = $val['id'];
479 $categstatic->ref = $val['label'];
480 $categstatic->color = $val['color'];
481 $categstatic->type = $type;
482 //$desc = dol_htmlcleanlastbr($val['description']);
483
484 $counter = '';
485 if (getDolGlobalString('CATEGORY_SHOW_COUNTS')) {
486 // we need only a count of the elements, so it is enough to consume only the id's from the database
487 $elements = $categstatic->getObjectsInCateg($type, 1);
488
489 $counter = "<td class='left' width='40px;'>".(is_array($elements) ? count($elements) : '0')."</td>";
490 }
491
492 if ($categstatic->color) {
493 $stylecolor = ' style="background: #'.sprintf("%06s", $categstatic->color).';"';
494 } else {
495 $stylecolor = ' style="background: #bbb;"';
496 }
497 $li = $categstatic->getNomUrl(1, '', 60, '&backtolist='.urlencode($_SERVER["PHP_SELF"].'?id='.((int) $id).'&type='.urlencode($type)), 0);
498
499 $entry = '<table class="nobordernopadding centpercent">';
500 $entry .= '<tr>';
501
502 $entry .= '<td>';
503 $entry .= '<span class="noborderoncategories" '.$stylecolor.'>'.$li.'</span>';
504 $entry .= '</td>';
505
506 $entry .= $counter;
507
508 $entry .= '<td class="right" width="20px;">';
509 $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>';
510 $entry .= '</td>';
511 $entry .= '<td class="right" width="20px;">';
512 $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>';
513 $entry .= '</td>';
514 $entry .= '<td class="right" width="20px;">';
515 $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>';
516 $entry .= '</td>';
517
518 $entry .= '</tr>';
519 $entry .= '</table>';
520
521 $data[] = array('rowid' => $val['rowid'], 'fk_menu' => $val['fk_parent'], 'entry' => $entry);
522 }
523
524 $nbofentries = (count($data) - 1);
525 if ($nbofentries > 0) {
526 require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php';
527 print '<tr class="pair">';
528 print '<td colspan="3">';
529
530 // $data[0] is the current shown category, to don'T show the current category use $data[1] instead
531 tree_recur($data, $data[1], 0);
532
533 print '</td>';
534 print '</tr>';
535 } else {
536 print '<tr class="pair">';
537 print '<td colspan="3">';
538 print '<table class="nobordernopadding">';
539
540 print '<tr class="nobordernopadding">';
541 print '<td>'.img_picto_common('', 'treemenu/branchbottom.gif').'</td>';
542 print '<td class="valignmiddle"><span class="opacitymedium">'.$langs->trans("NoCategoryYet").'</span></td>';
543 print '<td>&nbsp;</td>';
544 print '</tr>';
545
546 print '</table>';
547 print '</td>';
548 print '</tr>';
549 }
550}
551
552print "</table>";
553print "</div>";
554
555// List of mass actions available
556$arrayofmassactions = array(
557 //'validate'=>$langs->trans("Validate"),
558 //'generate_doc'=>$langs->trans("ReGeneratePDF"),
559 //'builddoc'=>$langs->trans("PDFMerge"),
560 //'presend'=>$langs->trans("SendByMail"),
561);
562$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
563
564$typeid = $type; // warning, typeid can be a string
565
566
567// List of products or services (type is type of category)
568if ($type == Categorie::TYPE_PRODUCT) {
569 if ($user->hasRight("product", "read") || $user->hasRight("service", "read")) {
570 $permission = ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer'));
571 $showclassifyform = ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer'));
572
573 $prods = $object->getObjectsInCateg($type, 0, $limit, $offset, 'ref');
574 if ($prods < 0) {
575 dol_print_error($db, $object->error, $object->errors);
576 } else {
578 '@phan-var-force Product[] $prods';
579 // Form to add record into the category
580 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
581 print '<input type="hidden" name="token" value="'.newToken().'">';
582 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
583 print '<input type="hidden" name="type" value="'.$typeid.'">';
584 print '<input type="hidden" name="id" value="'.$object->id.'">';
585 print '<input type="hidden" name="page_y" value="">';
586 print '<input type="hidden" name="action" value="list">';
587
588 print '<br>';
589 $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
590 $num = count($prods);
591 $nbtotalofrecords = '';
592 $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'));
593
594 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
595 print_barre_liste($langs->trans("ProductsAndServices"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'products', 0, $newcardbutton, '', $limit);
596
597 if ($showclassifyform) {
598 print '<table class="noborder centpercent">';
599 print '<tr class="liste_titre"><td>';
600 print $langs->trans("AddProductServiceIntoCategory").' &nbsp;';
601 $form->select_produits(0, 'elemid', '', 0, 0, -1, 2, '', 1, array(), 0, 1, 0, '', 0, '', null);
602 print '<input type="submit" class="button buttongen" name="addintocategory" value="'.$langs->trans("ClassifyInCategory").'"></td>';
603 print '</tr>';
604 print '</table>';
605 }
606
607 print '<table class="noborder centpercent">'."\n";
608 print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Ref").'</td></tr>'."\n";
609
610 if (count($prods) > 0) {
611 $i = 0;
612 foreach ($prods as $prod) {
613 $i++;
614 if ($i > $limit) {
615 break;
616 }
617
618 print '<tr class="oddeven">'."\n";
619 print '<td class="nowrap tdtop">';
620 print $prod->getNomUrl(1);
621 print "</td>\n";
622
623 $product_thumbnail_html = '';
624 if (!empty($prod->entity)) {
625 $product_thumbnail = $prod->show_photos('product', $conf->product->multidir_output[(int) $prod->entity], 1, 1, 0, 0, 0, 80);
626 if ($prod->nbphoto > 0) {
627 $product_thumbnail_html = $product_thumbnail;
628 }
629 }
630 print '<td class="left">' . $product_thumbnail_html . '</td>';
631 $product_stock_info = "";
632 if (isModEnabled("stock") && ($user->hasRight("stock", "read"))) {
633 $product_stock_info = "<br>" . $langs->trans("Stock") . ": " . $prod->stock_reel;
634 }
635
636 print '<td class="tdtop">' . dolPrintHTML($prod->label) . "<br>" . dolPrintHTML($prod->description) . $product_stock_info . "</td>\n";
637
638 // Link to delete from category
639 print '<td class="right">';
640 if ($permission) {
641 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 : '').'">';
642 //print $langs->trans("DeleteFromCat");
643 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
644 print "</a>";
645 }
646 print '</td>';
647 print "</tr>\n";
648 }
649 } else {
650 print '<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</span></td></tr>';
651 }
652 print "</table>\n";
653
654 print "</form>\n";
655 }
656 } else {
657 print_barre_liste($langs->trans("ProductsAndServices"), null, $_SERVER["PHP_SELF"], '', '', '', '', 0, '', 'products');
658 accessforbidden("NotEnoughPermissions", 0, 0);
659 }
660}
661
662// List of customers
663if ($type == Categorie::TYPE_CUSTOMER) {
664 if ($user->hasRight("societe", "read")) {
665 $permission = $user->hasRight('societe', 'creer');
666 $showclassifyform = $user->hasRight('societe', 'creer');
667
668 $socs = $object->getObjectsInCateg($type, 0, $limit, $offset, 'nom');
669 if ($socs < 0) {
670 dol_print_error($db, $object->error, $object->errors);
671 } else {
673 '@phan-var-force Societe[] $socs';
674 // Form to add record into a category
675 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
676 print '<input type="hidden" name="token" value="'.newToken().'">';
677 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
678 print '<input type="hidden" name="type" value="'.$typeid.'">';
679 print '<input type="hidden" name="id" value="'.$object->id.'">';
680 print '<input type="hidden" name="action" value="list">';
681 print '<input type="hidden" name="page_y" value="">';
682
683 print '<br>';
684 $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
685 $num = count($socs);
686 $nbtotalofrecords = '';
687 $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'));
688
689 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
690 print_barre_liste($langs->trans("Customers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'companies', 0, $newcardbutton, '', $limit);
691
692 if ($showclassifyform) {
693 print '<table class="noborder centpercent">';
694 print '<tr class="liste_titre"><td>';
695 print $langs->trans("AddCustomerIntoCategory").' &nbsp;';
696 $filter = '(s.client:IN:1,2,3)';
697 print $form->select_company('', 'elemid', $filter);
698 print '<input type="submit" class="reposition button buttongen" name="addintocategory" value="'.$langs->trans("ClassifyInCategory").'"></td>';
699 print '</tr>';
700 print '</table>';
701 }
702
703 print '<table class="noborder centpercent">'."\n";
704 print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Name").'</td></tr>'."\n";
705
706 if (count($socs) > 0) {
707 $i = 0;
708 foreach ($socs as $key => $soc) {
709 $i++;
710 if ($i > $limit) {
711 break;
712 }
713
714 print "\t".'<tr class="oddeven">'."\n";
715 print '<td class="nowrap tdtop tdoverflowmax250">';
716 print $soc->getNomUrl(1);
717 print "</td>\n";
718 // Link to delete from category
719 print '<td class="right">';
720 if ($permission) {
721 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 : '')."'>";
722 //print $langs->trans("DeleteFromCat");
723 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
724 print "</a>";
725 }
726 print '</td>';
727 print "</tr>\n";
728 }
729 } else {
730 print '<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</span></td></tr>';
731 }
732 print "</table>\n";
733
734 print "</form>\n";
735 }
736 } else {
737 print_barre_liste($langs->trans("Customers"), null, $_SERVER["PHP_SELF"], '', '', '', '', 0, '', 'companies');
738 accessforbidden("NotEnoughPermissions", 0, 0);
739 }
740}
741
742// List of suppliers
743if ($type == Categorie::TYPE_SUPPLIER) {
744 if ($user->hasRight("fournisseur", "read")) {
745 $permission = $user->hasRight('societe', 'creer');
746 $showclassifyform = $user->hasRight('societe', 'creer');
747
748 $socs = $object->getObjectsInCateg($type, 0, $limit, $offset, 'nom');
749
750 if ($socs < 0) {
751 dol_print_error($db, $object->error, $object->errors);
752 } else {
754 '@phan-var-force Fournisseur[] $socs';
755 // Form to add record into a category
756 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
757 print '<input type="hidden" name="token" value="'.newToken().'">';
758 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
759 print '<input type="hidden" name="type" value="'.$typeid.'">';
760 print '<input type="hidden" name="id" value="'.$object->id.'">';
761 print '<input type="hidden" name="page_y" value="">';
762 print '<input type="hidden" name="action" value="list">';
763
764 print '<br>';
765 $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
766 $num = count($socs);
767 $nbtotalofrecords = '';
768 $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'));
769
770 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
771 print_barre_liste($langs->trans("Suppliers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'companies', 0, $newcardbutton, '', $limit);
772
773 if ($showclassifyform) {
774 print '<table class="noborder centpercent">';
775 print '<tr class="liste_titre"><td>';
776 print $langs->trans("AddSupplierIntoCategory").' &nbsp;';
777 $filter = '(s.fournisseur:=:1)';
778 print $form->select_company('', 'elemid', $filter);
779 print '<input type="submit" class="button buttongen" name="addintocategory" value="'.$langs->trans("ClassifyInCategory").'"></td>';
780 print '</tr>';
781 print '</table>';
782 }
783
784 print '<table class="noborder centpercent">'."\n";
785 print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Name")."</td></tr>\n";
786
787 if (count($socs) > 0) {
788 $i = 0;
789 foreach ($socs as $soc) {
790 $i++;
791 if ($i > $limit) {
792 break;
793 }
794
795 print "\t".'<tr class="oddeven">'."\n";
796 print '<td class="nowrap tdtop">';
797 print $soc->getNomUrl(1);
798 print "</td>\n";
799 // Link to delete from category
800 print '<td class="right">';
801 if ($permission) {
802 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 : '').'">';
803 //print $langs->trans("DeleteFromCat");
804 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
805 print "</a>";
806 }
807 print '</td>';
808
809 print "</tr>\n";
810 }
811 } else {
812 print '<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</span></td></tr>';
813 }
814 print "</table>\n";
815
816 print "</form>\n";
817 }
818 } else {
819 print_barre_liste($langs->trans("Suppliers"), null, $_SERVER["PHP_SELF"], '', '', '', '', 0, '', 'companies');
820 accessforbidden("NotEnoughPermissions", 0, 0);
821 }
822}
823
824// List of members
825if ($type == Categorie::TYPE_MEMBER) {
826 if ($user->hasRight("adherent", "read")) {
827 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
828
829 $permission = $user->hasRight('adherent', 'creer');
830 $showclassifyform = $user->hasRight('adherent', 'creer');
831
832 $members = $object->getObjectsInCateg($type, 0, $limit, $offset, 'lastname');
833 if ($members < 0) {
834 dol_print_error($db, $object->error, $object->errors);
835 } else {
837 '@phan-var-force Adherent[] $members';
838 // Form to add record into a category
839 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
840 print '<input type="hidden" name="token" value="'.newToken().'">';
841 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
842 print '<input type="hidden" name="type" value="'.$typeid.'">';
843 print '<input type="hidden" name="id" value="'.$object->id.'">';
844 print '<input type="hidden" name="page_y" value="">';
845 print '<input type="hidden" name="action" value="list">';
846
847 print '<br>';
848 $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
849 $num = count($members);
850 $nbtotalofrecords = '';
851 $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'));
852
853 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
854 print_barre_liste($langs->trans("Member"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit);
855
856 if ($showclassifyform) {
857 print '<table class="noborder centpercent">';
858 print '<tr class="liste_titre"><td>';
859 print $langs->trans("AssignCategoryTo").' &nbsp;';
860 print $form->selectMembers('', 'elemid');
861 print '<input type="submit" class="button buttongen" value="'.$langs->trans("Save").'"></td>';
862 print '</tr>';
863 print '</table>';
864 }
865
866 print '<table class="noborder centpercent">'."\n";
867 print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Name").'</td></tr>'."\n";
868
869 if (count($members) > 0) {
870 $i = 0;
871 foreach ($members as $key => $member) {
872 $i++;
873 if ($i > $limit) {
874 break;
875 }
876
877 print "\t".'<tr class="oddeven">'."\n";
878 print '<td class="nowrap tdtop">';
879 $member->ref = $member->login;
880 print $member->getNomUrl(1, 0);
881 print "</td>\n";
882 print '<td class="tdtop">'.$member->lastname."</td>\n";
883 print '<td class="tdtop">'.$member->firstname."</td>\n";
884 // Link to delete from category
885 print '<td class="right">';
886 if ($permission) {
887 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 : '')."'>";
888 //print $langs->trans("DeleteFromCat");
889 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
890 print "</a>";
891 }
892 print '</td>';
893 print "</tr>\n";
894 }
895 } else {
896 print '<tr class="oddeven"><td colspan="4"><span class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</span></td></tr>';
897 }
898 print "</table>\n";
899
900 print "</form>\n";
901 }
902 } else {
903 print_barre_liste($langs->trans("Member"), null, $_SERVER["PHP_SELF"], '', '', '', '', 0, '', 'members');
904 accessforbidden("NotEnoughPermissions", 0, 0);
905 }
906}
907
908// List of contacts
909if ($type == Categorie::TYPE_CONTACT) {
910 if ($user->hasRight("societe", "read")) {
911 $permission = $user->hasRight('societe', 'creer');
912 $showclassifyform = $user->hasRight('societe', 'creer');
913
914 $contacts = $object->getObjectsInCateg($type, 0, $limit, $offset, 'lastname');
915 if (is_numeric($contacts) && $contacts < 0) {
916 dol_print_error($db, $object->error, $object->errors);
917 } else {
919 '@phan-var-force Contact[] $contacts';
920 // Form to add record into a category
921 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
922 print '<input type="hidden" name="token" value="'.newToken().'">';
923 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
924 print '<input type="hidden" name="type" value="'.$typeid.'">';
925 print '<input type="hidden" name="id" value="'.$object->id.'">';
926 print '<input type="hidden" name="page_y" value="">';
927 print '<input type="hidden" name="action" value="list">';
928
929 print '<br>';
930 $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
931 $num = count($contacts);
932 $nbtotalofrecords = '';
933 $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'));
934
935 $objsoc = new Societe($db);
936
937 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
938 print_barre_liste($langs->trans("Contact"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contact', 0, $newcardbutton, '', $limit);
939
940 if ($showclassifyform) {
941 print '<table class="noborder centpercent">';
942 print '<tr class="liste_titre"><td>';
943 print $langs->trans("AssignCategoryTo").' &nbsp;';
944 print $form->select_contact(0, '', 'elemid', '', '', '', 0, 'maxwidth300 widthcentpercentminusx');
945 print '<input type="submit" class="button buttongen" name="addintocategory" value="'.$langs->trans("ClassifyInCategory").'"></td>';
946 print '</tr>';
947 print '</table>';
948 }
949
950 print '<table class="noborder centpercent">'."\n";
951 print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Ref").'</td></tr>'."\n";
952
953 if (is_array($contacts) && count($contacts) > 0) {
954 $i = 0;
955 foreach ($contacts as $key => $contact) {
956 $i++;
957 if ($i > $limit) {
958 break;
959 }
960
961 print "\t".'<tr class="oddeven">'."\n";
962 print '<td class="nowrap tdtop">';
963 print $contact->getNomUrl(1, 'category');
964 if ($contact->socid > 0) {
965 $objsoc->fetch($contact->socid);
966 print ' - ';
967 print $objsoc->getNomUrl(1, 'contact');
968 }
969 print "</td>\n";
970 // Link to delete from category
971 print '<td class="right">';
972 if ($permission) {
973 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 : '')."'>";
974 //print $langs->trans("DeleteFromCat");
975 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
976 print "</a>";
977 }
978 print '</td>';
979 print "</tr>\n";
980 }
981 } else {
982 print '<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</span></td></tr>';
983 }
984 print "</table>\n";
985
986 print "</form>\n";
987 }
988 } else {
989 print_barre_liste($langs->trans("Contact"), null, $_SERVER["PHP_SELF"], '', '', '', '', 0, '', 'contact');
990 accessforbidden("NotEnoughPermissions", 0, 0);
991 }
992}
993
994// List of bank accounts
995if ($type == Categorie::TYPE_ACCOUNT) {
996 if ($user->hasRight("banque", "read")) {
997 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
998
999 $permission = $user->hasRight('banque', 'creer');
1000 $showclassifyform = $user->hasRight('banque', 'creer');
1001
1002 $accounts = $object->getObjectsInCateg($type, 0, $limit, $offset);
1003 if ($accounts < 0) {
1004 dol_print_error($db, $object->error, $object->errors);
1005 } else {
1007 '@phan-var-force Account[] $accounts';
1008 // Form to add record into a category
1009 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1010 print '<input type="hidden" name="token" value="'.newToken().'">';
1011 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1012 print '<input type="hidden" name="type" value="'.$typeid.'">';
1013 print '<input type="hidden" name="id" value="'.$object->id.'">';
1014 print '<input type="hidden" name="page_y" value="">';
1015 print '<input type="hidden" name="action" value="list">';
1016
1017 print '<br>';
1018 $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
1019 $num = count($accounts);
1020 $nbtotalofrecords = '';
1021 $newcardbutton = '';
1022
1023 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
1024 print_barre_liste($langs->trans("Account"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bank_account', 0, $newcardbutton, '', $limit);
1025
1026 if ($showclassifyform) {
1027 print '<table class="noborder centpercent">';
1028 print '<tr class="liste_titre"><td>';
1029 print $langs->trans("AddObjectIntoCategory").' &nbsp;';
1030 print $form->select_comptes('', 'elemid', 0, '', 0, '', 0, '', 1);
1031 print '<input type="submit" class="button buttongen" name="addintocategory" value="'.$langs->trans("ClassifyInCategory").'"></td>';
1032 print '</tr>';
1033 print '</table>';
1034 }
1035
1036 print '<table class="noborder centpercent">'."\n";
1037 print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Ref").'</td></tr>'."\n";
1038
1039 if (count($accounts) > 0) {
1040 $i = 0;
1041 foreach ($accounts as $key => $account) {
1042 $i++;
1043 if ($i > $limit) {
1044 break;
1045 }
1046
1047 print "\t".'<tr class="oddeven">'."\n";
1048 print '<td class="nowrap tdtop">';
1049 print $account->getNomUrl(1, '0');
1050 print "</td>\n";
1051 print '<td class="tdtop">'.$account->bank."</td>\n";
1052 print '<td class="tdtop">'.$account->number."</td>\n";
1053 // Link to delete from category
1054 print '<td class="right">';
1055 if ($permission) {
1056 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 : '')."'>";
1057 //print $langs->trans("DeleteFromCat");
1058 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
1059 print "</a>";
1060 }
1061 print '</td>';
1062 print "</tr>\n";
1063 }
1064 } else {
1065 print '<tr class="oddeven"><td colspan="4"><span class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</span></td></tr>';
1066 }
1067 print "</table>\n";
1068
1069 print "</form>\n";
1070 }
1071 } else {
1072 print_barre_liste($langs->trans("Banque"), null, $_SERVER["PHP_SELF"], '', '', '', '', 0, '', 'bank');
1073 accessforbidden("NotEnoughPermissions", 0, 0);
1074 }
1075}
1076
1077// List of Project
1078if ($type == Categorie::TYPE_PROJECT) {
1079 if ($user->hasRight("project", "read")) {
1080 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
1081
1082 $permission = $user->hasRight('projet', 'creer');
1083 $showclassifyform = $user->hasRight('projet', 'creer');
1084
1085 $objects = $object->getObjectsInCateg($type, 0, $limit, $offset);
1086 if ($objects < 0) {
1087 dol_print_error($db, $object->error, $object->errors);
1088 } else {
1090 '@phan-var-force Project[] $objects';
1091 // Form to add record into a category
1092 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1093 print '<input type="hidden" name="token" value="'.newToken().'">';
1094 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1095 print '<input type="hidden" name="type" value="'.$typeid.'">';
1096 print '<input type="hidden" name="id" value="'.$object->id.'">';
1097 print '<input type="hidden" name="page_y" value="">';
1098 print '<input type="hidden" name="action" value="list">';
1099
1100 print '<br>';
1101 $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
1102 $num = count($objects);
1103 $nbtotalofrecords = '';
1104 $newcardbutton = '';
1105
1106 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
1107 print_barre_liste($langs->trans("Project"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'project', 0, $newcardbutton, '', $limit);
1108
1109 if ($showclassifyform) {
1110 print '<table class="noborder centpercent">';
1111 print '<tr class="liste_titre"><td>';
1112 print $langs->trans("AddObjectIntoCategory").' &nbsp;';
1113 $form->selectProjects('', 'elemid');
1114 print '<input type="submit" class="button buttongen" name="addintocategory" value="'.$langs->trans("ClassifyInCategory").'"></td>';
1115 print '</tr>';
1116 print '</table>';
1117 }
1118
1119 print '<table class="noborder centpercent">'."\n";
1120 print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Ref").'</td></tr>'."\n";
1121
1122 if (count($objects) > 0) {
1123 $i = 0;
1124 foreach ($objects as $key => $project) {
1125 $i++;
1126 if ($i > $limit) {
1127 break;
1128 }
1129
1130 print "\t".'<tr class="oddeven">'."\n";
1131 print '<td class="nowrap tdtop">';
1132 print $project->getNomUrl(1);
1133 print "</td>\n";
1134 print '<td class="tdtop">'.$project->title."</td>\n";
1135 // Link to delete from category
1136 print '<td class="right">';
1137 if ($permission) {
1138 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 : '')."'>";
1139 //print $langs->trans("DeleteFromCat");
1140 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
1141 print "</a>";
1142 }
1143 print '</td>';
1144 print "</tr>\n";
1145 }
1146 } else {
1147 print '<tr class="oddeven"><td colspan="4"><span class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</span></td></tr>';
1148 }
1149 print "</table>\n";
1150
1151 print "</form>\n";
1152 }
1153 } else {
1154 print_barre_liste($langs->trans("Project"), null, $_SERVER["PHP_SELF"], '', '', '', '', 0, '', 'project');
1155 accessforbidden("NotEnoughPermissions", 0, 0);
1156 }
1157}
1158
1159// List of users
1160if ($type == Categorie::TYPE_USER) {
1161 if ($user->hasRight("user", "user", "read")) {
1162 require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
1163 $showclassifyform = $user->hasRight("user", "user", "creer");
1164
1165 $users = $object->getObjectsInCateg($type, 0, 0, 0, 'lastname');
1166 if ($users < 0) {
1167 dol_print_error($db, $object->error, $object->errors);
1168 } else {
1170 '@phan-var-force User[] $users';
1171
1172 // Form to add record into a category
1173 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1174 print '<input type="hidden" name="token" value="'.newToken().'">';
1175 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1176 print '<input type="hidden" name="type" value="'.$typeid.'">';
1177 print '<input type="hidden" name="id" value="'.$object->id.'">';
1178 print '<input type="hidden" name="page_y" value="">';
1179 print '<input type="hidden" name="action" value="list">';
1180
1181 print '<br>';
1182
1183 $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
1184 $num = count($users);
1185 $nbtotalofrecords = '';
1186 $newcardbutton = '';
1187
1188 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
1189 print_barre_liste($langs->trans("Users"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'user', 0, '', '', $limit);
1190
1191 if ($showclassifyform) {
1192 print '<table class="noborder centpercent">';
1193 print '<tr class="liste_titre"><td>';
1194 $force_entity = getEntity($object->element); // So we will get same filter than the getObjectsInCateg()
1195 print img_picto('', $type, 'class="pictofixedwidth"');
1196 print $form->select_dolusers('', 'elemid', 1, null, 0, '', '', $force_entity);
1197 print '<input type="submit" class="button buttongen" name="addintocategory" value="'.$langs->trans("ClassifyInCategory").'"></td>';
1198 print '</tr>';
1199 print '</table>';
1200 }
1201
1202 print '<table class="noborder centpercent">'."\n";
1203 print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Users").' <span class="badge">'.$num.'</span></td></tr>'."\n";
1204
1205 if (count($users) > 0) {
1206 // Use "$userentry" here, because "$user" is the current user
1207 foreach ($users as $key => $userentry) {
1208 print "\t".'<tr class="oddeven">'."\n";
1209 print '<td class="nowrap tdtop">';
1210 print $userentry->getNomUrl(-1);
1211 print "</td>\n";
1212 print '<td class="tdtop">'.$userentry->job."</td>\n";
1213
1214 // Link to delete from category
1215 print '<td class="right">';
1216 if ($user->hasRight('user', 'user', 'creer')) {
1217 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 : '')."'>";
1218 //print $langs->trans("DeleteFromCat");
1219 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
1220 print "</a>";
1221 }
1222 print '</td>';
1223 print "</tr>\n";
1224 }
1225 } else {
1226 print '<tr class="oddeven"><td colspan="3"><span class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</span></td></tr>';
1227 }
1228 print "</table>\n";
1229
1230 print "</form>\n";
1231 }
1232 } else {
1233 print_barre_liste($langs->trans("Users"), null, $_SERVER["PHP_SELF"], '', '', '', '', 0, '', 'user');
1234 accessforbidden("NotEnoughPermissions", 0, 0);
1235 }
1236}
1237
1238// List of warehouses
1239if ($type == Categorie::TYPE_WAREHOUSE) {
1240 if ($user->hasRight("stock", "read")) {
1241 $permission = $user->hasRight('stock', 'creer');
1242 $showclassifyform = $user->hasRight('stock', 'creer');
1243
1244 require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
1245
1246 $objects = $object->getObjectsInCateg($type, 0, $limit, $offset);
1247 if ($objects < 0) {
1248 dol_print_error($db, $object->error, $object->errors);
1249 } else {
1251 '@phan-var-force Entrepot[] $objects';
1252 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1253 print '<input type="hidden" name="token" value="'.newToken().'">';
1254 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1255 print '<input type="hidden" name="type" value="'.$typeid.'">';
1256 print '<input type="hidden" name="id" value="'.$object->id.'">';
1257 print '<input type="hidden" name="page_y" value="">';
1258 print '<input type="hidden" name="action" value="list">';
1259
1260 print '<br>';
1261 $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
1262 $num = count($objects);
1263 $nbtotalofrecords = '';
1264 $newcardbutton = '';
1265
1266 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
1267 print_barre_liste($langs->trans("Warehouses"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'stock', 0, $newcardbutton, '', $limit);
1268
1269 if ($showclassifyform) {
1270 print '<table class="noborder centpercent">';
1271 print '<tr class="liste_titre"><td>';
1272 print $langs->trans("AddTicketIntoCategory").' &nbsp;';
1273 print $form->selectForForms('Entrepot:product/stock/class/entrepot.class.php', 'elemid', 0, 1, '', '', 'maxwidth500');
1274 print '<input type="submit" class="button buttongen" name="addintocategory" value="'.$langs->trans("ClassifyInCategory").'"></td>';
1275 print '</tr>';
1276 print '</table>';
1277 }
1278
1279 print '<table class="noborder centpercent">'."\n";
1280 print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Ref").'</td></tr>'."\n";
1281
1282 if (count($objects) > 0) {
1283 $i = 0;
1284 foreach ($objects as $key => $warehouse) {
1285 $i++;
1286 if ($i > $limit) {
1287 break;
1288 }
1289
1290 print "\t".'<tr class="oddeven">'."\n";
1291 print '<td class="nowrap tdtop">';
1292 print $warehouse->getNomUrl(1);
1293 print "</td>\n";
1294 print '<td class="tdtop">'.$warehouse->ref."</td>\n";
1295 print '<td class="tdtop">'.$warehouse->lieu."</td>\n";
1296 // Link to delete from category
1297 print '<td class="right">';
1298 if ($permission) {
1299 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 : '')."'>";
1300 //print $langs->trans("DeleteFromCat");
1301 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
1302 print "</a>";
1303 }
1304 print '</td>';
1305 print "</tr>\n";
1306 }
1307 } else {
1308 print '<tr class="oddeven"><td colspan="4"><span class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</span></td></tr>';
1309 }
1310 print "</table>\n";
1311
1312 print "</form>\n";
1313 }
1314 } else {
1315 print_barre_liste($langs->trans("Warehouse"), null, $_SERVER["PHP_SELF"], '', '', '', '', 0, '', 'stock');
1316 accessforbidden("NotEnoughPermissions", 0, 0);
1317 }
1318}
1319
1320// List of tickets
1321if ($type == Categorie::TYPE_TICKET) {
1322 if ($user->hasRight("ticket", "read")) {
1323 $permission = $user->hasRight('categorie', 'creer');
1324 $showclassifyform = $user->hasRight('categorie', 'creer');
1325
1326 $tickets = $object->getObjectsInCateg($type, 0, $limit, $offset);
1327 if ($tickets < 0) {
1328 dol_print_error($db, $object->error, $object->errors);
1329 } else {
1331 '@phan-var-force Ticket[] $tickets';
1332 // Form to add record into a category
1333 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1334 print '<input type="hidden" name="token" value="'.newToken().'">';
1335 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1336 print '<input type="hidden" name="type" value="'.$typeid.'">';
1337 print '<input type="hidden" name="id" value="'.$object->id.'">';
1338 print '<input type="hidden" name="page_y" value="">';
1339 print '<input type="hidden" name="action" value="list">';
1340
1341 print '<br>';
1342 $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
1343 $num = count($tickets);
1344 $nbtotalofrecords = '';
1345 $newcardbutton = '';
1346
1347 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
1348 print_barre_liste($langs->trans("Ticket"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'ticket', 0, $newcardbutton, '', $limit);
1349
1350 if ($showclassifyform) {
1351 print '<table class="noborder centpercent">';
1352 print '<tr class="liste_titre"><td>';
1353 print $langs->trans("AddTicketIntoCategory").' &nbsp;';
1354 $form->selectTickets('', 'elemid');
1355 print '<input type="submit" class="button buttongen" name="addintocategory" value="'.$langs->trans("ClassifyInCategory").'"></td>';
1356 print '</tr>';
1357 print '</table>';
1358 }
1359
1360 print '<table class="noborder centpercent">'."\n";
1361 print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Ref").'</td></tr>'."\n";
1362
1363 if (count($tickets) > 0) {
1364 $i = 0;
1365 foreach ($tickets as $ticket) {
1366 $i++;
1367 if ($i > $limit) {
1368 break;
1369 }
1370
1371 print "\t".'<tr class="oddeven">'."\n";
1372 print '<td class="nowrap tdtop">';
1373 print $ticket->getNomUrl(1);
1374 print "</td>\n";
1375 print '<td class="tdtop">'.$ticket->track_id."</td>\n";
1376 // Link to delete from category
1377 print '<td class="right">';
1378 if ($permission) {
1379 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 : '')."'>";
1380 //print $langs->trans("DeleteFromCat");
1381 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
1382 print "</a>";
1383 }
1384 print '</td>';
1385 print "</tr>\n";
1386 }
1387 } else {
1388 print '<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</span></td></tr>';
1389 }
1390 print "</table>\n";
1391
1392 print "</form>\n";
1393 }
1394 } else {
1395 print_barre_liste($langs->trans("Ticket"), null, $_SERVER["PHP_SELF"], '', '', '', '', 0, '', 'ticket');
1396 accessforbidden("NotEnoughPermissions", 0, 0);
1397 }
1398}
1399
1400// List of Interventions
1401if ($type == Categorie::TYPE_FICHINTER) {
1402 if ($user->hasRight("fichinter", "lire")) {
1403 $permission = $user->hasRight('categorie', 'creer');
1404 $showclassifyform = $user->hasRight('categorie', 'creer');
1405
1406 $fichinters = $object->getObjectsInCateg($type, 0, $limit, $offset);
1407 if ($fichinters < 0) {
1408 dol_print_error($db, $object->error, $object->errors);
1409 } else {
1411 '@phan-var-force Fichinter[] $fichinters';
1412
1413 // Form to add record into a category
1414 if ($showclassifyform) {
1415 print '<br>';
1416 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1417 print '<input type="hidden" name="token" value="'.newToken().'">';
1418 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1419 print '<input type="hidden" name="type" value="'.$typeid.'">';
1420 print '<input type="hidden" name="id" value="'.$object->id.'">';
1421 print '<input type="hidden" name="action" value="addintocategory">';
1422 print '<table class="noborder centpercent">';
1423 print '<tr class="liste_titre"><td>';
1424 print $langs->trans("AddFichinterIntoCategory").' &nbsp;';
1425 print $form->selectForForms('Fichinter:fichinter/class/fichinter.class.php', 'elemid', 0, 1, '', '', 'maxwidth500');
1426 print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
1427 print '</tr>';
1428 print '</table>';
1429 print '</form>';
1430 }
1431
1432 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1433 print '<input type="hidden" name="token" value="'.newToken().'">';
1434 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1435 print '<input type="hidden" name="type" value="'.$typeid.'">';
1436 print '<input type="hidden" name="id" value="'.$object->id.'">';
1437 print '<input type="hidden" name="action" value="list">';
1438
1439 print '<br>';
1440 $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
1441 $num = count($fichinters);
1442 $nbtotalofrecords = '';
1443 $newcardbutton = '';
1444
1445 $langs->load('interventions');
1446 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
1447 print_barre_liste($langs->trans("Intervention"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_intervention', 0, $newcardbutton, '', $limit);
1448 print '<table class="noborder centpercent">'."\n";
1449 print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Ref").'</td></tr>'."\n";
1450
1451 if (count($fichinters) > 0) {
1452 $i = 0;
1453 foreach ($fichinters as $fichinter) {
1454 $i++;
1455 if ($i > $limit) {
1456 break;
1457 }
1458
1459 print "\t".'<tr class="oddeven">'."\n";
1460 print '<td class="nowrap tdtop">';
1461 print $fichinter->getNomUrl(1);
1462 print "</td>\n";
1463 print '<td class="tdtop">'.$fichinter->description."</td>\n";
1464 // Link to delete from category
1465 print '<td class="right">';
1466 if ($permission) {
1467 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 : '')."'>";
1468 print $langs->trans("DeleteFromCat");
1469 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
1470 print "</a>";
1471 }
1472 print '</td>';
1473 print "</tr>\n";
1474 }
1475 } else {
1476 print '<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</span></td></tr>';
1477 }
1478 print "</table>\n";
1479 print "</form>\n";
1480 }
1481 } else {
1482 print_barre_liste($langs->trans("Intervention"), null, $_SERVER["PHP_SELF"], '', '', '', '', 0, '', 'fichinter');
1483 accessforbidden("NotEnoughPermissions", 0, 0);
1484 }
1485}
1486
1487// List of Orders
1488if ($type == Categorie::TYPE_ORDER) {
1489 require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
1490
1491 $permission = $user->hasRight('commande', 'creer');
1492
1493 $objects = $object->getObjectsInCateg($type, 0, $limit, $offset);
1494 if ($objects < 0) {
1495 dol_print_error($db, $object->error, $object->errors);
1496 } else {
1498 '@phan-var-force Commande[] $objects';
1499 // Form to add record into a category
1500 $showclassifyform = $user->hasRight('order', 'write');
1501 if ($showclassifyform) {
1502 print '<br>';
1503 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1504 print '<input type="hidden" name="token" value="'.newToken().'">';
1505 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1506 print '<input type="hidden" name="type" value="'.$typeid.'">';
1507 print '<input type="hidden" name="id" value="'.$object->id.'">';
1508 print '<input type="hidden" name="action" value="addintocategory">';
1509 print '<table class="noborder centpercent">';
1510 print '<tr class="liste_titre"><td>';
1511 print $langs->trans("AddOrderIntoCategory").' &nbsp;';
1512 print $form->selectForForms('Commande:commande/class/commande.class.php', 'elemid', 0, 1, '', '', 'maxwidth500');
1513 print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
1514 print '</tr>';
1515 print '</table>';
1516 print '</form>';
1517 }
1518
1519 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1520 print '<input type="hidden" name="token" value="'.newToken().'">';
1521 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1522 print '<input type="hidden" name="type" value="'.$typeid.'">';
1523 print '<input type="hidden" name="id" value="'.$object->id.'">';
1524 print '<input type="hidden" name="action" value="list">';
1525
1526 print '<br>';
1527 $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
1528 $num = count($objects);
1529 $nbtotalofrecords = '';
1530 $newcardbutton = '';
1531
1532 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
1533 print_barre_liste($langs->trans("Orders"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bill', 0, $newcardbutton, '', $limit);
1534
1535 print "<table class='noborder centpercent'>\n";
1536 print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Ref").'</td></tr>'."\n";
1537
1538 if (count($objects) > 0) {
1539 $i = 0;
1540 foreach ($objects as $key => $order) {
1541 $i++;
1542 if ($i > $limit) {
1543 break;
1544 }
1545
1546 print "\t".'<tr class="oddeven">'."\n";
1547 print '<td class="nowrap tdtop">';
1548 print $order->getNomUrl(1);
1549 print "</td>\n";
1550 print '<td class="tdtop">'.$order->ref."</td>\n";
1551 // Link to delete from category
1552 print '<td class="right">';
1553 if ($permission) {
1554 print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&action=unlink&token=".newToken()."&removeelem=".$order->id."'>";
1555 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
1556 print "</a>";
1557 }
1558 print "</tr>\n";
1559 }
1560 } else {
1561 print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</td></tr>';
1562 }
1563 print "</table>\n";
1564
1565 print "</form>\n";
1566 }
1567}
1568
1569// List of Manufacturing Orders
1570if ($type == Categorie::TYPE_MO) {
1571 require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php';
1572
1573 $permission = $user->hasRight('mrp', 'write');
1574
1575 $objects = $object->getObjectsInCateg($type, 0, $limit, $offset);
1576 if ($objects < 0) {
1577 dol_print_error($db, $object->error, $object->errors);
1578 } else {
1580 '@phan-var-force Mo[] $objects';
1581 // Form to add record into a category
1582 $showclassifyform = $user->hasRight('mrp', 'write');
1583 if ($showclassifyform) {
1584 print '<br>';
1585 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1586 print '<input type="hidden" name="token" value="'.newToken().'">';
1587 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1588 print '<input type="hidden" name="type" value="'.$typeid.'">';
1589 print '<input type="hidden" name="id" value="'.$object->id.'">';
1590 print '<input type="hidden" name="action" value="addintocategory">';
1591 print '<table class="noborder centpercent">';
1592 print '<tr class="liste_titre"><td>';
1593 print $langs->trans("AddMoIntoCategory").' &nbsp;';
1594 print $form->selectForForms('Mo:mrp/class/mo.class.php', 'elemid', 0, 1, '', '', 'maxwidth500');
1595 print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
1596 print '</tr>';
1597 print '</table>';
1598 print '</form>';
1599 }
1600
1601 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1602 print '<input type="hidden" name="token" value="'.newToken().'">';
1603 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1604 print '<input type="hidden" name="type" value="'.$typeid.'">';
1605 print '<input type="hidden" name="id" value="'.$object->id.'">';
1606 print '<input type="hidden" name="action" value="list">';
1607
1608 print '<br>';
1609 $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
1610 $num = count($objects);
1611 $nbtotalofrecords = '';
1612 $newcardbutton = '';
1613
1614 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
1615 print_barre_liste($langs->trans("MOs"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'mrp', 0, $newcardbutton, '', $limit);
1616
1617 print "<table class='noborder centpercent'>\n";
1618 print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Ref").'</td></tr>'."\n";
1619
1620 if (count($objects) > 0) {
1621 $i = 0;
1622 foreach ($objects as $key => $mo) {
1623 $i++;
1624 if ($i > $limit) {
1625 break;
1626 }
1627
1628 print "\t".'<tr class="oddeven">'."\n";
1629 print '<td class="nowrap tdtop">';
1630 print $mo->getNomUrl(1);
1631 print "</td>\n";
1632 print '<td class="tdtop">'.$mo->ref."</td>\n";
1633 // Link to delete from category
1634 print '<td class="right">';
1635 if ($permission) {
1636 print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&action=unlink&token=".newToken()."&removeelem=".$mo->id."'>";
1637 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
1638 print "</a>";
1639 }
1640 print "</tr>\n";
1641 }
1642 } else {
1643 print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</td></tr>';
1644 }
1645 print "</table>\n";
1646
1647 print "</form>\n";
1648 }
1649}
1650
1651// List of Invoices
1652if ($type == Categorie::TYPE_INVOICE) {
1653 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
1654
1655 $permission = $user->hasRight('facture', 'creer');
1656
1657 $objects = $object->getObjectsInCateg($type, 0, $limit, $offset);
1658 if ($objects < 0) {
1659 dol_print_error($db, $object->error, $object->errors);
1660 } else {
1661 // Form to add record into a category
1662 $showclassifyform = $user->hasRight('facture', 'write');
1663 if ($showclassifyform) {
1664 print '<br>';
1665 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1666 print '<input type="hidden" name="token" value="'.newToken().'">';
1667 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1668 print '<input type="hidden" name="type" value="'.$typeid.'">';
1669 print '<input type="hidden" name="id" value="'.$object->id.'">';
1670 print '<input type="hidden" name="action" value="addintocategory">';
1671 print '<table class="noborder centpercent">';
1672 print '<tr class="liste_titre"><td>';
1673 print $langs->trans("AddInvoiceIntoCategory").' &nbsp;';
1674 print $form->selectForForms('Facture:compta/facture/class/facture.class.php', 'elemid', 0, 1, '', '', 'maxwidth500');
1675 print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
1676 print '</tr>';
1677 print '</table>';
1678 print '</form>';
1679 }
1680
1681 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1682 print '<input type="hidden" name="token" value="'.newToken().'">';
1683 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1684 print '<input type="hidden" name="type" value="'.$typeid.'">';
1685 print '<input type="hidden" name="id" value="'.$object->id.'">';
1686 print '<input type="hidden" name="action" value="list">';
1687
1688 print '<br>';
1689 $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
1690 $num = count($objects);
1691 $nbtotalofrecords = '';
1692 $newcardbutton = '';
1693
1694 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
1695 print_barre_liste($langs->trans("BillsCustomers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bill', 0, $newcardbutton, '', $limit);
1696
1697 print "<table class='noborder centpercent'>\n";
1698 print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Ref").'</td></tr>'."\n";
1699
1700 if (count($objects) > 0) {
1701 $i = 0;
1702 foreach ($objects as $key => $invoice) {
1703 $i++;
1704 if ($i > $limit) {
1705 break;
1706 }
1707
1708 print "\t".'<tr class="oddeven">'."\n";
1709 print '<td class="nowrap tdtop">';
1710 print $invoice->getNomUrl(1);
1711 print "</td>\n";
1712 print '<td class="tdtop">'.$invoice->ref."</td>\n";
1713 // Link to delete from category
1714 print '<td class="right">';
1715 if ($permission) {
1716 print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&action=unlink&token=".newToken()."&removeelem=".$invoice->id."'>";
1717 print $langs->trans("DeleteFromCat");
1718 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
1719 print "</a>";
1720 }
1721 print "</tr>\n";
1722 }
1723 } else {
1724 print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</td></tr>';
1725 }
1726 print "</table>\n";
1727
1728 print "</form>\n";
1729 }
1730}
1731
1732// List of Supplier Orders
1733if ($type == Categorie::TYPE_SUPPLIER_ORDER) {
1734 require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
1735
1736 $permission = $user->hasRight('fournisseur', 'commande', 'creer');
1737
1738 $objects = $object->getObjectsInCateg($type, 0, $limit, $offset);
1739 if ($objects < 0) {
1740 dol_print_error($db, $object->error, $object->errors);
1741 } else {
1742 // Form to add record into a category
1743 $showclassifyform = $user->hasRight('fournisseur', 'commande', 'creer');
1744 ;
1745 if ($showclassifyform) {
1746 print '<br>';
1747 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1748 print '<input type="hidden" name="token" value="'.newToken().'">';
1749 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1750 print '<input type="hidden" name="type" value="'.$typeid.'">';
1751 print '<input type="hidden" name="id" value="'.$object->id.'">';
1752 print '<input type="hidden" name="action" value="addintocategory">';
1753 print '<table class="noborder centpercent">';
1754 print '<tr class="liste_titre"><td>';
1755 print $langs->trans("AddSupplierOrderIntoCategory").' &nbsp;';
1756 print $form->selectForForms('CommandeFournisseur:fourn/class/fournisseur.commande.class.php', 'elemid', 0, 1, '', '', 'maxwidth500');
1757 print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
1758 print '</tr>';
1759 print '</table>';
1760 print '</form>';
1761 }
1762
1763 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1764 print '<input type="hidden" name="token" value="'.newToken().'">';
1765 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1766 print '<input type="hidden" name="type" value="'.$typeid.'">';
1767 print '<input type="hidden" name="id" value="'.$object->id.'">';
1768 print '<input type="hidden" name="action" value="list">';
1769
1770 print '<br>';
1771 $param = '&limit='.$limit.'&id='.$id.'&type='.$type;
1772 $num = count($objects);
1773 $nbtotalofrecords = '';
1774 $newcardbutton = '';
1775
1776 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
1777 print_barre_liste($langs->trans("SuppliersOrders"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'supplier_order', 0, $newcardbutton, '', $limit);
1778
1779 print "<table class='noborder centpercent'>\n";
1780 print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Ref").'</td></tr>'."\n";
1781
1782 if (count($objects) > 0) {
1783 $i = 0;
1784 foreach ($objects as $key => $supplier_order) {
1785 $i++;
1786 if ($i > $limit) {
1787 break;
1788 }
1789
1790 print "\t".'<tr class="oddeven">'."\n";
1791 print '<td class="nowrap tdtop">';
1792 print $supplier_order->getNomUrl(1);
1793 print "</td>\n";
1794 print '<td class="tdtop">'.$supplier_order->ref."</td>\n";
1795 // Link to delete from category
1796 print '<td class="right">';
1797 if ($permission) {
1798 print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&action=unlink&token=".newToken()."&removeelem=".$supplier_order->id."'>";
1799 print $langs->trans("DeleteFromCat");
1800 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
1801 print "</a>";
1802 }
1803 print "</tr>\n";
1804 }
1805 } else {
1806 print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</td></tr>';
1807 }
1808 print "</table>\n";
1809
1810 print "</form>\n";
1811 }
1812}
1813
1814// List of Supplier Invoices
1815if ($type == Categorie::TYPE_SUPPLIER_INVOICE) {
1816 require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
1817
1818 $permission = $user->hasRight('fournisseur', 'facture', 'creer');
1819
1820 $objects = $object->getObjectsInCateg($type, 0, $limit, $offset);
1821 if ($objects < 0) {
1822 dol_print_error($db, $object->error, $object->errors);
1823 } else {
1824 // Form to add record into a category
1825 $showclassifyform = $user->hasRight('fournisseur', 'facture', 'creer');;
1826 if ($showclassifyform) {
1827 print '<br>';
1828 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1829 print '<input type="hidden" name="token" value="'.newToken().'">';
1830 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1831 print '<input type="hidden" name="type" value="'.$typeid.'">';
1832 print '<input type="hidden" name="id" value="'.$object->id.'">';
1833 print '<input type="hidden" name="action" value="addintocategory">';
1834 print '<table class="noborder centpercent">';
1835 print '<tr class="liste_titre"><td>';
1836 print $langs->trans("AddSupplierInvoiceIntoCategory").' &nbsp;';
1837 print $form->selectForForms('FactureFournisseur:fourn/class/fournisseur.facture.class.php', 'elemid', 0, 1, '', '', 'maxwidth500');
1838 print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
1839 print '</tr>';
1840 print '</table>';
1841 print '</form>';
1842 }
1843
1844 print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
1845 print '<input type="hidden" name="token" value="'.newToken().'">';
1846 print '<input type="hidden" name="typeid" value="'.$typeid.'">';
1847 print '<input type="hidden" name="type" value="'.$typeid.'">';
1848 print '<input type="hidden" name="id" value="'.$object->id.'">';
1849 print '<input type="hidden" name="action" value="list">';
1850
1851 print '<br>';
1852 $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($objects); $nbtotalofrecords = ''; $newcardbutton = '';
1853
1854 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
1855 print_barre_liste($langs->trans("SuppliersOrders"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'supplier_order', 0, $newcardbutton, '', $limit);
1856
1857 print "<table class='noborder centpercent'>\n";
1858 print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Ref").'</td></tr>'."\n";
1859
1860 if (count($objects) > 0) {
1861 $i = 0;
1862 foreach ($objects as $key => $supplier_invoice) {
1863 $i++;
1864 if ($i > $limit) {
1865 break;
1866 }
1867
1868 print "\t".'<tr class="oddeven">'."\n";
1869 print '<td class="nowrap tdtop">';
1870 print $supplier_invoice->getNomUrl(1);
1871 print "</td>\n";
1872 print '<td class="tdtop">'.$supplier_invoice->ref."</td>\n";
1873 // Link to delete from category
1874 print '<td class="right">';
1875 if ($permission) {
1876 print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&action=unlink&token=".newToken()."&removeelem=".$supplier_invoice->id."'>";
1877 print $langs->trans("DeleteFromCat");
1878 print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
1879 print "</a>";
1880 }
1881 print "</tr>\n";
1882 }
1883 } else {
1884 print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</td></tr>';
1885 }
1886 print "</table>\n";
1887
1888 print "</form>\n";
1889 }
1890}
1891
1892// Note that $action and $object may have been modified by some hooks
1893$parameters = array('type' => $type, 'id' => $id, 'label' => $label);
1894$reshook = $hookmanager->executeHooks('addMoreCategoriesList', $parameters, $object, $action);
1895
1896// End of page
1897llxFooter();
1898$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:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolPrintHTML($s, $allowiframe=0, $moreallowedtags=array())
Return a string (that can be on several lines) ready to be output on a HTML page.
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.
dolBuildUrl($url, $params=[], $addtoken=false, $anchor='')
Return path of url.
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
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.
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.