dolibarr  16.0.1
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 //$sql .= ", COUNT(rc.rowid) as anotherfield";
284 $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
285 //$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."anothertable as rc ON rc.parent = t.rowid";
286 if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
287  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
288 }
289 // Add table from hooks
290 $parameters = array();
291 $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
292 $sql .= $hookmanager->resPrint;
293 if ($object->ismultientitymanaged == 1) {
294  $sql .= " WHERE t.entity IN (".getEntity($object->element).")";
295 } else {
296  $sql .= " WHERE 1 = 1";
297 }
298 foreach ($search as $key => $val) {
299  if (array_key_exists($key, $object->fields)) {
300  if ($key == 'status' && $search[$key] == -1) {
301  continue;
302  }
303  $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
304  if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
305  if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
306  $search[$key] = '';
307  }
308  $mode_search = 2;
309  }
310  if ($search[$key] != '') {
311  $sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search));
312  }
313  } else {
314  if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
315  $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
316  if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
317  if (preg_match('/_dtstart$/', $key)) {
318  $sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'";
319  }
320  if (preg_match('/_dtend$/', $key)) {
321  $sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'";
322  }
323  }
324  }
325  }
326 }
327 if ($search_all) {
328  $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
329 }
330 //$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
331 // Add where from extra fields
332 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
333 // Add where from hooks
334 $parameters = array();
335 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
336 $sql .= $hookmanager->resPrint;
337 
338 /* If a group by is required
339 $sql .= " GROUP BY ";
340 foreach($object->fields as $key => $val) {
341  $sql .= "t.".$db->escape($key).", ";
342 }
343 // Add fields from extrafields
344 if (!empty($extrafields->attributes[$object->table_element]['label'])) {
345  foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
346  $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
347  }
348 }
349 // Add where from hooks
350 $parameters = array();
351 $reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook
352 $sql .= $hookmanager->resPrint;
353 $sql = preg_replace('/,\s*$/', '', $sql);
354 */
355 
356 // Add HAVING from hooks
357 /*
358 $parameters = array();
359 $reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook
360 $sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint;
361 */
362 
363 // Count total nb of records
364 $nbtotalofrecords = '';
365 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
366  /* This old and fast method to get and count full list returns all record so use a high amount of memory.
367  $resql = $db->query($sql);
368  $nbtotalofrecords = $db->num_rows($resql);
369  */
370  /* The slow method does not consume memory on mysql (not tested on pgsql) */
371  /*$resql = $db->query($sql, 0, 'auto', 1);
372  while ($db->fetch_object($resql)) {
373  if (empty($nbtotalofrecords)) {
374  $nbtotalofrecords = 1; // We can't make +1 because init value is ''
375  } else {
376  $nbtotalofrecords++;
377  }
378  }*/
379  /* The fast and low memory method to get and count full list converts the sql into a sql count */
380  $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
381  $resql = $db->query($sqlforcount);
382  if ($resql) {
383  $objforcount = $db->fetch_object($resql);
384  $nbtotalofrecords = $objforcount->nbtotalofrecords;
385  } else {
386  dol_print_error($db);
387  }
388 
389  if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
390  $page = 0;
391  $offset = 0;
392  }
393  $db->free($resql);
394 }
395 
396 // Complete request and execute it with limit
397 $sql .= $db->order($sortfield, $sortorder);
398 if ($limit) {
399  $sql .= $db->plimit($limit + 1, $offset);
400 }
401 
402 $resql = $db->query($sql);
403 if (!$resql) {
404  dol_print_error($db);
405  exit;
406 }
407 
408 $num = $db->num_rows($resql);
409 
410 
411 // Direct jump if only one record found
412 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
413  $obj = $db->fetch_object($resql);
414  $id = $obj->rowid;
415  header("Location: ".dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.$id);
416  exit;
417 }
418 
419 
420 // Output page
421 // --------------------------------------------------------------------
422 
423 llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist');
424 
425 // Example : Adding jquery code
426 // print '<script type="text/javascript">
427 // jQuery(document).ready(function() {
428 // function init_myfunc()
429 // {
430 // jQuery("#myid").removeAttr(\'disabled\');
431 // jQuery("#myid").attr(\'disabled\',\'disabled\');
432 // }
433 // init_myfunc();
434 // jQuery("#mybutton").click(function() {
435 // init_myfunc();
436 // });
437 // });
438 // </script>';
439 
440 $arrayofselected = is_array($toselect) ? $toselect : array();
441 
442 $param = '';
443 if (!empty($mode)) {
444  $param .= '&mode='.urlencode($mode);
445 }
446 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
447  $param .= '&contextpage='.urlencode($contextpage);
448 }
449 if ($limit > 0 && $limit != $conf->liste_limit) {
450  $param .= '&limit='.urlencode($limit);
451 }
452 foreach ($search as $key => $val) {
453  if (is_array($search[$key])) {
454  foreach ($search[$key] as $skey) {
455  if ($skey != '') {
456  $param .= '&search_'.$key.'[]='.urlencode($skey);
457  }
458  }
459  } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
460  $param .= '&search_'.$key.'month='.((int) GETPOST('search_'.$key.'month', 'int'));
461  $param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int'));
462  $param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int'));
463  } elseif ($search[$key] != '') {
464  $param .= '&search_'.$key.'='.urlencode($search[$key]);
465  }
466 }
467 if ($optioncss != '') {
468  $param .= '&optioncss='.urlencode($optioncss);
469 }
470 // Add $param from extra fields
471 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
472 // Add $param from hooks
473 $parameters = array();
474 $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
475 $param .= $hookmanager->resPrint;
476 
477 // List of mass actions available
478 $arrayofmassactions = array(
479  //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
480  //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
481  //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
482  //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
483 );
484 if (!empty($permissiontodelete)) {
485  $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
486 }
487 if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
488  $arrayofmassactions = array();
489 }
490 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
491 
492 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
493 if ($optioncss != '') {
494  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
495 }
496 print '<input type="hidden" name="token" value="'.newToken().'">';
497 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
498 print '<input type="hidden" name="action" value="list">';
499 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
500 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
501 print '<input type="hidden" name="page" value="'.$page.'">';
502 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
503 print '<input type="hidden" name="mode" value="'.$mode.'">';
504 
505 
506 $newcardbutton = '';
507 $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'));
508 $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'));
509 $newcardbutton .= dolGetButtonTitleSeparator();
510 $newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/mymodule/myobject_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
511 
512 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
513 
514 // Add code for pre mass action (confirmation or email presend form)
515 $topicmail = "SendMyObjectRef";
516 $modelmail = "myobject";
517 $objecttmp = new MyObject($db);
518 $trackid = 'xxxx'.$object->id;
519 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
520 
521 if ($search_all) {
522  $setupstring = '';
523  foreach ($fieldstosearchall as $key => $val) {
524  $fieldstosearchall[$key] = $langs->trans($val);
525  $setupstring .= $key."=".$val.";";
526  }
527  print '<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
528  print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
529 }
530 
531 $moreforfilter = '';
532 /*$moreforfilter.='<div class="divsearchfield">';
533 $moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
534 $moreforfilter.= '</div>';*/
535 
536 $parameters = array();
537 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
538 if (empty($reshook)) {
539  $moreforfilter .= $hookmanager->resPrint;
540 } else {
541  $moreforfilter = $hookmanager->resPrint;
542 }
543 
544 if (!empty($moreforfilter)) {
545  print '<div class="liste_titre liste_titre_bydiv centpercent">';
546  print $moreforfilter;
547  print '</div>';
548 }
549 
550 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
551 $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
552 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
553 
554 print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
555 print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
556 
557 
558 // Fields title search
559 // --------------------------------------------------------------------
560 print '<tr class="liste_titre">';
561 // Action column
562 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
563  print '<td class="liste_titre maxwidthsearch">';
564  $searchpicto = $form->showFilterButtons('left');
565  print $searchpicto;
566  print '</td>';
567 }
568 foreach ($object->fields as $key => $val) {
569  $searchkey = empty($search[$key]) ? '' : $search[$key];
570  $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
571  if ($key == 'status') {
572  $cssforfield .= ($cssforfield ? ' ' : '').'center';
573  } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
574  $cssforfield .= ($cssforfield ? ' ' : '').'center';
575  } elseif (in_array($val['type'], array('timestamp'))) {
576  $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
577  } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
578  $cssforfield .= ($cssforfield ? ' ' : '').'right';
579  }
580  if (!empty($arrayfields['t.'.$key]['checked'])) {
581  print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
582  if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
583  print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
584  } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
585  print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1);
586  } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
587  print '<div class="nowrap">';
588  print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
589  print '</div>';
590  print '<div class="nowrap">';
591  print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
592  print '</div>';
593  } elseif ($key == 'lang') {
594  require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
595  $formadmin = new FormAdmin($db);
596  print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2);
597  } else {
598  print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
599  }
600  print '</td>';
601  }
602 }
603 // Extra fields
604 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
605 
606 // Fields from hook
607 $parameters = array('arrayfields'=>$arrayfields);
608 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
609 print $hookmanager->resPrint;
610 /*if (!empty($arrayfields['anotherfield']['checked'])) {
611  print '<td class="liste_titre"></td>';
612 }*/
613 // Action column
614 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
615  print '<td class="liste_titre maxwidthsearch">';
616  $searchpicto = $form->showFilterButtons();
617  print $searchpicto;
618  print '</td>';
619 }
620 print '</tr>'."\n";
621 
622 $totalarray = array();
623 $totalarray['nbfield'] = 0;
624 
625 // Fields title label
626 // --------------------------------------------------------------------
627 print '<tr class="liste_titre">';
628 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
629  print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
630 }
631 foreach ($object->fields as $key => $val) {
632  $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
633  if ($key == 'status') {
634  $cssforfield .= ($cssforfield ? ' ' : '').'center';
635  } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
636  $cssforfield .= ($cssforfield ? ' ' : '').'center';
637  } elseif (in_array($val['type'], array('timestamp'))) {
638  $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
639  } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
640  $cssforfield .= ($cssforfield ? ' ' : '').'right';
641  }
642  $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
643  if (!empty($arrayfields['t.'.$key]['checked'])) {
644  print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
645  $totalarray['nbfield']++;
646  }
647 }
648 // Extra fields
649 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
650 // Hook fields
651 $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
652 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
653 print $hookmanager->resPrint;
654 /*if (!empty($arrayfields['anotherfield']['checked'])) {
655  print '<th class="liste_titre right">'.$langs->trans("AnotherField").'</th>';
656  $totalarray['nbfield']++;
657 }*/
658 // Action column
659 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
660  print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
661 }
662 $totalarray['nbfield']++;
663 print '</tr>'."\n";
664 
665 
666 // Detect if we need a fetch on each output line
667 $needToFetchEachLine = 0;
668 if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
669  foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
670  if (preg_match('/\$object/', $val)) {
671  $needToFetchEachLine++; // There is at least one compute field that use $object
672  }
673  }
674 }
675 
676 
677 // Loop on record
678 // --------------------------------------------------------------------
679 $i = 0;
680 $savnbfield = $totalarray['nbfield'];
681 $totalarray = array();
682 $totalarray['nbfield'] = 0;
683 $imaxinloop = ($limit ? min($num, $limit) : $num);
684 while ($i < $imaxinloop) {
685  $obj = $db->fetch_object($resql);
686  if (empty($obj)) {
687  break; // Should not happen
688  }
689 
690  // Store properties in $object
691  $object->setVarsFromFetchObj($obj);
692 
693  if ($mode == 'kanban') {
694  if ($i == 0) {
695  print '<tr><td colspan="'.$savnbfield.'">';
696  print '<div class="box-flex-container">';
697  }
698  // Output Kanban
699  print $object->getKanbanView('');
700  if ($i == ($imaxinloop - 1)) {
701  print '</div>';
702  print '</td></tr>';
703  }
704  } else {
705  // Show here line of result
706  $j = 0;
707  print '<tr data-rowid="'.$object->id.'" class="oddeven">';
708  // Action column
709  if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
710  print '<td class="nowrap center">';
711  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
712  $selected = 0;
713  if (in_array($object->id, $arrayofselected)) {
714  $selected = 1;
715  }
716  print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
717  }
718  print '</td>';
719  }
720  foreach ($object->fields as $key => $val) {
721  $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
722  if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
723  $cssforfield .= ($cssforfield ? ' ' : '').'center';
724  } elseif ($key == 'status') {
725  $cssforfield .= ($cssforfield ? ' ' : '').'center';
726  }
727 
728  if (in_array($val['type'], array('timestamp'))) {
729  $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
730  } elseif ($key == 'ref') {
731  $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
732  }
733 
734  if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) {
735  $cssforfield .= ($cssforfield ? ' ' : '').'right';
736  }
737  //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
738 
739  if (!empty($arrayfields['t.'.$key]['checked'])) {
740  print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '');
741  if (preg_match('/tdoverflow/', $cssforfield)) {
742  print ' title="'.dol_escape_htmltag($object->$key).'"';
743  }
744  print '>';
745  if ($key == 'status') {
746  print $object->getLibStatut(5);
747  } elseif ($key == 'rowid') {
748  print $object->showOutputField($val, $key, $object->id, '');
749  } else {
750  print $object->showOutputField($val, $key, $object->$key, '');
751  }
752  print '</td>';
753  if (!$i) {
754  $totalarray['nbfield']++;
755  }
756  if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
757  if (!$i) {
758  $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
759  }
760  if (!isset($totalarray['val'])) {
761  $totalarray['val'] = array();
762  }
763  if (!isset($totalarray['val']['t.'.$key])) {
764  $totalarray['val']['t.'.$key] = 0;
765  }
766  $totalarray['val']['t.'.$key] += $object->$key;
767  }
768  }
769  }
770  // Extra fields
771  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
772  // Fields from hook
773  $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
774  $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
775  print $hookmanager->resPrint;
776  /*if (!empty($arrayfields['anotherfield']['checked'])) {
777  print '<td class="right">'.$obj->anotherfield.'</td>';
778  }*/
779  // Action column
780  if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
781  print '<td class="nowrap center">';
782  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
783  $selected = 0;
784  if (in_array($object->id, $arrayofselected)) {
785  $selected = 1;
786  }
787  print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
788  }
789  print '</td>';
790  }
791  if (!$i) {
792  $totalarray['nbfield']++;
793  }
794 
795  print '</tr>'."\n";
796  }
797 
798  $i++;
799 }
800 
801 // Show total line
802 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
803 
804 // If no record found
805 if ($num == 0) {
806  $colspan = 1;
807  foreach ($arrayfields as $key => $val) {
808  if (!empty($val['checked'])) {
809  $colspan++;
810  }
811  }
812  print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
813 }
814 
815 
816 $db->free($resql);
817 
818 $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
819 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
820 print $hookmanager->resPrint;
821 
822 print '</table>'."\n";
823 print '</div>'."\n";
824 
825 print '</form>'."\n";
826 
827 if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
828  $hidegeneratedfilelistifempty = 1;
829  if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
830  $hidegeneratedfilelistifempty = 0;
831  }
832 
833  require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
834  $formfile = new FormFile($db);
835 
836  // Show list of available documents
837  $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
838  $urlsource .= str_replace('&amp;', '&', $param);
839 
840  $filedir = $diroutputmassaction;
841  $genallowed = $permissiontoread;
842  $delallowed = $permissiontoadd;
843 
844  print $formfile->showdocuments('massfilesarea_mymodule', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
845 }
846 
847 // End of page
848 llxFooter();
849 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if($cancel &&!$id) if($action== 'add'&&!$cancel) if($action== 'delete') if($id) $form
Actions.
Definition: card.php:142
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...
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.
dol_now($mode= 'auto')
Return date for now.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default= '')
Return dolibarr global constant string value.
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
Class for MyObject.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
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_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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
Class to generate html code for admin pages.
Class to manage standard extra fields.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
dol_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring= '1')
Replace eval function to add more security.
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.
Class to manage generation of HTML components Only common components must be here.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form...
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it&#39;s its name (generic function)
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 ...
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...
Class to offer components to list and upload files.
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
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_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip= '', $forcenowrapcolumntitle=0)
Get title line of an array.
llxFooter()
Empty footer.
Definition: wrapper.php:73