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