dolibarr  x.y.z
myobject_list.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) ---Put here your own copyright and developer email---
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17  */
18 
25 //if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
26 //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
27 //if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
28 //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
29 //if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
30 //if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
31 //if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
32 //if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
33 //if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
34 //if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
35 //if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
36 //if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
37 //if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
38 //if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
39 //if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
40 //if (! defined("MAIN_SECURITY_FORCECSP")) define('MAIN_SECURITY_FORCECSP', 'none'); // Disable all Content Security Policies
41 //if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
42 //if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
43 //if (! defined('NOSESSION')) define('NOSESSION', '1'); // On CLI mode, no need to use web sessions
44 
45 // Load Dolibarr environment
46 $res = 0;
47 // Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
48 if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
49  $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
50 }
51 // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
52 $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
53 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
54  $i--;
55  $j--;
56 }
57 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
58  $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
59 }
60 if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
61  $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
62 }
63 // Try main.inc.php using relative path
64 if (!$res && file_exists("../main.inc.php")) {
65  $res = @include "../main.inc.php";
66 }
67 if (!$res && file_exists("../../main.inc.php")) {
68  $res = @include "../../main.inc.php";
69 }
70 if (!$res && file_exists("../../../main.inc.php")) {
71  $res = @include "../../../main.inc.php";
72 }
73 if (!$res) {
74  die("Include of main fails");
75 }
76 
77 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
78 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
79 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
80 
81 // load mymodule libraries
82 require_once __DIR__.'/class/myobject.class.php';
83 
84 // for other modules
85 //dol_include_once('/othermodule/class/otherobject.class.php');
86 
87 // Load translation files required by the page
88 $langs->loadLangs(array("mymodule@mymodule", "other"));
89 
90 $action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
91 $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
92 $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
93 $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
94 $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
95 $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
96 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
97 $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
98 $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
99 $mode = GETPOST('mode', 'aZ');
100 
101 $id = GETPOST('id', 'int');
102 $ref = GETPOST('ref', 'alpha');
103 
104 // Load variable for pagination
105 $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
106 $sortfield = GETPOST('sortfield', 'aZ09comma');
107 $sortorder = GETPOST('sortorder', 'aZ09comma');
108 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
109 if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
110  // If $page is not defined, or '' or -1 or if we click on clear filters
111  $page = 0;
112 }
113 $offset = $limit * $page;
114 $pageprev = $page - 1;
115 $pagenext = $page + 1;
116 
117 // Initialize technical objects
118 $object = new MyObject($db);
119 $extrafields = new ExtraFields($db);
120 $diroutputmassaction = $conf->mymodule->dir_output.'/temp/massgeneration/'.$user->id;
121 $hookmanager->initHooks(array('myobjectlist')); // Note that conf->hooks_modules contains array
122 
123 // Fetch optionals attributes and labels
124 $extrafields->fetch_name_optionals_label($object->table_element);
125 //$extrafields->fetch_name_optionals_label($object->table_element_line);
126 
127 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
128 
129 // Default sort order (if not yet defined by previous GETPOST)
130 if (!$sortfield) {
131  reset($object->fields); // Reset is required to avoid key() to return null.
132  $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
133 }
134 if (!$sortorder) {
135  $sortorder = "ASC";
136 }
137 
138 // Initialize array of search criterias
139 $search_all = GETPOST('search_all', 'alphanohtml') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml');
140 $search = array();
141 foreach ($object->fields as $key => $val) {
142  if (GETPOST('search_'.$key, 'alpha') !== '') {
143  $search[$key] = GETPOST('search_'.$key, 'alpha');
144  }
145  if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
146  $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
147  $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
148  }
149 }
150 
151 // List of fields to search into when doing a "search in all"
152 $fieldstosearchall = array();
153 foreach ($object->fields as $key => $val) {
154  if (!empty($val['searchall'])) {
155  $fieldstosearchall['t.'.$key] = $val['label'];
156  }
157 }
158 
159 // Definition of array of fields for columns
160 $arrayfields = array();
161 foreach ($object->fields as $key => $val) {
162  // If $val['visible']==0, then we never show the field
163  if (!empty($val['visible'])) {
164  $visible = (int) dol_eval($val['visible'], 1);
165  $arrayfields['t.'.$key] = array(
166  'label'=>$val['label'],
167  'checked'=>(($visible < 0) ? 0 : 1),
168  'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
169  'position'=>$val['position'],
170  'help'=> isset($val['help']) ? $val['help'] : ''
171  );
172  }
173 }
174 // Extra fields
175 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
176 
177 $object->fields = dol_sort_array($object->fields, 'position');
178 //$arrayfields['anotherfield'] = array('type'=>'integer', 'label'=>'AnotherField', 'checked'=>1, 'enabled'=>1, 'position'=>90, 'csslist'=>'right');
179 $arrayfields = dol_sort_array($arrayfields, 'position');
180 
181 // There is several ways to check permission.
182 // Set $enablepermissioncheck to 1 to enable a minimum low level of checks
183 $enablepermissioncheck = 0;
184 if ($enablepermissioncheck) {
185  $permissiontoread = $user->rights->mymodule->myobject->read;
186  $permissiontoadd = $user->rights->mymodule->myobject->write;
187  $permissiontodelete = $user->rights->mymodule->myobject->delete;
188 } else {
189  $permissiontoread = 1;
190  $permissiontoadd = 1;
191  $permissiontodelete = 1;
192 }
193 
194 // Security check (enable the most restrictive one)
195 if ($user->socid > 0) accessforbidden();
196 //if ($user->socid > 0) accessforbidden();
197 //$socid = 0; if ($user->socid > 0) $socid = $user->socid;
198 //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
199 //restrictedArea($user, $object->module, 0, $object->table_element, $object->element, 'fk_soc', 'rowid', $isdraft);
200 if (!isModEnabled("mymodule")) {
201  accessforbidden('Module mymodule not enabled');
202 }
203 if (!$permissiontoread) accessforbidden();
204 
205 
206 /*
207  * Actions
208  */
209 
210 if (GETPOST('cancel', 'alpha')) {
211  $action = 'list';
212  $massaction = '';
213 }
214 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
215  $massaction = '';
216 }
217 
218 $parameters = array();
219 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
220 if ($reshook < 0) {
221  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
222 }
223 
224 if (empty($reshook)) {
225  // Selection of new fields
226  include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
227 
228  // Purge search criteria
229  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
230  foreach ($object->fields as $key => $val) {
231  $search[$key] = '';
232  if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
233  $search[$key.'_dtstart'] = '';
234  $search[$key.'_dtend'] = '';
235  }
236  }
237  $toselect = array();
238  $search_array_options = array();
239  }
240  if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
241  || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
242  $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
243  }
244 
245  // Mass actions
246  $objectclass = 'MyObject';
247  $objectlabel = 'MyObject';
248  $uploaddir = $conf->mymodule->dir_output;
249  include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
250 }
251 
252 
253 
254 /*
255  * View
256  */
257 
258 $form = new Form($db);
259 
260 $now = dol_now();
261 
262 //$help_url = "EN:Module_MyObject|FR:Module_MyObject_FR|ES:Módulo_MyObject";
263 $help_url = '';
264 $title = $langs->trans("MyObjects");
265 $morejs = array();
266 $morecss = array();
267 
268 
269 // Build and execute select
270 // --------------------------------------------------------------------
271 $sql = 'SELECT ';
272 $sql .= $object->getFieldList('t');
273 // Add fields from extrafields
274 if (!empty($extrafields->attributes[$object->table_element]['label'])) {
275  foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
276  $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
277  }
278 }
279 // Add fields from hooks
280 $parameters = array();
281 $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
282 $sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
283 $sql = preg_replace('/,\s*$/', '', $sql);
284 //$sql .= ", COUNT(rc.rowid) as anotherfield";
285 
286 $sqlfields = $sql; // $sql fields to remove for count total
287 
288 $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
289 //$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."anothertable as rc ON rc.parent = t.rowid";
290 if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
291  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
292 }
293 // Add table from hooks
294 $parameters = array();
295 $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
296 $sql .= $hookmanager->resPrint;
297 if ($object->ismultientitymanaged == 1) {
298  $sql .= " WHERE t.entity IN (".getEntity($object->element).")";
299 } else {
300  $sql .= " WHERE 1 = 1";
301 }
302 foreach ($search as $key => $val) {
303  if (array_key_exists($key, $object->fields)) {
304  if ($key == 'status' && $search[$key] == -1) {
305  continue;
306  }
307  $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
308  if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
309  if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
310  $search[$key] = '';
311  }
312  $mode_search = 2;
313  }
314  if ($search[$key] != '') {
315  $sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search));
316  }
317  } else {
318  if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
319  $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
320  if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
321  if (preg_match('/_dtstart$/', $key)) {
322  $sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'";
323  }
324  if (preg_match('/_dtend$/', $key)) {
325  $sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'";
326  }
327  }
328  }
329  }
330 }
331 if ($search_all) {
332  $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
333 }
334 //$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
335 // Add where from extra fields
336 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
337 // Add where from hooks
338 $parameters = array();
339 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
340 $sql .= $hookmanager->resPrint;
341 
342 /* If a group by is required
343 $sql .= " GROUP BY ";
344 foreach($object->fields as $key => $val) {
345  $sql .= "t.".$db->escape($key).", ";
346 }
347 // Add fields from extrafields
348 if (!empty($extrafields->attributes[$object->table_element]['label'])) {
349  foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
350  $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
351  }
352 }
353 // Add where from hooks
354 $parameters = array();
355 $reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook
356 $sql .= $hookmanager->resPrint;
357 $sql = preg_replace('/,\s*$/', '', $sql);
358 */
359 
360 // Add HAVING from hooks
361 /*
362 $parameters = array();
363 $reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook
364 $sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint;
365 */
366 
367 // Count total nb of records
368 $nbtotalofrecords = '';
369 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
370  /* The fast and low memory method to get and count full list converts the sql into a sql count */
371  $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
372  $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
373  $resql = $db->query($sqlforcount);
374  if ($resql) {
375  $objforcount = $db->fetch_object($resql);
376  $nbtotalofrecords = $objforcount->nbtotalofrecords;
377  } else {
378  dol_print_error($db);
379  }
380 
381  if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
382  $page = 0;
383  $offset = 0;
384  }
385  $db->free($resql);
386 }
387 
388 // Complete request and execute it with limit
389 $sql .= $db->order($sortfield, $sortorder);
390 if ($limit) {
391  $sql .= $db->plimit($limit + 1, $offset);
392 }
393 
394 $resql = $db->query($sql);
395 if (!$resql) {
396  dol_print_error($db);
397  exit;
398 }
399 
400 $num = $db->num_rows($resql);
401 
402 
403 // Direct jump if only one record found
404 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
405  $obj = $db->fetch_object($resql);
406  $id = $obj->rowid;
407  header("Location: ".dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.$id);
408  exit;
409 }
410 
411 
412 // Output page
413 // --------------------------------------------------------------------
414 
415 llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist');
416 
417 // Example : Adding jquery code
418 // print '<script type="text/javascript">
419 // jQuery(document).ready(function() {
420 // function init_myfunc()
421 // {
422 // jQuery("#myid").removeAttr(\'disabled\');
423 // jQuery("#myid").attr(\'disabled\',\'disabled\');
424 // }
425 // init_myfunc();
426 // jQuery("#mybutton").click(function() {
427 // init_myfunc();
428 // });
429 // });
430 // </script>';
431 
432 $arrayofselected = is_array($toselect) ? $toselect : array();
433 
434 $param = '';
435 if (!empty($mode)) {
436  $param .= '&mode='.urlencode($mode);
437 }
438 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
439  $param .= '&contextpage='.urlencode($contextpage);
440 }
441 if ($limit > 0 && $limit != $conf->liste_limit) {
442  $param .= '&limit='.urlencode($limit);
443 }
444 foreach ($search as $key => $val) {
445  if (is_array($search[$key])) {
446  foreach ($search[$key] as $skey) {
447  if ($skey != '') {
448  $param .= '&search_'.$key.'[]='.urlencode($skey);
449  }
450  }
451  } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
452  $param .= '&search_'.$key.'month='.((int) GETPOST('search_'.$key.'month', 'int'));
453  $param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int'));
454  $param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int'));
455  } elseif ($search[$key] != '') {
456  $param .= '&search_'.$key.'='.urlencode($search[$key]);
457  }
458 }
459 if ($optioncss != '') {
460  $param .= '&optioncss='.urlencode($optioncss);
461 }
462 // Add $param from extra fields
463 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
464 // Add $param from hooks
465 $parameters = array();
466 $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
467 $param .= $hookmanager->resPrint;
468 
469 // List of mass actions available
470 $arrayofmassactions = array(
471  //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
472  //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
473  //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
474  //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
475 );
476 if (!empty($permissiontodelete)) {
477  $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
478 }
479 if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
480  $arrayofmassactions = array();
481 }
482 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
483 
484 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
485 if ($optioncss != '') {
486  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
487 }
488 print '<input type="hidden" name="token" value="'.newToken().'">';
489 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
490 print '<input type="hidden" name="action" value="list">';
491 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
492 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
493 print '<input type="hidden" name="page" value="'.$page.'">';
494 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
495 print '<input type="hidden" name="mode" value="'.$mode.'">';
496 
497 
498 $newcardbutton = '';
499 $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'));
500 $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'));
501 $newcardbutton .= dolGetButtonTitleSeparator();
502 $newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/mymodule/myobject_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
503 
504 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
505 
506 // Add code for pre mass action (confirmation or email presend form)
507 $topicmail = "SendMyObjectRef";
508 $modelmail = "myobject";
509 $objecttmp = new MyObject($db);
510 $trackid = 'xxxx'.$object->id;
511 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
512 
513 if ($search_all) {
514  $setupstring = '';
515  foreach ($fieldstosearchall as $key => $val) {
516  $fieldstosearchall[$key] = $langs->trans($val);
517  $setupstring .= $key."=".$val.";";
518  }
519  print '<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
520  print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
521 }
522 
523 $moreforfilter = '';
524 /*$moreforfilter.='<div class="divsearchfield">';
525 $moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
526 $moreforfilter.= '</div>';*/
527 
528 $parameters = array();
529 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
530 if (empty($reshook)) {
531  $moreforfilter .= $hookmanager->resPrint;
532 } else {
533  $moreforfilter = $hookmanager->resPrint;
534 }
535 
536 if (!empty($moreforfilter)) {
537  print '<div class="liste_titre liste_titre_bydiv centpercent">';
538  print $moreforfilter;
539  print '</div>';
540 }
541 
542 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
543 $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
544 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
545 
546 print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
547 print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
548 
549 
550 // Fields title search
551 // --------------------------------------------------------------------
552 print '<tr class="liste_titre">';
553 // Action column
554 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
555  print '<td class="liste_titre maxwidthsearch">';
556  $searchpicto = $form->showFilterButtons('left');
557  print $searchpicto;
558  print '</td>';
559 }
560 foreach ($object->fields as $key => $val) {
561  $searchkey = empty($search[$key]) ? '' : $search[$key];
562  $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
563  if ($key == 'status') {
564  $cssforfield .= ($cssforfield ? ' ' : '').'center';
565  } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
566  $cssforfield .= ($cssforfield ? ' ' : '').'center';
567  } elseif (in_array($val['type'], array('timestamp'))) {
568  $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
569  } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
570  $cssforfield .= ($cssforfield ? ' ' : '').'right';
571  }
572  if (!empty($arrayfields['t.'.$key]['checked'])) {
573  print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
574  if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
575  print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status onrightofpage' : ''), 1);
576  } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
577  print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1);
578  } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
579  print '<div class="nowrap">';
580  print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
581  print '</div>';
582  print '<div class="nowrap">';
583  print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
584  print '</div>';
585  } elseif ($key == 'lang') {
586  require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
587  $formadmin = new FormAdmin($db);
588  print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2);
589  } else {
590  print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
591  }
592  print '</td>';
593  }
594 }
595 // Extra fields
596 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
597 
598 // Fields from hook
599 $parameters = array('arrayfields'=>$arrayfields);
600 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
601 print $hookmanager->resPrint;
602 /*if (!empty($arrayfields['anotherfield']['checked'])) {
603  print '<td class="liste_titre"></td>';
604 }*/
605 // Action column
606 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
607  print '<td class="liste_titre maxwidthsearch">';
608  $searchpicto = $form->showFilterButtons();
609  print $searchpicto;
610  print '</td>';
611 }
612 print '</tr>'."\n";
613 
614 $totalarray = array();
615 $totalarray['nbfield'] = 0;
616 
617 // Fields title label
618 // --------------------------------------------------------------------
619 print '<tr class="liste_titre">';
620 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
621  print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
622 }
623 foreach ($object->fields as $key => $val) {
624  $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
625  if ($key == 'status') {
626  $cssforfield .= ($cssforfield ? ' ' : '').'center';
627  } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
628  $cssforfield .= ($cssforfield ? ' ' : '').'center';
629  } elseif (in_array($val['type'], array('timestamp'))) {
630  $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
631  } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
632  $cssforfield .= ($cssforfield ? ' ' : '').'right';
633  }
634  $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
635  if (!empty($arrayfields['t.'.$key]['checked'])) {
636  print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
637  $totalarray['nbfield']++;
638  }
639 }
640 // Extra fields
641 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
642 // Hook fields
643 $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
644 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
645 print $hookmanager->resPrint;
646 /*if (!empty($arrayfields['anotherfield']['checked'])) {
647  print '<th class="liste_titre right">'.$langs->trans("AnotherField").'</th>';
648  $totalarray['nbfield']++;
649 }*/
650 // Action column
651 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
652  print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
653 }
654 $totalarray['nbfield']++; // For the column action
655 print '</tr>'."\n";
656 
657 
658 // Detect if we need a fetch on each output line
659 $needToFetchEachLine = 0;
660 if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
661  foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
662  if (preg_match('/\$object/', $val)) {
663  $needToFetchEachLine++; // There is at least one compute field that use $object
664  }
665  }
666 }
667 
668 
669 // Loop on record
670 // --------------------------------------------------------------------
671 $i = 0;
672 $savnbfield = $totalarray['nbfield'];
673 $totalarray = array();
674 $totalarray['nbfield'] = 0;
675 $imaxinloop = ($limit ? min($num, $limit) : $num);
676 while ($i < $imaxinloop) {
677  $obj = $db->fetch_object($resql);
678  if (empty($obj)) {
679  break; // Should not happen
680  }
681 
682  // Store properties in $object
683  $object->setVarsFromFetchObj($obj);
684 
685  if ($mode == 'kanban') {
686  if ($i == 0) {
687  print '<tr><td colspan="'.$savnbfield.'">';
688  print '<div class="box-flex-container">';
689  }
690  // Output Kanban
691  print $object->getKanbanView('');
692  if ($i == ($imaxinloop - 1)) {
693  print '</div>';
694  print '</td></tr>';
695  }
696  } else {
697  // Show here line of result
698  $j = 0;
699  print '<tr data-rowid="'.$object->id.'" class="oddeven">';
700  // Action column
701  if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
702  print '<td class="nowrap center">';
703  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
704  $selected = 0;
705  if (in_array($object->id, $arrayofselected)) {
706  $selected = 1;
707  }
708  print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
709  }
710  print '</td>';
711  }
712  foreach ($object->fields as $key => $val) {
713  $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
714  if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
715  $cssforfield .= ($cssforfield ? ' ' : '').'center';
716  } elseif ($key == 'status') {
717  $cssforfield .= ($cssforfield ? ' ' : '').'center';
718  }
719 
720  if (in_array($val['type'], array('timestamp'))) {
721  $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
722  } elseif ($key == 'ref') {
723  $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
724  }
725 
726  if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) {
727  $cssforfield .= ($cssforfield ? ' ' : '').'right';
728  }
729  //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
730 
731  if (!empty($arrayfields['t.'.$key]['checked'])) {
732  print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '');
733  if (preg_match('/tdoverflow/', $cssforfield)) {
734  print ' title="'.dol_escape_htmltag($object->$key).'"';
735  }
736  print '>';
737  if ($key == 'status') {
738  print $object->getLibStatut(5);
739  } elseif ($key == 'rowid') {
740  print $object->showOutputField($val, $key, $object->id, '');
741  } else {
742  print $object->showOutputField($val, $key, $object->$key, '');
743  }
744  print '</td>';
745  if (!$i) {
746  $totalarray['nbfield']++;
747  }
748  if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
749  if (!$i) {
750  $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
751  }
752  if (!isset($totalarray['val'])) {
753  $totalarray['val'] = array();
754  }
755  if (!isset($totalarray['val']['t.'.$key])) {
756  $totalarray['val']['t.'.$key] = 0;
757  }
758  $totalarray['val']['t.'.$key] += $object->$key;
759  }
760  }
761  }
762  // Extra fields
763  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
764  // Fields from hook
765  $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
766  $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
767  print $hookmanager->resPrint;
768  /*if (!empty($arrayfields['anotherfield']['checked'])) {
769  print '<td class="right">'.$obj->anotherfield.'</td>';
770  }*/
771  // Action column
772  if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
773  print '<td class="nowrap center">';
774  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
775  $selected = 0;
776  if (in_array($object->id, $arrayofselected)) {
777  $selected = 1;
778  }
779  print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
780  }
781  print '</td>';
782  }
783  if (!$i) {
784  $totalarray['nbfield']++;
785  }
786 
787  print '</tr>'."\n";
788  }
789 
790  $i++;
791 }
792 
793 // Show total line
794 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
795 
796 // If no record found
797 if ($num == 0) {
798  $colspan = 1;
799  foreach ($arrayfields as $key => $val) {
800  if (!empty($val['checked'])) {
801  $colspan++;
802  }
803  }
804  print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
805 }
806 
807 
808 $db->free($resql);
809 
810 $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
811 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
812 print $hookmanager->resPrint;
813 
814 print '</table>'."\n";
815 print '</div>'."\n";
816 
817 print '</form>'."\n";
818 
819 if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
820  $hidegeneratedfilelistifempty = 1;
821  if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
822  $hidegeneratedfilelistifempty = 0;
823  }
824 
825  require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
826  $formfile = new FormFile($db);
827 
828  // Show list of available documents
829  $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
830  $urlsource .= str_replace('&amp;', '&', $param);
831 
832  $filedir = $diroutputmassaction;
833  $genallowed = $permissiontoread;
834  $delallowed = $permissiontoadd;
835 
836  print $formfile->showdocuments('massfilesarea_mymodule', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
837 }
838 
839 // End of page
840 llxFooter();
841 $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 generate html code for admin pages.
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
Class for MyObject.
if(isModEnabled('facture') &&!empty($user->rights->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') &&!empty($user->rights->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)) $resql
Social contributions to pay.
Definition: index.php:745
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
dol_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
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.
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.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
$nbtotalofrecords
Count total nb of records.
Definition: list.php:329
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.