dolibarr 23.0.4
list.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
3 * Copyright (C) 2022 Open-Dsi <support@open-dsi.fr>
4 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
5 * Copyright (C) 2024 Benjamin Falière <benjamin.faliere@altairis.fr>
6 * Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
28// Load Dolibarr environment
29require '../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
31require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttribute.class.php';
32
41// Load translation files required by the page
42$langs->loadLangs(array("products", "other"));
43
44$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'create'/'add', 'edit'/'update', 'view', ...
45$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
46$show_files = GETPOSTINT('show_files'); // Show files area generated by bulk actions
47$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
48$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
49$toselect = GETPOST('toselect', 'array:int'); // Array of ids of elements selected into a list
50$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
51$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
52$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
53$mode = GETPOST('mode', 'aZ'); // The display mode ('list', 'kanban', 'hierarchy', 'calendar', 'gantt', ...)
54
55$id = GETPOSTINT('id');
56$rowid = GETPOSTINT('rowid'); // for line reordering in not ajax mode
57
58// Load variable for pagination
59$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
60$sortfield = GETPOST('sortfield', 'aZ09comma');
61$sortorder = GETPOST('sortorder', 'aZ09comma');
62$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page');
63if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
64 // If $page is not defined, or '' or -1 or if we click on clear filters
65 $page = 0;
66}
67$offset = $limit * $page;
68$pageprev = $page - 1;
69$pagenext = $page + 1;
70
71// Initialize a technical objects
72$object = new ProductAttribute($db);
73$extrafields = new ExtraFields($db);
74$diroutputmassaction = $conf->variants->dir_output.'/temp/massgeneration/'.$user->id;
75$hookmanager->initHooks(array('productattributelist')); // Note that conf->hooks_modules contains array
76
77// Fetch optionals attributes and labels
78$extrafields->fetch_name_optionals_label($object->table_element);
79
80$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
81
82// Default sort order (if not yet defined by previous GETPOST)
83if (!$sortfield) {
84 $sortfield = "t.position"; // Set here default search field. By default 1st field in definition.
85}
86if (!$sortorder) {
87 $sortorder = "ASC";
88}
89
90// Initialize array of search criteria
91$search_all = trim(GETPOST('search_all', 'alphanohtml'));
92$search = array();
93foreach ($object->fields as $key => $val) {
94 if (GETPOST('search_'.$key, 'alpha') !== '') {
95 $search[$key] = GETPOST('search_'.$key, 'alpha');
96 }
97 if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
98 $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOSTINT('search_'.$key.'_dtstartmonth'), GETPOSTINT('search_'.$key.'_dtstartday'), GETPOSTINT('search_'.$key.'_dtstartyear'));
99 $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOSTINT('search_'.$key.'_dtendmonth'), GETPOSTINT('search_'.$key.'_dtendday'), GETPOSTINT('search_'.$key.'_dtendyear'));
100 }
101}
102$search['nb_of_values'] = GETPOST('search_nb_of_values', 'alpha');
103$search['nb_products'] = GETPOST('search_nb_products', 'alpha');
104
105$fieldstosearchall = array();
106// List of fields to search into when doing a "search in all"
107foreach ($object->fields as $key => $val) {
108 if (!empty($val['searchall'])) {
109 $fieldstosearchall['t.'.$key] = $val['label'];
110 }
111}
112$parameters = array('fieldstosearchall' => $fieldstosearchall);
113$reshook = $hookmanager->executeHooks('completeFieldsToSearchAll', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
114if ($reshook > 0) {
115 $fieldstosearchall = empty($hookmanager->resArray['fieldstosearchall']) ? array() : $hookmanager->resArray['fieldstosearchall'];
116} elseif ($reshook == 0) {
117 $fieldstosearchall = array_merge($fieldstosearchall, empty($hookmanager->resArray['fieldstosearchall']) ? array() : $hookmanager->resArray['fieldstosearchall']);
118}
119
120// Definition of array of fields for columns
121$arrayfields = array();
122foreach ($object->fields as $key => $val) {
123 // If $val['visible']==0, then we never show the field
124 if (!empty($val['visible'])) {
125 $visible = (int) dol_eval((string) $val['visible'], 1);
126 $arrayfields['t.'.$key] = array(
127 'label' => $val['label'],
128 'checked' => (($visible < 0) ? '0' : '1'),
129 'enabled' => (string) (int) (abs($visible) != 3 && (bool) dol_eval((string) $val['enabled'], 1)),
130 'position' => $val['position'],
131 'help' => isset($val['help']) ? $val['help'] : ''
132 );
133 }
134}
135$arrayfields['nb_of_values'] = array(
136 'label' => $langs->trans('NbOfDifferentValues'),
137 'checked' => '1',
138 'enabled' => '1',
139 'position' => 40,
140 'help' => ''
141);
142$arrayfields['nb_products'] = array(
143 'label' => $langs->trans('NbProducts'),
144 'checked' => '1',
145 'enabled' => '1',
146 'position' => 50,
147 'help' => ''
148);
149// Extra fields
150include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
151
152$object->fields = dol_sort_array($object->fields, 'position');
153$arrayfields = dol_sort_array($arrayfields, 'position');
154
155$permissiontoread = $user->hasRight('variants', 'read');
156$permissiontoadd = $user->hasRight('variants', 'write');
157$permissiontodelete = $user->hasRight('variants', 'delete');
158
159// Security check
160if (!isModEnabled('variants')) {
161 accessforbidden('Module not enabled');
162}
163$socid = 0;
164if ($user->socid > 0) { // Protection if external user
165 //$socid = $user->socid;
167}
168if (!$permissiontoread) {
170}
171
172
173/*
174 * Actions
175 */
176
177if (GETPOST('cancel', 'alpha')) {
178 $action = 'list';
179 $massaction = '';
180}
181if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
182 $massaction = '';
183}
184
185$parameters = array('arrayfields' => &$arrayfields);
186$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
187if ($reshook < 0) {
188 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
189}
190
191if (empty($reshook)) {
192 // Selection of new fields
193 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
194
195 // Purge search criteria
196 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
197 foreach ($object->fields as $key => $val) {
198 $search[$key] = '';
199 if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
200 $search[$key.'_dtstart'] = '';
201 $search[$key.'_dtend'] = '';
202 }
203 }
204 $search['nb_of_values'] = '';
205 $search['nb_products'] = '';
206 $toselect = array();
207 $search_array_options = array();
208 }
209 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
210 || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
211 $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
212 }
213
214 if ($action == 'up' && $permissiontoadd) {
215 $object->attributeMoveUp($rowid);
216
217 header('Location: '.$_SERVER['PHP_SELF']);
218 exit();
219 } elseif ($action == 'down' && $permissiontoadd) {
220 $object->attributeMoveDown($rowid);
221
222 header('Location: '.$_SERVER['PHP_SELF']);
223 exit();
224 }
225
226 // Mass actions
227 $objectclass = 'ProductAttribute';
228 $objectlabel = 'ProductAttribute';
229 $uploaddir = $conf->variants->dir_output;
230 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
231}
232
233
234
235/*
236 * View
237 */
238
239$form = new Form($db);
240
241$now = dol_now();
242
243$title = $langs->trans("ProductAttributes");
244$help_url = '';
245$morejs = array();
246$morecss = array();
247
248
249// Build and execute select
250// --------------------------------------------------------------------
251$sql = "SELECT COUNT(DISTINCT pav.rowid) AS nb_of_values, COUNT(DISTINCT pac2v.fk_prod_combination) AS nb_products, ";
252$sql .= $object->getFieldList("t");
253// Add fields from extrafields
254if (!empty($extrafields->attributes[$object->table_element]['label'])) {
255 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
256 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : "");
257 }
258}
259// Add fields from hooks
260$parameters = array();
261$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
262$sql .= $hookmanager->resPrint;
263$sql = preg_replace('/,\s*$/', '', $sql);
264
265$sqlfields = $sql; // $sql fields to remove for count total
266
267$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
268if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
269 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
270}
271$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination2val AS pac2v ON pac2v.fk_prod_attr = t.rowid";
272$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_value AS pav ON pav.fk_product_attribute = t.rowid";
273// Add table from hooks
274$parameters = array();
275$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
276$sql .= $hookmanager->resPrint;
277if ($object->ismultientitymanaged == 1) {
278 $sql .= " WHERE t.entity IN (".getEntity($object->element, (GETPOSTINT('search_current_entity') ? 0 : 1)).")";
279} else {
280 $sql .= " WHERE 1 = 1";
281}
282foreach ($search as $key => $val) {
283 if (array_key_exists($key, $object->fields)) {
284 if ($key == 'status' && $search[$key] == -1) {
285 continue;
286 }
287 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
288 if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
289 if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
290 $search[$key] = '';
291 }
292 $mode_search = 2;
293 }
294 if ($search[$key] != '') {
295 $sql .= natural_search("t.".$db->sanitize($key), $search[$key], (($key == 'status') ? 2 : $mode_search));
296 }
297 } else {
298 if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
299 $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
300 if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
301 if (preg_match('/_dtstart$/', $key)) {
302 $sql .= " AND t.".$db->sanitize($columnName)." >= '".$db->idate($search[$key])."'";
303 }
304 if (preg_match('/_dtend$/', $key)) {
305 $sql .= " AND t.".$db->sanitize($columnName)." <= '".$db->idate($search[$key])."'";
306 }
307 }
308 }
309 }
310}
311if ($search_all) {
312 $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
313}
314//$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
315// Add where from extra fields
316include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
317// Add where from hooks
318$parameters = array();
319$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
320$sql .= $hookmanager->resPrint;
321
322$hasgroupby = true;
323$sql .= " GROUP BY ";
324foreach ($object->fields as $key => $val) {
325 $sql .= "t.".$db->sanitize($key).", ";
326}
327// Add fields from extrafields
328if (!empty($extrafields->attributes[$object->table_element]['label'])) {
329 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
330 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
331 }
332}
333// Add where from hooks
334$parameters = array();
335$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
336$sql .= $hookmanager->resPrint;
337$sql = preg_replace("/,\s*$/", "", $sql);
338
339$sql .= " HAVING 1=1";
340if ($search['nb_of_values'] != '') {
341 $sql .= natural_search("nb_of_values", $search['nb_of_values'], 1);
342}
343if ($search['nb_products'] != '') {
344 $sql .= natural_search("nb_products", $search['nb_products'], 1);
345}
346// Add HAVING from hooks
347$parameters = array();
348$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
349if (empty($reshook)) {
350 $sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint;
351} else {
352 $sql = $hookmanager->resPrint;
353}
354
355// Count total nb of records
356$nbtotalofrecords = '';
357if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
358 /* This old and fast method to get and count full list returns all record so use a high amount of memory.
359 $resql = $db->query($sql);
360 $nbtotalofrecords = $db->num_rows($resql);
361 */
362 /* The slow method does not consume memory on mysql (not tested on pgsql) */
363 /*$resql = $db->query($sql, 0, 'auto', 1);
364 while ($db->fetch_object($resql)) {
365 $nbtotalofrecords++;
366 }*/
367 /* The fast and low memory method to get and count full list converts the sql into a sql count */
368 if ($hasgroupby) {
369 // The GROUP BY and the HAVING must be kept, so the grouped query is counted as a subquery
370 $sqlforcount = "SELECT COUNT(*) as nbtotalofrecords FROM (".$sql.") as tmpcount";
371 } else {
372 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
373 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
374 }
375
376 $resql = $db->query($sqlforcount);
377 if ($resql) {
378 if ($hasgroupby) {
379 $nbtotalofrecords = $db->num_rows($resql);
380 } else {
381 $objforcount = $db->fetch_object($resql);
382 $nbtotalofrecords = $objforcount->nbtotalofrecords;
383 }
384 if (($page * $limit) > (int) $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
385 $page = 0;
386 $offset = 0;
387 }
388 $db->free($resql);
389 }
390}
391
392// Complete request and execute it with limit
393$sql .= $db->order($sortfield, $sortorder);
394if ($limit) {
395 $sql .= $db->plimit($limit + 1, $offset);
396}
397
398$resql = $db->query($sql);
399if (!$resql) {
400 dol_print_error($db);
401 exit;
402}
403
404$num = $db->num_rows($resql);
405
406
407// Direct jump if only one record found
408if ($num == 1 && getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
409 $obj = $db->fetch_object($resql);
410 $id = $obj->rowid;
411 header("Location: " . dol_buildpath('/variants/card.php', 2) . '?id='.((int) $id));
412 exit;
413}
414
415
416// Output page
417// --------------------------------------------------------------------
418
419llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist');
420
421$arrayofselected = is_array($toselect) ? $toselect : array();
422
423$param = '';
424if (!empty($mode)) {
425 $param .= '&mode='.urlencode($mode);
426}
427if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
428 $param .= '&contextpage='.urlencode($contextpage);
429}
430if ($limit > 0 && $limit != $conf->liste_limit) {
431 $param .= '&limit='.((int) $limit);
432}
433if ($optioncss != '') {
434 $param .= '&optioncss='.urlencode($optioncss);
435}
436/*
437if ($groupby != '') {
438 $param .= '&groupby='.urlencode($groupby);
439}
440*/
441foreach ($search as $key => $val) {
442 if (is_array($search[$key])) {
443 foreach ($search[$key] as $skey) {
444 if ($skey != '') {
445 $param .= '&search_'.$key.'[]='.urlencode($skey);
446 }
447 }
448 } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
449 $param .= '&search_'.$key.'month='.(GETPOSTINT('search_'.$key.'month'));
450 $param .= '&search_'.$key.'day='.(GETPOSTINT('search_'.$key.'day'));
451 $param .= '&search_'.$key.'year='.(GETPOSTINT('search_'.$key.'year'));
452 } elseif ($search[$key] != '') {
453 $param .= '&search_'.$key.'='.urlencode($search[$key]);
454 }
455}
456// Add $param from extra fields
457include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
458// Add $param from hooks
459$parameters = array('param' => &$param);
460$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
461$param .= $hookmanager->resPrint;
462
463// List of mass actions available
464$arrayofmassactions = array(
465 //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
466 //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
467 //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
468 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
469);
470if (!empty($permissiontodelete)) {
471 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
472}
473if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete'))) {
474 $arrayofmassactions = array();
475}
476$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
477
478print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
479if ($optioncss != '') {
480 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
481}
482print '<input type="hidden" name="token" value="'.newToken().'">';
483print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
484print '<input type="hidden" name="action" value="list">';
485print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
486print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
487print '<input type="hidden" name="page" value="'.$page.'">';
488print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
489print '<input type="hidden" name="page_y" value="">';
490print '<input type="hidden" name="mode" value="'.$mode.'">';
491
492$newcardbutton = '';
493$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'));
494$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'));
495$newcardbutton .= dolGetButtonTitleSeparator();
496$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/variants/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
497
498print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
499
500// Add code for pre mass action (confirmation or email presend form)
501$topicmail = "SendProductAttributeRef";
502$modelmail = "productattribute";
503$objecttmp = new ProductAttribute($db);
504$trackid = 'pa'.$object->id;
505include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
506
507if ($search_all) {
508 $setupstring = '';
509 foreach ($fieldstosearchall as $key => $val) {
510 $fieldstosearchall[$key] = $langs->trans($val);
511 $setupstring .= $key."=".$val.";";
512 }
513 print '<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
514 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>'."\n";
515}
516
517$moreforfilter = '';
518/*$moreforfilter.='<div class="divsearchfield">';
519$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
520$moreforfilter.= '</div>';*/
521
522$parameters = array();
523$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
524if (empty($reshook)) {
525 $moreforfilter .= $hookmanager->resPrint;
526} else {
527 $moreforfilter = $hookmanager->resPrint;
528}
529
530if (!empty($moreforfilter)) {
531 print '<div class="liste_titre liste_titre_bydiv centpercent">';
532 print $moreforfilter;
533 print '</div>';
534}
535
536$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
537$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup
538$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
539$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
540
541print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
542print '<table id="tableattributes" class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
543
544
545// Fields title search
546// --------------------------------------------------------------------
547print '<tr class="liste_titre_filter nodrag nodrop">';
548// Action column
549if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
550 print '<td class="liste_titre center maxwidthsearch">';
551 $searchpicto = $form->showFilterButtons('left');
552 print $searchpicto;
553 print '</td>';
554}
555foreach ($object->fields as $key => $val) {
556 //$searchkey = empty($search[$key]) ? '' : $search[$key];
557 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
558 if ($key == 'status') {
559 $cssforfield .= ($cssforfield ? ' ' : '').'center';
560 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
561 $cssforfield .= ($cssforfield ? ' ' : '').'center';
562 } elseif (in_array($val['type'], array('timestamp'))) {
563 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
564 } 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'])) {
565 $cssforfield .= ($cssforfield ? ' ' : '').'right';
566 }
567 if (!empty($arrayfields['t.'.$key]['checked'])) {
568 print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').($key == 'status' ? ' parentonrightofpage' : '').'">';
569 if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
570 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);
571 } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
572 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1);
573 } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
574 print '<div class="nowrap">';
575 print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
576 print '</div>';
577 print '<div class="nowrap">';
578 print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
579 print '</div>';
580 } elseif ($key == 'lang') {
581 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
582 $formadmin = new FormAdmin($db);
583 print $formadmin->select_language((isset($search[$key]) ? $search[$key] : ''), 'search_lang', 0, array(), 1, 0, 0, 'minwidth100imp maxwidth125', 2);
584 } else {
585 print '<input type="text" class="flat maxwidth'.($val['type'] == 'integer' ? '50' : '75').'" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
586 }
587 print '</td>';
588 }
589}
590// Extra fields
591include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
592// Fields from hook
593$parameters = array('arrayfields' => $arrayfields);
594$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
595print $hookmanager->resPrint;
596
597$key = 'nb_of_values';
598if (!empty($arrayfields[$key]['checked'])) {
599 print '<td class="liste_titre center">';
600 print '<input type="text" class="flat maxwidth50" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
601 print '</td>';
602}
603$key = 'nb_products';
604if (!empty($arrayfields[$key]['checked'])) {
605 print '<td class="liste_titre center">';
606 print '<input type="text" class="flat maxwidth50" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
607 print '</td>';
608}
609// Action column
610if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
611 print '<td class="liste_titre center maxwidthsearch">';
612 $searchpicto = $form->showFilterButtons();
613 print $searchpicto;
614 print '</td>';
615}
616// Move
617print '<td class="liste_titre linecolmove width25"></td>';
618print '</tr>'."\n";
619
620$totalarray = array();
621$totalarray['nbfield'] = 0;
622
623// Fields title label
624// --------------------------------------------------------------------
625print '<tr class="liste_titre nodrag nodrop">';
626// Action column
627if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
628 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
629 $totalarray['nbfield']++;
630}
631foreach ($object->fields as $key => $val) {
632 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
633 if ($key == 'status') {
634 $cssforfield .= ($cssforfield ? ' ' : '').'center';
635 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
636 $cssforfield .= ($cssforfield ? ' ' : '').'center';
637 } elseif (in_array($val['type'], array('timestamp'))) {
638 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
639 } 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'])) {
640 $cssforfield .= ($cssforfield ? ' ' : '').'right';
641 }
642 $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
643 if (!empty($arrayfields['t.'.$key]['checked'])) {
644 print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, '', $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n";
645 $totalarray['nbfield']++;
646 }
647}
648// Extra fields
649include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
650// Hook fields
651$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
652$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
653print $hookmanager->resPrint;
654
655$key = 'nb_of_values';
656if (!empty($arrayfields[$key]['checked'])) {
657 // @phan-suppress-next-line PhanTypeInvalidDimOffset
658 print getTitleFieldOfList($arrayfields[$key]['label'], 0, $_SERVER['PHP_SELF'], $key, '', $param, 'class="center"', $sortfield, $sortorder, 'center ')."\n";
659 $totalarray['nbfield']++;
660}
661$key = 'nb_products';
662if (!empty($arrayfields[$key]['checked'])) {
663 print getTitleFieldOfList($arrayfields[$key]['label'], 0, $_SERVER['PHP_SELF'], $key, '', $param, 'class="center"', $sortfield, $sortorder, 'center ')."\n";
664 $totalarray['nbfield']++;
665}
666// Action column
667if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
668 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
669 $totalarray['nbfield']++;
670}
671// Move
672print getTitleFieldOfList('', 0, '', '', '', '', '', '', '', 'linecolmove ')."\n";
673$totalarray['nbfield']++;
674print '</tr>'."\n";
675
676
677// Detect if we need a fetch on each output line
678$needToFetchEachLine = 0;
679//if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
680// foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
681// if (!is_null($val) && preg_match('/\$object/', $val)) {
682// $needToFetchEachLine++; // There is at least one compute field that use $object
683// }
684// }
685//}
686
687
688// Loop on record
689// --------------------------------------------------------------------
690$i = 0;
691$savnbfield = $totalarray['nbfield'];
692$totalarray = array();
693$totalarray['nbfield'] = 0;
694$imaxinloop = ($limit ? min($num, $limit) : $num);
695while ($i < $imaxinloop) {
696 $obj = $db->fetch_object($resql);
697 if (empty($obj)) {
698 break; // Should not happen
699 }
700
701 // Store properties in $object
702 $object->setVarsFromFetchObj($obj);
703 $object->fetch_optionals();
704
705 if ($mode == 'kanban') {
706 if ($i == 0) {
707 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
708 print '<div class="box-flex-container kanban">';
709 }
710 // Output Kanban
711 $selected = -1;
712 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
713 $selected = 0;
714 if (in_array($object->id, $arrayofselected)) {
715 $selected = 1;
716 }
717 }
718 print $object->getKanbanView('', array('selected' => $selected));
719 if ($i == ($imaxinloop - 1)) {
720 print '</div>';
721 print '</td></tr>';
722 }
723 } else {
724 // Show line of result
725 $j = 0;
726 print '<tr data-rowid="'.$object->id.'" class="oddeven">';
727 // Action column
728 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
729 print '<td class="nowrap center">';
730 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
731 $selected = 0;
732 if (in_array($object->id, $arrayofselected)) {
733 $selected = 1;
734 }
735 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
736 }
737 print '</td>';
738 if (!$i) {
739 $totalarray['nbfield']++;
740 }
741 }
742 // Fields
743 foreach ($object->fields as $key => $val) {
744 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
745 if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
746 $cssforfield .= ($cssforfield ? ' ' : '') . 'center';
747 } elseif ($key == 'status') {
748 $cssforfield .= ($cssforfield ? ' ' : '') . 'center';
749 }
750
751 if (in_array($val['type'], array('timestamp'))) {
752 $cssforfield .= ($cssforfield ? ' ' : '') . 'nowraponall';
753 } elseif ($key == 'ref') {
754 $cssforfield .= ($cssforfield ? ' ' : '') . 'nowraponall';
755 }
756
757 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'])) {
758 $cssforfield .= ($cssforfield ? ' ' : '') . 'right';
759 }
760 //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
761
762 if (!empty($arrayfields['t.' . $key]['checked'])) {
763 print '<td'.($cssforfield ? ' class="'.$cssforfield.((preg_match('/tdoverflow/', $cssforfield) && !in_array($val['type'], array('ip', 'url')) && !is_numeric($object->$key)) ? ' classfortooltip' : '').'"' : '');
764 if (preg_match('/tdoverflow/', $cssforfield) && !in_array($val['type'], array('ip', 'url')) && !is_numeric($object->$key)) {
765 print ' title="'.dol_escape_htmltag((string) $object->$key).'"';
766 }
767 print '>';
768 if ($key == 'status') {
769 print $object->getLibStatut(5);
770 } elseif ($key == 'rowid') {
771 print $object->showOutputField($val, $key, (string) $object->id, '');
772 } else {
773 print $object->showOutputField($val, $key, $object->$key, '');
774 }
775 print '</td>';
776 if (!$i) {
777 $totalarray['nbfield']++;
778 }
779 if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
780 if (!$i) {
781 $totalarray['pos'][$totalarray['nbfield']] = 't.' . $key;
782 }
783 if (!isset($totalarray['val'])) {
784 $totalarray['val'] = array();
785 }
786 if (!isset($totalarray['val']['t.' . $key])) {
787 $totalarray['val']['t.' . $key] = 0;
788 }
789 $totalarray['val']['t.' . $key] += $object->$key;
790 }
791 }
792 }
793 // Extra fields
794 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
795 // Fields from hook
796 $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
797 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
798 print $hookmanager->resPrint;
799 // Other
800 $key = 'nb_of_values';
801 if (!empty($arrayfields[$key]['checked'])) {
802 print '<td class="center">';
803 print $obj->$key;
804 print '</td>';
805 if (!$i) {
806 $totalarray['nbfield']++;
807 }
808 }
809 $key = 'nb_products';
810 if (!empty($arrayfields[$key]['checked'])) {
811 print '<td class="center">';
812 print $obj->$key;
813 print '</td>';
814 if (!$i) {
815 $totalarray['nbfield']++;
816 }
817 }
818 // Action column
819 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
820 print '<td class="nowrap center">';
821 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
822 $selected = 0;
823 if (in_array($object->id, $arrayofselected)) {
824 $selected = 1;
825 }
826 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
827 }
828 print '</td>';
829 if (!$i) {
830 $totalarray['nbfield']++;
831 }
832 }
833 // Move
834 print '<td class="center linecolmove tdlineupdown">';
835 if ($i > 0) {
836 print '<a class="lineupdown" href="' . $_SERVER['PHP_SELF'] . '?action=up&amp;rowid=' . $obj->rowid . '">' . img_up('default', 0, 'imgupforline') . '</a>';
837 }
838 if ($i < $num - 1) {
839 print '<a class="lineupdown" href="' . $_SERVER['PHP_SELF'] . '?action=down&amp;rowid=' . $obj->rowid . '">' . img_down('default', 0, 'imgdownforline') . '</a>';
840 }
841 print '</td>';
842 if (!$i) {
843 $totalarray['nbfield']++;
844 }
845
846 print '</tr>' . "\n";
847 }
848
849 $i++;
850}
851
852// Show total line
853include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
854
855// If no record found
856if ($num == 0) {
857 $colspan = 1;
858 foreach ($arrayfields as $key => $val) {
859 if (!empty($val['checked'])) {
860 $colspan++;
861 }
862 }
863 $colspan++; // For the move column
864 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
865}
866
867$db->free($resql);
868
869$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
870$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
871print $hookmanager->resPrint;
872
873print '</table>'."\n";
874print '</div>'."\n";
875
876print '</form>'."\n";
877
878$forcereloadpage = getDolGlobalInt('MAIN_FORCE_RELOAD_PAGE');
879$tagidfortablednd = (empty($tagidfortablednd) ? 'tableattributes' : $tagidfortablednd);
880?>
881 <script>
882 $(document).ready(function(){
883 $(".imgupforline, .imgdownforline").hide();
884 $(".lineupdown").removeAttr('href');
885 $(".tdlineupdown")
886 .css("background-image", 'url(<?php echo DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/grip.png'; ?>)')
887 .css("background-repeat", "no-repeat")
888 .css("background-position", "center center")
889 .hover(
890 function () {
891 $(this).addClass('showDragHandle');
892 }, function () {
893 $(this).removeClass('showDragHandle');
894 }
895 );
896
897 $("#<?php echo $tagidfortablednd; ?>").tableDnD({
898 onDrop: function(table, row) {
899 console.log('onDrop variant .tableDnD');
900 $('#<?php echo $tagidfortablednd; ?> tr[data-element=extrafield]').attr('id', ''); // Set extrafields id to empty value in order to ignore them in tableDnDSerialize function
901 $('#<?php echo $tagidfortablednd; ?> tr[data-ignoreidfordnd=1]').attr('id', ''); // Set id to empty value in order to ignore them in tableDnDSerialize function
902 var reloadpage = "<?php echo $forcereloadpage; ?>";
903 var roworder = cleanSerialize(decodeURI($("#<?php echo $tagidfortablednd; ?>").tableDnDSerialize()));
904 $.post("<?php echo DOL_URL_ROOT; ?>/variants/ajax/orderAttribute.php",
905 {
906 roworder: roworder,
907 token: "<?php echo currentToken(); ?>"
908 },
909 function() {
910 if (reloadpage == 1) {
911 location.href = '<?php echo dol_escape_htmltag($_SERVER['PHP_SELF']).'?'.dol_escape_htmltag($_SERVER['QUERY_STRING']); ?>';
912 }
913 });
914 },
915 onDragClass: "dragClass",
916 dragHandle: "td.tdlineupdown"
917 });
918 });
919 </script>
920<?php
921
922if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
923 $hidegeneratedfilelistifempty = 1;
924 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
925 $hidegeneratedfilelistifempty = 0;
926 }
927
928 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
929 $formfile = new FormFile($db);
930
931 // Show list of available documents
932 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
933 $urlsource .= str_replace('&amp;', '&', $param);
934
935 $filedir = $diroutputmassaction;
936 $genallowed = $permissiontoread;
937 $delallowed = $permissiontoadd;
938
939 print $formfile->showdocuments('massfilesarea_productattribute', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
940}
941
942// End of page
943llxFooter();
944$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
$totalarray
Definition export.php:1216
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
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:73
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 ProductAttribute Used to represent a Product attribute Examples:
dol_now($mode='gmt')
Return date for now.
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, $allowothertags=array())
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.
img_down($titlealt='default', $selected=0, $moreclass='')
Show down arrow logo.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
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...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
img_up($titlealt='default', $selected=0, $moreclass='')
Show top arrow logo.
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...
treeview li table
No Email.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.