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