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