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