dolibarr 21.0.3
list.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2024 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
6 * Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
7 * Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
29// Load Dolibarr environment
30require '../../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
32
41// Load translation files required by page
42$langs->loadLangs(array("users"));
43
44$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'create'/'add', 'edit'/'update', 'view', ...
45$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
46$show_files = GETPOSTINT('show_files'); // Show files area generated by bulk actions ?
47$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
48$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
49$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
50$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
51$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
52$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
53$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...)
54
55$search_all = trim(GETPOST('search_all', 'alphanohtml'));
56$search_group = GETPOST('search_group');
57$search = array();
58
59// Load variable for pagination
60$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
61$sortfield = GETPOST('sortfield', 'aZ09comma');
62$sortorder = GETPOST('sortorder', 'aZ09comma');
63$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page');
64if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
65 // If $page is not defined, or '' or -1 or if we click on clear filters
66 $page = 0;
67}
68$offset = $limit * $page;
69$pageprev = $page - 1;
70$pagenext = $page + 1;
71
72// Initialize a technical objects
73$object = new UserGroup($db);
74$extrafields = new ExtraFields($db);
75//$diroutputmassaction = $conf->mymodule->dir_output.'/temp/massgeneration/'.$user->id;
76$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes
77
78// Fetch optionals attributes and labels
79$extrafields->fetch_name_optionals_label($object->table_element);
80//$extrafields->fetch_name_optionals_label($object->table_element_line);
81
82$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
83
84if (!$sortfield) {
85 $sortfield = "g.nom";
86}
87if (!$sortorder) {
88 $sortorder = "ASC";
89}
90
91$arrayfields = array();
92
93// List of fields to search into when doing a "search in all"
94$fieldstosearchall = array();
95foreach ($object->fields as $key => $val) {
96 if (!empty($val['searchall'])) {
97 $fieldstosearchall['t.'.$key] = $val['label'];
98 }
99}
100
101if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
102 if (!$user->hasRight("user", "group_advance", "read") && !$user->admin) {
104 }
105}
106
107if (!$user->hasRight("user", "user", "read") && !$user->admin) {
109}
110
111// Defini si peux lire/modifier utilisateurs et permissions
112$caneditperms = (isModEnabled('multicompany') && !empty($user->entity) && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') ? false : (!empty($user->admin) || $user->hasRight("user", "user", "write")));
113$permissiontodelete = $caneditperms;
114// Advanced permissions
115if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
116 $caneditperms = (isModEnabled('multicompany') && !empty($user->entity) && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') ? false : ($user->admin || $user->hasRight("user", "group_advance", "write")));
117}
118
119
120/*
121 * Actions
122 */
123
124if (GETPOST('cancel', 'alpha')) {
125 $action = 'list';
126 $massaction = '';
127}
128if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
129 $massaction = '';
130}
131
132$parameters = array('arrayfields' => &$arrayfields);
133$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
134if ($reshook < 0) {
135 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
136}
137
138if (empty($reshook)) {
139 // Selection of new fields
140 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
141
142 // Purge search criteria
143 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
144 foreach ($object->fields as $key => $val) {
145 $search[$key] = '';
146 if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
147 $search[$key.'_dtstart'] = '';
148 $search[$key.'_dtend'] = '';
149 }
150 }
151 $search_all = '';
152 $toselect = array();
153 $search_array_options = array();
154 }
155 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
156 || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
157 $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
158 }
159
160 // Mass actions
161 $objectclass = 'UserGroup';
162 $objectlabel = 'UserGroup';
163 $uploaddir = $conf->user->dir_output;
164 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
165}
166
167
168/*
169 * View
170 */
171
172$form = new Form($db);
173
174$now = dol_now();
175
176$title = $langs->trans("UserGroups");
177$help_url = '';
178$morejs = array();
179$morecss = array();
180
181// Build and execute select
182// --------------------------------------------------------------------
183$sql = "SELECT g.rowid, g.nom as name, g.note, g.entity, g.datec, g.tms, COUNT(DISTINCT ugu.fk_user) as nb, COUNT(DISTINCT ugr.fk_id) as nbpermissions";
184
185$sqlfields = $sql;
186
187$sql .= " FROM ".MAIN_DB_PREFIX."usergroup as g";
188$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_usergroup = g.rowid";
189$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_rights as ugr ON ugr.fk_usergroup = g.rowid";
190if (isModEnabled('multicompany') && $conf->entity == 1 && (getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') || ($user->admin && !$user->entity))) {
191 $sql .= " WHERE g.entity IS NOT NULL";
192} else {
193 $sql .= " WHERE g.entity IN (0,".$conf->entity.")";
194}
195if (!empty($search_group)) {
196 natural_search(array("g.nom", "g.note"), $search_group);
197}
198if ($search_all) {
199 $sql .= natural_search(array("g.nom", "g.note"), $search_all);
200}
201$sql .= " GROUP BY g.rowid, g.nom, g.note, g.entity, g.datec, g.tms";
202
203// Count total nb of records
204$nbtotalofrecords = '';
205if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
206 /* The fast and low memory method to get and count full list converts the sql into a sql count */
207 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(DISTINCT g.rowid) as nbtotalofrecords', $sql);
208 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
209 $resql = $db->query($sqlforcount);
210 if ($resql) {
211 $objforcount = $db->fetch_object($resql);
212 $nbtotalofrecords = $objforcount->nbtotalofrecords;
213 } else {
214 dol_print_error($db);
215 }
216
217 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than paging size (filtering), goto and load page 0
218 $page = 0;
219 $offset = 0;
220 }
221 $db->free($resql);
222}
223
224// Complete request and execute it with limit
225$sql .= $db->order($sortfield, $sortorder);
226if ($limit) {
227 $sql .= $db->plimit($limit + 1, $offset);
228}
229$resql = $db->query($sql);
230if (!$resql) {
231 dol_print_error($db);
232 exit;
233}
234
235$num = $db->num_rows($resql);
236
237$i = 0;
238
239
240// Output page
241// --------------------------------------------------------------------
242
243llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist mod-user page-group_list');
244
245$arrayofselected = is_array($toselect) ? $toselect : array();
246
247$param = "&search_group=".urlencode($search_group)."&search_all=".urlencode($search_all);
248if (!empty($mode)) {
249 $param .= '&mode='.urlencode($mode);
250}
251if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
252 $param .= '&contextpage='.urlencode($contextpage);
253}
254if ($limit > 0 && $limit != $conf->liste_limit) {
255 $param .= '&limit='.((int) $limit);
256}
257if ($optioncss != '') {
258 $param .= '&optioncss='.urlencode($optioncss);
259}
260
261foreach ($search as $key => $val) {
262 if (is_array($search[$key])) {
263 foreach ($search[$key] as $skey) {
264 if ($skey != '') {
265 $param .= '&search_'.$key.'[]='.urlencode($skey);
266 }
267 }
268 } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
269 $param .= '&search_'.$key.'month='.GETPOSTINT('search_'.$key.'month');
270 $param .= '&search_'.$key.'day='.GETPOSTINT('search_'.$key.'day');
271 $param .= '&search_'.$key.'year='.GETPOSTINT('search_'.$key.'year');
272 } elseif ($search[$key] != '') {
273 $param .= '&search_'.$key.'='.urlencode($search[$key]);
274 }
275}
276// Add $param from extra fields
277include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
278// Add $param from hooks
279$parameters = array('param' => &$param);
280$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
281$param .= $hookmanager->resPrint;
282
283// List of mass actions available
284$arrayofmassactions = array(
285 //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
286 //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
287 //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
288 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
289);
290if (!empty($permissiontodelete)) {
291 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
292}
293if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete'))) {
294 $arrayofmassactions = array();
295}
296$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
297
298print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
299if ($optioncss != '') {
300 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
301}
302print '<input type="hidden" name="token" value="'.newToken().'">';
303print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
304print '<input type="hidden" name="action" value="list">';
305print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
306print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
307print '<input type="hidden" name="page" value="'.$page.'">';
308print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
309print '<input type="hidden" name="page_y" value="">';
310print '<input type="hidden" name="mode" value="'.$mode.'">';
311
312$newcardbutton = '';
313$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition'));
314$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition'));
315
316if ($caneditperms) {
317 $newcardbutton .= dolGetButtonTitleSeparator();
318 $newcardbutton .= dolGetButtonTitle($langs->trans('NewGroup'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/user/group/card.php?action=create&leftmenu=', '', $caneditperms ? 1 : 0);
319}
320
321print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
322
323// Add code for pre mass action (confirmation or email presend form)
324$topicmail = "SendGroup";
325$modelmail = "group";
326$objecttmp = new UserGroup($db);
327$trackid = 'grp'.$object->id;
328include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
329
330if ($search_all) {
331 $setupstring = '';
332 // @phan-suppress-next-line PhanEmptyForeach
333 foreach ($fieldstosearchall as $key => $val) {
334 $fieldstosearchall[$key] = $langs->trans($val);
335 $setupstring .= $key."=".$val.";";
336 }
337 print '<!-- Search done like if GROUP_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
338 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>'."\n";
339}
340
341$moreforfilter = '';
342
343$parameters = array();
344$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
345if (empty($reshook)) {
346 $moreforfilter .= $hookmanager->resPrint;
347} else {
348 $moreforfilter = $hookmanager->resPrint;
349}
350
351if (!empty($moreforfilter)) {
352 print '<div class="liste_titre liste_titre_bydiv centpercent">';
353 print $moreforfilter;
354 print '</div>';
355}
356
357$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
358$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column); // This also change content of $arrayfields with user setup
359$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
360$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
361
362print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
363print '<table class="tagtable nobottomiftotal noborder liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
364
365
366$totalarray = array();
367$totalarray['nbfield'] = 0;
368
369// Fields title label
370// --------------------------------------------------------------------
371print '<tr class="liste_titre_filter">';
372// Action column
373if ($conf->main_checkbox_left_column) {
374 print '<td class="liste_titre center maxwidthsearch">';
375 $searchpicto = $form->showFilterButtons('left');
376 print $searchpicto;
377 print '</td>';
378}
379print_liste_field_titre("Group", $_SERVER["PHP_SELF"], "g.nom", $param, "", "", $sortfield, $sortorder);
380$totalarray['nbfield']++;
381//multicompany
382if (isModEnabled('multicompany') && !getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) {
383 print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], "g.entity", $param, "", '', $sortfield, $sortorder, 'center ');
384 $totalarray['nbfield']++;
385}
386print_liste_field_titre("NbOfUsers", $_SERVER["PHP_SELF"], "nb", $param, "", '', $sortfield, $sortorder, 'center ');
387$totalarray['nbfield']++;
388print_liste_field_titre("NbOfPermissions", $_SERVER["PHP_SELF"], "nbpermissions", $param, "", '', $sortfield, $sortorder, 'center ');
389$totalarray['nbfield']++;
390print_liste_field_titre("DateCreationShort", $_SERVER["PHP_SELF"], "g.datec", $param, "", '', $sortfield, $sortorder, 'center ');
391$totalarray['nbfield']++;
392print_liste_field_titre("DateLastModification", $_SERVER["PHP_SELF"], "g.tms", $param, "", '', $sortfield, $sortorder, 'center ');
393$totalarray['nbfield']++;
394// Extra fields
395include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
396// Hook fields
397$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
398$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
399print $hookmanager->resPrint;
400/*if (!empty($arrayfields['anotherfield']['checked'])) {
401 print '<th class="liste_titre right">'.$langs->trans("AnotherField").'</th>';
402 $totalarray['nbfield']++;
403 }*/
404// Action column
405if (!$conf->main_checkbox_left_column) {
406 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
407 $totalarray['nbfield']++;
408}
409print '</tr>'."\n";
410
411
412// Loop on record
413// --------------------------------------------------------------------
414$i = 0;
415$savnbfield = $totalarray['nbfield'];
416$totalarray = array();
417$totalarray['nbfield'] = 0;
418$imaxinloop = ($limit ? min($num, $limit) : $num);
419while ($i < $imaxinloop) {
420 $obj = $db->fetch_object($resql);
421 if (empty($obj)) {
422 break; // Should not happen
423 }
424
425 // Store properties in $object
426 $object->setVarsFromFetchObj($obj);
427
428 $object->name = $obj->name;
429 $object->note = $obj->note;
430 $object->nb_rights = $obj->nbpermissions;
431 $object->nb_users = $obj->nb;
432
433 if ($mode == 'kanban') {
434 if ($i == 0) {
435 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
436 print '<div class="box-flex-container kanban">';
437 }
438 // Output Kanban
439 $selected = -1;
440 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
441 $selected = 0;
442 if (in_array($object->id, $arrayofselected)) {
443 $selected = 1;
444 }
445 }
446 print $object->getKanbanView('', array('selected' => $selected));
447 if ($i == ($imaxinloop - 1)) {
448 print '</div>';
449 print '</td></tr>';
450 }
451 } else {
452 // Show line of result
453 $j = 0;
454 print '<tr data-rowid="'.$object->id.'" class="oddeven">';
455 // Action column
456 if ($conf->main_checkbox_left_column) {
457 print '<td class="nowrap center">';
458 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
459 $selected = 0;
460 if (in_array($object->id, $arrayofselected)) {
461 $selected = 1;
462 }
463 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
464 }
465 print '</td>';
466 if (!$i) {
467 $totalarray['nbfield']++;
468 }
469 }
470
471 print '<td class="tdoverflowmax125">';
472 print $object->getNomUrl(1);
473 if (isModEnabled('multicompany') && !$obj->entity) {
474 print img_picto($langs->trans("GlobalGroup"), 'redstar');
475 }
476 print "</td>";
477 if (!$i) {
478 $totalarray['nbfield']++;
479 }
480 //multicompany
481 if (isModEnabled('multicompany') && is_object($mc) && !getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) {
482 $mc->getInfo($obj->entity);
483 print '<td class="center">'.dol_escape_htmltag($mc->label).'</td>';
484 if (!$i) {
485 $totalarray['nbfield']++;
486 }
487 }
488 print '<td class="center">'.dol_escape_htmltag($obj->nb).'</td>';
489 if (!$i) {
490 $totalarray['nbfield']++;
491 }
492 print '<td class="center">';
493 print '<a href="'.DOL_URL_ROOT.'/user/group/perms.php?id='.$obj->rowid.'">'.dol_escape_htmltag($obj->nbpermissions).'</a>';
494 print '</td>';
495 if (!$i) {
496 $totalarray['nbfield']++;
497 }
498 print '<td class="center nowrap">'.dol_print_date($db->jdate($obj->datec), "dayhour").'</td>';
499 if (!$i) {
500 $totalarray['nbfield']++;
501 }
502 print '<td class="center nowrap">'.dol_print_date($db->jdate($obj->tms), "dayhour").'</td>';
503 if (!$i) {
504 $totalarray['nbfield']++;
505 }
506 // Extra fields
507 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
508 // Fields from hook
509 $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
510 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
511 print $hookmanager->resPrint;
512 // Action column
513 if (empty($conf->main_checkbox_left_column)) {
514 print '<td class="nowrap center">';
515 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
516 $selected = 0;
517 if (in_array($object->id, $arrayofselected)) {
518 $selected = 1;
519 }
520 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
521 }
522 print '</td>';
523 if (!$i) {
524 $totalarray['nbfield']++;
525 }
526 }
527
528 print '</tr>'."\n";
529 }
530 $i++;
531}
532
533// Show total line
534include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
535
536// If no record found
537if ($num == 0) {
538 /*$colspan = 1;
539 foreach ($arrayfields as $key => $val) {
540 if (!empty($val['checked'])) {
541 $colspan++;
542 }
543 }*/
544 $colspan = $savnbfield;
545 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
546}
547
548$db->free($resql);
549
550$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
551$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
552print $hookmanager->resPrint;
553
554print '</table>'."\n";
555print '</div>'."\n";
556
557print '</form>'."\n";
558
559// End of page
560llxFooter();
561$db->close();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:66
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:87
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:71
Class to manage standard extra fields.
Class to manage generation of HTML components Only common components must be here.
Class to manage user groups.
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)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.