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