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