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