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