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