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