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