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