dolibarr 19.0.4
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
84// load module libraries
85require_once __DIR__.'/class/myobject.class.php';
86
87// for other modules
88//dol_include_once('/othermodule/class/otherobject.class.php');
89
90// Load translation files required by the page
91$langs->loadLangs(array("mymodule@mymodule", "other"));
92
93// Get parameters
94$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'create'/'add', 'edit'/'update', 'view', ...
95$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
96$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
97$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
98$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
99$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
100$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
101$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
102$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
103$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...)
104
105$id = GETPOST('id', 'int');
106$ref = GETPOST('ref', 'alpha');
107
108// Load variable for pagination
109$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
110$sortfield = GETPOST('sortfield', 'aZ09comma');
111$sortorder = GETPOST('sortorder', 'aZ09comma');
112$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page');
113if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
114 // If $page is not defined, or '' or -1 or if we click on clear filters
115 $page = 0;
116}
117$offset = $limit * $page;
118$pageprev = $page - 1;
119$pagenext = $page + 1;
120
121// Initialize technical objects
122$object = new MyObject($db);
123$extrafields = new ExtraFields($db);
124$diroutputmassaction = $conf->mymodule->dir_output.'/temp/massgeneration/'.$user->id;
125$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes
126
127// Fetch optionals attributes and labels
128$extrafields->fetch_name_optionals_label($object->table_element);
129//$extrafields->fetch_name_optionals_label($object->table_element_line);
130
131$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
132
133// Default sort order (if not yet defined by previous GETPOST)
134if (!$sortfield) {
135 reset($object->fields); // Reset is required to avoid key() to return null.
136 $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
137}
138if (!$sortorder) {
139 $sortorder = "ASC";
140}
141
142// Initialize array of search criterias
143$search_all = trim(GETPOST('search_all', 'alphanohtml'));
144$search = array();
145foreach ($object->fields as $key => $val) {
146 if (GETPOST('search_'.$key, 'alpha') !== '') {
147 $search[$key] = GETPOST('search_'.$key, 'alpha');
148 }
149 if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
150 $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
151 $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
152 }
153}
154
155$fieldstosearchall = array();
156// List of fields to search into when doing a "search in all"
157// foreach ($object->fields as $key => $val) {
158// if (!empty($val['searchall'])) {
159// $fieldstosearchall['t.'.$key] = $val['label'];
160// }
161// }
162// $parameters = array('fieldstosearchall'=>$fieldstosearchall);
163// $reshook = $hookmanager->executeHooks('completeFieldsToSearchAll', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
164// if ($reshook > 0) {
165// $fieldstosearchall = empty($hookmanager->resArray['fieldstosearchall']) ? array() : $hookmanager->resArray['fieldstosearchall'];
166// } elseif ($reshook == 0) {
167// $fieldstosearchall = array_merge($fieldstosearchall, empty($hookmanager->resArray['fieldstosearchall']) ? array() : $hookmanager->resArray['fieldstosearchall']);
168// }
169
170// Definition of array of fields for columns
171$arrayfields = array();
172foreach ($object->fields as $key => $val) {
173 // If $val['visible']==0, then we never show the field
174 if (!empty($val['visible'])) {
175 $visible = (int) dol_eval($val['visible'], 1);
176 $arrayfields['t.'.$key] = array(
177 'label'=>$val['label'],
178 'checked'=>(($visible < 0) ? 0 : 1),
179 'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
180 'position'=>$val['position'],
181 'help'=> isset($val['help']) ? $val['help'] : ''
182 );
183 }
184}
185// Extra fields
186include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
187
188$object->fields = dol_sort_array($object->fields, 'position');
189//$arrayfields['anotherfield'] = array('type'=>'integer', 'label'=>'AnotherField', 'checked'=>1, 'enabled'=>1, 'position'=>90, 'csslist'=>'right');
190$arrayfields = dol_sort_array($arrayfields, 'position');
191
192// There is several ways to check permission.
193// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
194$enablepermissioncheck = 0;
195if ($enablepermissioncheck) {
196 $permissiontoread = $user->hasRight('mymodule', 'myobject', 'read');
197 $permissiontoadd = $user->hasRight('mymodule', 'myobject', 'write');
198 $permissiontodelete = $user->hasRight('mymodule', 'myobject', 'delete');
199} else {
200 $permissiontoread = 1;
201 $permissiontoadd = 1;
202 $permissiontodelete = 1;
203}
204
205// Security check (enable the most restrictive one)
206if ($user->socid > 0) {
208}
209//if ($user->socid > 0) accessforbidden();
210//$socid = 0; if ($user->socid > 0) $socid = $user->socid;
211//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
212//restrictedArea($user, $object->module, 0, $object->table_element, $object->element, 'fk_soc', 'rowid', $isdraft);
213if (!isModEnabled("mymodule")) {
214 accessforbidden('Module mymodule not enabled');
215}
216if (!$permissiontoread) {
218}
219
220
221/*
222 * Actions
223 */
224
225if (GETPOST('cancel', 'alpha')) {
226 $action = 'list';
227 $massaction = '';
228}
229if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
230 $massaction = '';
231}
232
233$parameters = array();
234$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
235if ($reshook < 0) {
236 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
237}
238
239if (empty($reshook)) {
240 // Selection of new fields
241 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
242
243 // Purge search criteria
244 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
245 foreach ($object->fields as $key => $val) {
246 $search[$key] = '';
247 if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
248 $search[$key.'_dtstart'] = '';
249 $search[$key.'_dtend'] = '';
250 }
251 }
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->escape($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->escape($columnName)." >= '".$db->idate($search[$key])."'";
340 }
341 if (preg_match('/_dtend$/', $key)) {
342 $sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'";
343 }
344 }
345 }
346 }
347}
348if ($search_all) {
349 $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
350}
351//$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
352// Add where from extra fields
353include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
354// Add where from hooks
355$parameters = array();
356$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
357$sql .= $hookmanager->resPrint;
358
359/* If a group by is required
360$sql .= " GROUP BY ";
361foreach($object->fields as $key => $val) {
362 $sql .= "t.".$db->escape($key).", ";
363}
364// Add fields from extrafields
365if (!empty($extrafields->attributes[$object->table_element]['label'])) {
366 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
367 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
368 }
369}
370// Add groupby from hooks
371$parameters = array();
372$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
373$sql .= $hookmanager->resPrint;
374$sql = preg_replace('/,\s*$/', '', $sql);
375*/
376
377// Add HAVING from hooks
378/*
379$parameters = array();
380$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
381$sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint;
382*/
383
384// Count total nb of records
385$nbtotalofrecords = '';
386if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
387 /* The fast and low memory method to get and count full list converts the sql into a sql count */
388 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
389 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
390
391 $resql = $db->query($sqlforcount);
392 if ($resql) {
393 $objforcount = $db->fetch_object($resql);
394 $nbtotalofrecords = $objforcount->nbtotalofrecords;
395 } else {
396 dol_print_error($db);
397 }
398
399 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
400 $page = 0;
401 $offset = 0;
402 }
403 $db->free($resql);
404}
405
406// Complete request and execute it with limit
407$sql .= $db->order($sortfield, $sortorder);
408if ($limit) {
409 $sql .= $db->plimit($limit + 1, $offset);
410}
411
412$resql = $db->query($sql);
413if (!$resql) {
414 dol_print_error($db);
415 exit;
416}
417
418$num = $db->num_rows($resql);
419
420
421// Direct jump if only one record found
422if ($num == 1 && getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
423 $obj = $db->fetch_object($resql);
424 $id = $obj->rowid;
425 header("Location: ".dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.((int) $id));
426 exit;
427}
428
429
430// Output page
431// --------------------------------------------------------------------
432
433llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'mod-mymodule page-list bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll
434
435// Example : Adding jquery code
436// print '<script type="text/javascript">
437// jQuery(document).ready(function() {
438// function init_myfunc()
439// {
440// jQuery("#myid").removeAttr(\'disabled\');
441// jQuery("#myid").attr(\'disabled\',\'disabled\');
442// }
443// init_myfunc();
444// jQuery("#mybutton").click(function() {
445// init_myfunc();
446// });
447// });
448// </script>';
449
450$arrayofselected = is_array($toselect) ? $toselect : array();
451
452$param = '';
453if (!empty($mode)) {
454 $param .= '&mode='.urlencode($mode);
455}
456if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
457 $param .= '&contextpage='.urlencode($contextpage);
458}
459if ($limit > 0 && $limit != $conf->liste_limit) {
460 $param .= '&limit='.((int) $limit);
461}
462if ($optioncss != '') {
463 $param .= '&optioncss='.urlencode($optioncss);
464}
465foreach ($search as $key => $val) {
466 if (is_array($search[$key])) {
467 foreach ($search[$key] as $skey) {
468 if ($skey != '') {
469 $param .= '&search_'.$key.'[]='.urlencode($skey);
470 }
471 }
472 } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
473 $param .= '&search_'.$key.'month='.((int) GETPOST('search_'.$key.'month', 'int'));
474 $param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int'));
475 $param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int'));
476 } elseif ($search[$key] != '') {
477 $param .= '&search_'.$key.'='.urlencode($search[$key]);
478 }
479}
480// Add $param from extra fields
481include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
482// Add $param from hooks
483$parameters = array('param' => &$param);
484$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
485$param .= $hookmanager->resPrint;
486
487// List of mass actions available
488$arrayofmassactions = array(
489 //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
490 //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
491 //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
492 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
493);
494if (!empty($permissiontodelete)) {
495 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
496}
497if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
498 $arrayofmassactions = array();
499}
500$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
501
502print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
503if ($optioncss != '') {
504 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
505}
506print '<input type="hidden" name="token" value="'.newToken().'">';
507print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
508print '<input type="hidden" name="action" value="list">';
509print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
510print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
511print '<input type="hidden" name="page" value="'.$page.'">';
512print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
513print '<input type="hidden" name="page_y" value="">';
514print '<input type="hidden" name="mode" value="'.$mode.'">';
515
516
517$newcardbutton = '';
518$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'));
519$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'));
520$newcardbutton .= dolGetButtonTitleSeparator();
521$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/mymodule/myobject_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
522
523print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
524
525// Add code for pre mass action (confirmation or email presend form)
526$topicmail = "SendMyObjectRef";
527$modelmail = "myobject";
528$objecttmp = new MyObject($db);
529$trackid = 'xxxx'.$object->id;
530include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
531
532if ($search_all) {
533 $setupstring = '';
534 foreach ($fieldstosearchall as $key => $val) {
535 $fieldstosearchall[$key] = $langs->trans($val);
536 $setupstring .= $key."=".$val.";";
537 }
538 print '<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
539 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
540}
541
542$moreforfilter = '';
543/*$moreforfilter.='<div class="divsearchfield">';
544$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
545$moreforfilter.= '</div>';*/
546
547$parameters = array();
548$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
549if (empty($reshook)) {
550 $moreforfilter .= $hookmanager->resPrint;
551} else {
552 $moreforfilter = $hookmanager->resPrint;
553}
554
555if (!empty($moreforfilter)) {
556 print '<div class="liste_titre liste_titre_bydiv centpercent">';
557 print $moreforfilter;
558 $parameters = array();
559 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
560 print $hookmanager->resPrint;
561 print '</div>';
562}
563
564$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
565$selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields
566$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
567
568print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
569print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
570
571// Fields title search
572// --------------------------------------------------------------------
573print '<tr class="liste_titre_filter">';
574// Action column
575if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
576 print '<td class="liste_titre center maxwidthsearch">';
577 $searchpicto = $form->showFilterButtons('left');
578 print $searchpicto;
579 print '</td>';
580}
581foreach ($object->fields as $key => $val) {
582 $searchkey = empty($search[$key]) ? '' : $search[$key];
583 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
584 if ($key == 'status') {
585 $cssforfield .= ($cssforfield ? ' ' : '').'center';
586 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
587 $cssforfield .= ($cssforfield ? ' ' : '').'center';
588 } elseif (in_array($val['type'], array('timestamp'))) {
589 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
590 } 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'])) {
591 $cssforfield .= ($cssforfield ? ' ' : '').'right';
592 }
593 if (!empty($arrayfields['t.'.$key]['checked'])) {
594 print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').($key == 'status' ? ' parentonrightofpage' : '').'">';
595 if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
596 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);
597 } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
598 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1);
599 } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
600 print '<div class="nowrap">';
601 print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
602 print '</div>';
603 print '<div class="nowrap">';
604 print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
605 print '</div>';
606 } elseif ($key == 'lang') {
607 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
608 $formadmin = new FormAdmin($db);
609 print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2);
610 } else {
611 print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
612 }
613 print '</td>';
614 }
615}
616// Extra fields
617include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
618
619// Fields from hook
620$parameters = array('arrayfields'=>$arrayfields);
621$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
622print $hookmanager->resPrint;
623/*if (!empty($arrayfields['anotherfield']['checked'])) {
624 print '<td class="liste_titre"></td>';
625}*/
626// Action column
627if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
628 print '<td class="liste_titre center maxwidthsearch">';
629 $searchpicto = $form->showFilterButtons();
630 print $searchpicto;
631 print '</td>';
632}
633print '</tr>'."\n";
634
635$totalarray = array();
636$totalarray['nbfield'] = 0;
637
638// Fields title label
639// --------------------------------------------------------------------
640print '<tr class="liste_titre">';
641// Action column
642if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
643 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
644 $totalarray['nbfield']++;
645}
646foreach ($object->fields as $key => $val) {
647 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
648 if ($key == 'status') {
649 $cssforfield .= ($cssforfield ? ' ' : '').'center';
650 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
651 $cssforfield .= ($cssforfield ? ' ' : '').'center';
652 } elseif (in_array($val['type'], array('timestamp'))) {
653 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
654 } 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'])) {
655 $cssforfield .= ($cssforfield ? ' ' : '').'right';
656 }
657 $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
658 if (!empty($arrayfields['t.'.$key]['checked'])) {
659 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";
660 $totalarray['nbfield']++;
661 }
662}
663// Extra fields
664include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
665// Hook fields
666$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
667$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
668print $hookmanager->resPrint;
669/*if (!empty($arrayfields['anotherfield']['checked'])) {
670 print '<th class="liste_titre right">'.$langs->trans("AnotherField").'</th>';
671 $totalarray['nbfield']++;
672}*/
673// Action column
674if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
675 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
676 $totalarray['nbfield']++;
677}
678print '</tr>'."\n";
679
680// Detect if we need a fetch on each output line
681$needToFetchEachLine = 0;
682if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
683 foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
684 if (!is_null($val) && preg_match('/\$object/', $val)) {
685 $needToFetchEachLine++; // There is at least one compute field that use $object
686 }
687 }
688}
689
690
691// Loop on record
692// --------------------------------------------------------------------
693$i = 0;
694$savnbfield = $totalarray['nbfield'];
695$totalarray = array();
696$totalarray['nbfield'] = 0;
697$imaxinloop = ($limit ? min($num, $limit) : $num);
698while ($i < $imaxinloop) {
699 $obj = $db->fetch_object($resql);
700 if (empty($obj)) {
701 break; // Should not happen
702 }
703
704 // Store properties in $object
705 $object->setVarsFromFetchObj($obj);
706
707 /*
708 $object->thirdparty = null;
709 if ($obj->fk_soc > 0) {
710 if (!empty($conf->cache['thirdparty'][$obj->fk_soc])) {
711 $companyobj = $conf->cache['thirdparty'][$obj->fk_soc];
712 } else {
713 $companyobj = new Societe($db);
714 $companyobj->fetch($obj->fk_soc);
715 $conf->cache['thirdparty'][$obj->fk_soc] = $companyobj;
716 }
717
718 $object->thirdparty = $companyobj;
719 }*/
720
721 if ($mode == 'kanban') {
722 if ($i == 0) {
723 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
724 print '<div class="box-flex-container kanban">';
725 }
726 // Output Kanban
727 $selected = -1;
728 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
729 $selected = 0;
730 if (in_array($object->id, $arrayofselected)) {
731 $selected = 1;
732 }
733 }
734 //print $object->getKanbanView('', array('thirdparty'=>$object->thirdparty, 'selected' => $selected));
735 print $object->getKanbanView('', array('selected' => $selected));
736 if ($i == ($imaxinloop - 1)) {
737 print '</div>';
738 print '</td></tr>';
739 }
740 } else {
741 // Show line of result
742 $j = 0;
743 print '<tr data-rowid="'.$object->id.'" class="oddeven">';
744
745 // Action column
746 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
747 print '<td class="nowrap center">';
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 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
754 }
755 print '</td>';
756 if (!$i) {
757 $totalarray['nbfield']++;
758 }
759 }
760 foreach ($object->fields as $key => $val) {
761 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
762 if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
763 $cssforfield .= ($cssforfield ? ' ' : '').'center';
764 } elseif ($key == 'status') {
765 $cssforfield .= ($cssforfield ? ' ' : '').'center';
766 }
767
768 if (in_array($val['type'], array('timestamp'))) {
769 $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
770 } elseif ($key == 'ref') {
771 $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
772 }
773
774 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'])) {
775 $cssforfield .= ($cssforfield ? ' ' : '').'right';
776 }
777 //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
778
779 if (!empty($arrayfields['t.'.$key]['checked'])) {
780 print '<td'.($cssforfield ? ' class="'.$cssforfield.(preg_match('/tdoverflow/', $cssforfield) ? ' classfortooltip' : '').'"' : '');
781 if (preg_match('/tdoverflow/', $cssforfield) && !in_array($val['type'], array('ip', 'url')) && !is_numeric($object->$key)) {
782 print ' title="'.dol_escape_htmltag($object->$key).'"';
783 }
784 print '>';
785 if ($key == 'status') {
786 print $object->getLibStatut(5);
787 } elseif ($key == 'rowid') {
788 print $object->showOutputField($val, $key, $object->id, '');
789 } else {
790 print $object->showOutputField($val, $key, $object->$key, '');
791 }
792 print '</td>';
793 if (!$i) {
794 $totalarray['nbfield']++;
795 }
796 if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
797 if (!$i) {
798 $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
799 }
800 if (!isset($totalarray['val'])) {
801 $totalarray['val'] = array();
802 }
803 if (!isset($totalarray['val']['t.'.$key])) {
804 $totalarray['val']['t.'.$key] = 0;
805 }
806 $totalarray['val']['t.'.$key] += $object->$key;
807 }
808 }
809 }
810 // Extra fields
811 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
812 // Fields from hook
813 $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
814 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
815 print $hookmanager->resPrint;
816
817 /*if (!empty($arrayfields['anotherfield']['checked'])) {
818 print '<td class="right">'.$obj->anotherfield.'</td>';
819 }*/
820
821 // Action column
822 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
823 print '<td class="nowrap center">';
824 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
825 $selected = 0;
826 if (in_array($object->id, $arrayofselected)) {
827 $selected = 1;
828 }
829 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
830 }
831 print '</td>';
832 if (!$i) {
833 $totalarray['nbfield']++;
834 }
835 }
836
837 print '</tr>'."\n";
838 }
839
840 $i++;
841}
842
843// Show total line
844include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
845
846// If no record found
847if ($num == 0) {
848 $colspan = 1;
849 foreach ($arrayfields as $key => $val) {
850 if (!empty($val['checked'])) {
851 $colspan++;
852 }
853 }
854 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
855}
856
857
858$db->free($resql);
859
860$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
861$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
862print $hookmanager->resPrint;
863
864print '</table>'."\n";
865print '</div>'."\n";
866
867print '</form>'."\n";
868
869if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
870 $hidegeneratedfilelistifempty = 1;
871 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
872 $hidegeneratedfilelistifempty = 0;
873 }
874
875 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
876 $formfile = new FormFile($db);
877
878 // Show list of available documents
879 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
880 $urlsource .= str_replace('&amp;', '&', $param);
881
882 $filedir = $diroutputmassaction;
883 $genallowed = $permissiontoread;
884 $delallowed = $permissiontoadd;
885
886 print $formfile->showdocuments('massfilesarea_'.$object->module, '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
887}
888
889// End of page
890llxFooter();
891$db->close();
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 informations (by default a local PHP server timestamp) Re...
GETPOSTINT($paramname, $method=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
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.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
dol_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
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.
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.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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.