dolibarr  19.0.0-dev
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-2018 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
29 require '../../main.inc.php';
30 require_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 = GETPOST('show_files', 'int'); // 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 = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
52 $sortfield = GETPOST('sortfield', 'aZ09comma');
53 $sortorder = GETPOST('sortorder', 'aZ09comma');
54 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
55 if (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 
75 if (!$sortfield) {
76  $sortfield = "g.nom";
77 }
78 if (!$sortorder) {
79  $sortorder = "ASC";
80 }
81 
82 // List of fields to search into when doing a "search in all"
83 $fieldstosearchall = array();
84 foreach ($object->fields as $key => $val) {
85  if (!empty($val['searchall'])) {
86  $fieldstosearchall['t.'.$key] = $val['label'];
87  }
88 }
89 
90 if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
91  if (!$user->hasRight("user", "group_advance", "read") && !$user->admin) {
93  }
94 }
95 
96 // Users/Groups management only in master entity if transverse mode
97 if (isModEnabled('multicompany') && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE) {
99 }
100 
101 if (!$user->hasRight("user", "user", "read") && !$user->admin) {
102  accessforbidden();
103 }
104 
105 // Defini si peux lire/modifier utilisateurs et permisssions
106 $caneditperms = ($user->admin || $user->hasRight("user", "user", "write"));
107 $permissiontodelete = ($user->admin || $user->hasRight("user", "user", "write"));
108 // Advanced permissions
109 if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
110  $caneditperms = ($user->admin || $user->hasRight("user", "group_advance", "write"));
111 }
112 
113 
114 /*
115  * Actions
116  */
117 
118 if (GETPOST('cancel', 'alpha')) {
119  $action = 'list';
120  $massaction = '';
121 }
122 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
123  $massaction = '';
124 }
125 
126 $parameters = array();
127 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
128 if ($reshook < 0) {
129  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
130 }
131 
132 if (empty($reshook)) {
133  // Selection of new fields
134  include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
135 
136  // Purge search criteria
137  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
138  foreach ($object->fields as $key => $val) {
139  $search[$key] = '';
140  if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
141  $search[$key.'_dtstart'] = '';
142  $search[$key.'_dtend'] = '';
143  }
144  }
145  $toselect = array();
146  $search_array_options = array();
147  }
148  if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
149  || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
150  $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
151  }
152 
153  // Mass actions
154  $objectclass = 'UserGroup';
155  $objectlabel = 'UserGroup';
156  $uploaddir = $conf->user->dir_output;
157  include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
158 }
159 
160 
161 /*
162  * View
163  */
164 
165 $form = new Form($db);
166 
167 $now = dol_now();
168 
169 $title = $langs->trans("UserGroups");
170 $help_url = '';
171 $morejs = array();
172 $morecss = array();
173 
174 // Build and execute select
175 // --------------------------------------------------------------------
176 $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";
177 $sql .= " FROM ".MAIN_DB_PREFIX."usergroup as g";
178 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_usergroup = g.rowid";
179 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_rights as ugr ON ugr.fk_usergroup = g.rowid";
180 if (isModEnabled('multicompany') && $conf->entity == 1 && (getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') || ($user->admin && !$user->entity))) {
181  $sql .= " WHERE g.entity IS NOT NULL";
182 } else {
183  $sql .= " WHERE g.entity IN (0,".$conf->entity.")";
184 }
185 if (!empty($search_group)) {
186  natural_search(array("g.nom", "g.note"), $search_group);
187 }
188 if ($search_all) {
189  $sql .= natural_search(array("g.nom", "g.note"), $search_all);
190 }
191 $sql .= " GROUP BY g.rowid, g.nom, g.note, g.entity, g.datec, g.tms";
192 
193 // Complete request and execute it with limit
194 $sql .= $db->order($sortfield, $sortorder);
195 if ($limit) {
196  $sql .= $db->plimit($limit + 1, $offset);
197 }
198 
199 $resql = $db->query($sql);
200 if (!$resql) {
201  dol_print_error($db);
202  exit;
203 }
204 
205 $num = $db->num_rows($resql);
206 
207 
208 $nbtotalofrecords = $num;
209 
210 $i = 0;
211 
212 
213 // Output page
214 // --------------------------------------------------------------------
215 
216 llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist');
217 
218 $arrayofselected = is_array($toselect) ? $toselect : array();
219 
220 $param = "&search_group=".urlencode($search_group)."&search_all=".urlencode($search_all);
221 if (!empty($mode)) {
222  $param .= '&mode='.urlencode($mode);
223 }
224 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
225  $param .= '&contextpage='.urlencode($contextpage);
226 }
227 if ($limit > 0 && $limit != $conf->liste_limit) {
228  $param .= '&limit='.((int) $limit);
229 }
230 foreach ($search as $key => $val) {
231  if (is_array($search[$key])) {
232  foreach ($search[$key] as $skey) {
233  if ($skey != '') {
234  $param .= '&search_'.$key.'[]='.urlencode($skey);
235  }
236  }
237  } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
238  $param .= '&search_'.$key.'month='.((int) GETPOST('search_'.$key.'month', 'int'));
239  $param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int'));
240  $param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int'));
241  } elseif ($search[$key] != '') {
242  $param .= '&search_'.$key.'='.urlencode($search[$key]);
243  }
244 }
245 if ($optioncss != '') {
246  $param .= '&optioncss='.urlencode($optioncss);
247 }
248 // Add $param from extra fields
249 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
250 // Add $param from hooks
251 $parameters = array();
252 $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
253 $param .= $hookmanager->resPrint;
254 
255 // List of mass actions available
256 $arrayofmassactions = array(
257  //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
258  //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
259  //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
260  //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
261 );
262 if (!empty($permissiontodelete)) {
263  $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
264 }
265 if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
266  $arrayofmassactions = array();
267 }
268 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
269 
270 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
271 if ($optioncss != '') {
272  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
273 }
274 print '<input type="hidden" name="token" value="'.newToken().'">';
275 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
276 print '<input type="hidden" name="action" value="list">';
277 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
278 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
279 print '<input type="hidden" name="page" value="'.$page.'">';
280 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
281 print '<input type="hidden" name="page_y" value="">';
282 print '<input type="hidden" name="mode" value="'.$mode.'">';
283 
284 $newcardbutton = '';
285 $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'));
286 $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'));
287 
288 if ($caneditperms) {
289  $newcardbutton .= dolGetButtonTitleSeparator();
290  $newcardbutton .= dolGetButtonTitle($langs->trans('NewGroup'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/user/group/card.php?action=create&leftmenu=');
291 }
292 
293 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
294 
295 // Add code for pre mass action (confirmation or email presend form)
296 $topicmail = "SendGroup";
297 $modelmail = "group";
298 $objecttmp = new UserGroup($db);
299 $trackid = 'grp'.$object->id;
300 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
301 
302 if ($search_all) {
303  $setupstring = '';
304  foreach ($fieldstosearchall as $key => $val) {
305  $fieldstosearchall[$key] = $langs->trans($val);
306  $setupstring .= $key."=".$val.";";
307  }
308  print '<!-- Search done like if GROUP_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
309  print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
310 }
311 
312 $moreforfilter = '';
313 
314 $parameters = array();
315 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
316 if (empty($reshook)) {
317  $moreforfilter .= $hookmanager->resPrint;
318 } else {
319  $moreforfilter = $hookmanager->resPrint;
320 }
321 
322 if (!empty($moreforfilter)) {
323  print '<div class="liste_titre liste_titre_bydiv centpercent">';
324  print $moreforfilter;
325  $parameters = array();
326  $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
327  print $hookmanager->resPrint;
328  print '</div>';
329 }
330 
331 $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
332 $selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields
333 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
334 
335 print '<div class="div-table-responsive">';
336 print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
337 
338 // Fields title search
339 // --------------------------------------------------------------------
340 // ...
341 
342 $totalarray = array();
343 $totalarray['nbfield'] = 0;
344 
345 // Fields title label
346 // --------------------------------------------------------------------
347 print '<tr class="liste_titre">';
348 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
349  print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
350  $totalarray['nbfield']++;
351 }
352 print_liste_field_titre("Group", $_SERVER["PHP_SELF"], "g.nom", $param, "", "", $sortfield, $sortorder);
353 $totalarray['nbfield']++;
354 //multicompany
355 if (isModEnabled('multicompany') && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1) {
356  print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], "g.entity", $param, "", '', $sortfield, $sortorder, 'center ');
357  $totalarray['nbfield']++;
358 }
359 print_liste_field_titre("NbOfUsers", $_SERVER["PHP_SELF"], "nb", $param, "", '', $sortfield, $sortorder, 'center ');
360 $totalarray['nbfield']++;
361 print_liste_field_titre("NbOfPermissions", $_SERVER["PHP_SELF"], "nbpermissions", $param, "", '', $sortfield, $sortorder, 'center ');
362 $totalarray['nbfield']++;
363 print_liste_field_titre("DateCreationShort", $_SERVER["PHP_SELF"], "g.datec", $param, "", '', $sortfield, $sortorder, 'center ');
364 $totalarray['nbfield']++;
365 print_liste_field_titre("DateLastModification", $_SERVER["PHP_SELF"], "g.tms", $param, "", '', $sortfield, $sortorder, 'center ');
366 $totalarray['nbfield']++;
367 // Extra fields
368 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
369 // Hook fields
370 $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
371 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
372 print $hookmanager->resPrint;
373 /*if (!empty($arrayfields['anotherfield']['checked'])) {
374  print '<th class="liste_titre right">'.$langs->trans("AnotherField").'</th>';
375  $totalarray['nbfield']++;
376  }*/
377 // Action column
378 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
379  print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
380  $totalarray['nbfield']++;
381 }
382 print '</tr>'."\n";
383 
384 
385 // Loop on record
386 // --------------------------------------------------------------------
387 $i = 0;
388 $savnbfield = $totalarray['nbfield'];
389 $totalarray = array();
390 $totalarray['nbfield'] = 0;
391 $imaxinloop = ($limit ? min($num, $limit) : $num);
392 while ($i < $imaxinloop) {
393  $obj = $db->fetch_object($resql);
394  if (empty($obj)) {
395  break; // Should not happen
396  }
397 
398  // Store properties in $object
399  $object->setVarsFromFetchObj($obj);
400 
401  $object->name = $obj->name;
402  $object->note = $obj->note;
403  $object->nb_rights = $obj->nbpermissions;
404  $object->nb_users = $obj->nb;
405 
406  if ($mode == 'kanban') {
407  if ($i == 0) {
408  print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
409  print '<div class="box-flex-container kanban">';
410  }
411  // Output Kanban
412  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
413  $selected = 0;
414  if (in_array($object->id, $arrayofselected)) {
415  $selected = 1;
416  }
417  }
418  print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
419  if ($i == ($imaxinloop - 1)) {
420  print '</div>';
421  print '</td></tr>';
422  }
423  } else {
424  // Show here line of result
425  $j = 0;
426  print '<tr data-rowid="'.$object->id.'" class="oddeven">';
427  // Action column
428  if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
429  print '<td class="nowrap center">';
430  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
431  $selected = 0;
432  if (in_array($object->id, $arrayofselected)) {
433  $selected = 1;
434  }
435  print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
436  }
437  print '</td>';
438  if (!$i) {
439  $totalarray['nbfield']++;
440  }
441  }
442 
443  print '<td>';
444  print $object->getNomUrl(1);
445  if (isModEnabled('multicompany') && !$obj->entity) {
446  print img_picto($langs->trans("GlobalGroup"), 'redstar');
447  }
448  print "</td>";
449  if (!$i) {
450  $totalarray['nbfield']++;
451  }
452  //multicompany
453  if (isModEnabled('multicompany') && is_object($mc) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1) {
454  $mc->getInfo($obj->entity);
455  print '<td class="center">'.dol_escape_htmltag($mc->label).'</td>';
456  if (!$i) {
457  $totalarray['nbfield']++;
458  }
459  }
460  print '<td class="center">'.$obj->nb.'</td>';
461  if (!$i) {
462  $totalarray['nbfield']++;
463  }
464  print '<td class="center">';
465  print '<a href="'.DOL_URL_ROOT.'/user/group/perms.php?id='.$obj->rowid.'">'.$obj->nbpermissions.'</a>';
466  print '</td>';
467  if (!$i) {
468  $totalarray['nbfield']++;
469  }
470  print '<td class="center nowrap">'.dol_print_date($db->jdate($obj->datec), "dayhour").'</td>';
471  if (!$i) {
472  $totalarray['nbfield']++;
473  }
474  print '<td class="center nowrap">'.dol_print_date($db->jdate($obj->tms), "dayhour").'</td>';
475  if (!$i) {
476  $totalarray['nbfield']++;
477  }
478  // Extra fields
479  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
480  // Fields from hook
481  $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
482  $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
483  print $hookmanager->resPrint;
484  // Action column
485  if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
486  print '<td class="nowrap center">';
487  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
488  $selected = 0;
489  if (in_array($object->id, $arrayofselected)) {
490  $selected = 1;
491  }
492  print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
493  }
494  print '</td>';
495  if (!$i) {
496  $totalarray['nbfield']++;
497  }
498  }
499 
500  print '</tr>'."\n";
501  }
502  $i++;
503 }
504 
505 // Show total line
506 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
507 
508 // If no record found
509 if ($num == 0) {
510  /*$colspan = 1;
511  foreach ($arrayfields as $key => $val) {
512  if (!empty($val['checked'])) {
513  $colspan++;
514  }
515  }*/
516  $colspan = 1;
517  foreach ($arrayfields as $key => $val) {
518  if (!empty($val['checked'])) {
519  $colspan++;
520  }
521  }
522  print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
523 }
524 
525 $db->free($resql);
526 
527 print '</table>'."\n";
528 print '</div>'."\n";
529 
530 print '</form>'."\n";
531 
532 // End of page
533 llxFooter();
534 $db->close();
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
Definition: agenda.php:118
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
llxFooter()
Empty footer.
Definition: wrapper.php:70
Class to manage standard extra fields.
Class to manage generation of HTML components Only common components must be here.
Class to manage user groups.
if(isModEnabled('facture') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
Social contributions to pay.
Definition: index.php:746
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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 dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.