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) ---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 = GETPOST('show_files', 'int'); // 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 a 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();
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='.((int) GETPOST('search_'.$key.'month', 'int'));
496 $param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int'));
497 $param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int'));
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).join(', ', $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 $parameters = array();
581 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
582 print $hookmanager->resPrint;
583 print '</div>';
584}
585
586$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
587$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup
588$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
589$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
590
591print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
592print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
593
594// Fields title search
595// --------------------------------------------------------------------
596print '<tr class="liste_titre_filter">';
597// Action column
598if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
599 print '<td class="liste_titre center maxwidthsearch">';
600 $searchpicto = $form->showFilterButtons('left');
601 print $searchpicto;
602 print '</td>';
603}
604foreach ($object->fields as $key => $val) {
605 //$searchkey = empty($search[$key]) ? '' : $search[$key];
606 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
607 if ($key == 'status') {
608 $cssforfield .= ($cssforfield ? ' ' : '').'center';
609 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
610 $cssforfield .= ($cssforfield ? ' ' : '').'center';
611 } elseif (in_array($val['type'], array('timestamp'))) {
612 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
613 } 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'])) {
614 $cssforfield .= ($cssforfield ? ' ' : '').'right';
615 }
616 if (!empty($arrayfields['t.'.$key]['checked'])) {
617 print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').($key == 'status' ? ' parentonrightofpage' : '').'">';
618 if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
619 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);
620 } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
621 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1);
622 } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
623 print '<div class="nowrap">';
624 print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
625 print '</div>';
626 print '<div class="nowrap">';
627 print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
628 print '</div>';
629 } elseif ($key == 'lang') {
630 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
631 $formadmin = new FormAdmin($db);
632 print $formadmin->select_language((isset($search[$key]) ? $search[$key] : ''), 'search_lang', 0, null, 1, 0, 0, 'minwidth100imp maxwidth125', 2);
633 } else {
634 print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
635 }
636 print '</td>';
637 }
638}
639// Extra fields
640include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
641
642// Fields from hook
643$parameters = array('arrayfields'=>$arrayfields);
644$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
645print $hookmanager->resPrint;
646/*if (!empty($arrayfields['anotherfield']['checked'])) {
647 print '<td class="liste_titre"></td>';
648}*/
649// Action column
650if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
651 print '<td class="liste_titre center maxwidthsearch">';
652 $searchpicto = $form->showFilterButtons();
653 print $searchpicto;
654 print '</td>';
655}
656print '</tr>'."\n";
657
658$totalarray = array();
659$totalarray['nbfield'] = 0;
660
661// Fields title label
662// --------------------------------------------------------------------
663print '<tr class="liste_titre">';
664// Action column
665if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
666 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
667 $totalarray['nbfield']++;
668}
669foreach ($object->fields as $key => $val) {
670 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
671 if ($key == 'status') {
672 $cssforfield .= ($cssforfield ? ' ' : '').'center';
673 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
674 $cssforfield .= ($cssforfield ? ' ' : '').'center';
675 } elseif (in_array($val['type'], array('timestamp'))) {
676 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
677 } 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'])) {
678 $cssforfield .= ($cssforfield ? ' ' : '').'right';
679 }
680 $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
681 if (!empty($arrayfields['t.'.$key]['checked'])) {
682 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";
683 $totalarray['nbfield']++;
684 }
685}
686// Extra fields
687include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
688// Hook fields
689$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
690$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
691print $hookmanager->resPrint;
692/*if (!empty($arrayfields['anotherfield']['checked'])) {
693 print '<th class="liste_titre right">'.$langs->trans("AnotherField").'</th>';
694 $totalarray['nbfield']++;
695}*/
696// Action column
697if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
698 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
699 $totalarray['nbfield']++;
700}
701print '</tr>'."\n";
702
703// Detect if we need a fetch on each output line
704$needToFetchEachLine = 0;
705if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
706 foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
707 if (!is_null($val) && preg_match('/\$object/', $val)) {
708 $needToFetchEachLine++; // There is at least one compute field that use $object
709 }
710 }
711}
712
713
714// Loop on record
715// --------------------------------------------------------------------
716$i = 0;
717$savnbfield = $totalarray['nbfield'];
718$totalarray = array();
719$totalarray['nbfield'] = 0;
720$imaxinloop = ($limit ? min($num, $limit) : $num);
721while ($i < $imaxinloop) {
722 $obj = $db->fetch_object($resql);
723 if (empty($obj)) {
724 break; // Should not happen
725 }
726
727 // Store properties in $object
728 $object->setVarsFromFetchObj($obj);
729
730 /*
731 $object->thirdparty = null;
732 if ($obj->fk_soc > 0) {
733 if (!empty($conf->cache['thirdparty'][$obj->fk_soc])) {
734 $companyobj = $conf->cache['thirdparty'][$obj->fk_soc];
735 } else {
736 $companyobj = new Societe($db);
737 $companyobj->fetch($obj->fk_soc);
738 $conf->cache['thirdparty'][$obj->fk_soc] = $companyobj;
739 }
740
741 $object->thirdparty = $companyobj;
742 }*/
743
744 if ($mode == 'kanban') {
745 if ($i == 0) {
746 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
747 print '<div class="box-flex-container kanban">';
748 }
749 // Output Kanban
750 $selected = -1;
751 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
752 $selected = 0;
753 if (in_array($object->id, $arrayofselected)) {
754 $selected = 1;
755 }
756 }
757 //print $object->getKanbanView('', array('thirdparty'=>$object->thirdparty, 'selected' => $selected));
758 print $object->getKanbanView('', array('selected' => $selected));
759 if ($i == ($imaxinloop - 1)) {
760 print '</div>';
761 print '</td></tr>';
762 }
763 } else {
764 // Show line of result
765 $j = 0;
766 print '<tr data-rowid="'.$object->id.'" class="oddeven">';
767
768 // Action column
769 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
770 print '<td class="nowrap center">';
771 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
772 $selected = 0;
773 if (in_array($object->id, $arrayofselected)) {
774 $selected = 1;
775 }
776 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
777 }
778 print '</td>';
779 if (!$i) {
780 $totalarray['nbfield']++;
781 }
782 }
783 // Fields
784 foreach ($object->fields as $key => $val) {
785 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
786 if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
787 $cssforfield .= ($cssforfield ? ' ' : '').'center';
788 } elseif ($key == 'status') {
789 $cssforfield .= ($cssforfield ? ' ' : '').'center';
790 }
791
792 if (in_array($val['type'], array('timestamp'))) {
793 $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
794 } elseif ($key == 'ref') {
795 $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
796 }
797
798 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'])) {
799 $cssforfield .= ($cssforfield ? ' ' : '').'right';
800 }
801 //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
802
803 if (!empty($arrayfields['t.'.$key]['checked'])) {
804 print '<td'.($cssforfield ? ' class="'.$cssforfield.((preg_match('/tdoverflow/', $cssforfield) && !in_array($val['type'], array('ip', 'url')) && !is_numeric($object->$key)) ? ' classfortooltip' : '').'"' : '');
805 if (preg_match('/tdoverflow/', $cssforfield) && !in_array($val['type'], array('ip', 'url')) && !is_numeric($object->$key)) {
806 print ' title="'.dol_escape_htmltag($object->$key).'"';
807 }
808 print '>';
809 if ($key == 'status') {
810 print $object->getLibStatut(5);
811 } elseif ($key == 'rowid') {
812 print $object->showOutputField($val, $key, $object->id, '');
813 } else {
814 print $object->showOutputField($val, $key, $object->$key, '');
815 }
816 print '</td>';
817 if (!$i) {
818 $totalarray['nbfield']++;
819 }
820 if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
821 if (!$i) {
822 $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
823 }
824 if (!isset($totalarray['val'])) {
825 $totalarray['val'] = array();
826 }
827 if (!isset($totalarray['val']['t.'.$key])) {
828 $totalarray['val']['t.'.$key] = 0;
829 }
830 $totalarray['val']['t.'.$key] += $object->$key;
831 }
832 }
833 }
834 // Extra fields
835 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
836 // Fields from hook
837 $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
838 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
839 print $hookmanager->resPrint;
840
841 /*if (!empty($arrayfields['anotherfield']['checked'])) {
842 print '<td class="right">'.$obj->anotherfield.'</td>';
843 }*/
844
845 // Action column
846 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
847 print '<td class="nowrap center">';
848 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
849 $selected = 0;
850 if (in_array($object->id, $arrayofselected)) {
851 $selected = 1;
852 }
853 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
854 }
855 print '</td>';
856 if (!$i) {
857 $totalarray['nbfield']++;
858 }
859 }
860
861 print '</tr>'."\n";
862 }
863
864 $i++;
865}
866
867// Show total line
868include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
869
870// If no record found
871if ($num == 0) {
872 $colspan = 1;
873 foreach ($arrayfields as $key => $val) {
874 if (!empty($val['checked'])) {
875 $colspan++;
876 }
877 }
878 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
879}
880
881
882$db->free($resql);
883
884$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
885$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
886print $hookmanager->resPrint;
887
888print '</table>'."\n";
889print '</div>'."\n";
890
891print '</form>'."\n";
892
893if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
894 $hidegeneratedfilelistifempty = 1;
895 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
896 $hidegeneratedfilelistifempty = 0;
897 }
898
899 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
900 $formfile = new FormFile($db);
901
902 // Show list of available documents
903 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
904 $urlsource .= str_replace('&amp;', '&', $param);
905
906 $filedir = $diroutputmassaction;
907 $genallowed = $permissiontoread;
908 $delallowed = $permissiontoadd;
909
910 print $formfile->showdocuments('massfilesarea_'.$object->module, '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
911}
912
913// End of page
914llxFooter();
915$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($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...
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.