dolibarr  17.0.4
list.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
5  * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
6  * Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
7  * Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
8  * Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
9  * Copyright (C) 2019 Juanjo Menent <jmenent@2byte.es>
10  * Copyright (C) 2019-2021 Frédéric France <frederic.france@netlogic.fr>
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program. If not, see <https://www.gnu.org/licenses/>.
24  */
25 
32 // Load Dolibarr environment
33 require '../main.inc.php';
34 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
35 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
36 require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
37 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
38 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
39 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formexpensereport.class.php';
40 require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
41 require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_ik.class.php';
42 
43 // Load translation files required by the page
44 $langs->loadLangs(array('companies', 'users', 'trips'));
45 
46 $action = GETPOST('action', 'aZ09');
47 $massaction = GETPOST('massaction', 'alpha');
48 $show_files = GETPOST('show_files', 'int');
49 $confirm = GETPOST('confirm', 'alpha');
50 $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
51 $toselect = GETPOST('toselect', 'array');
52 $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'expensereportlist';
53 
54 $childids = $user->getAllChildIds(1);
55 
56 // Security check
57 $socid = GETPOST('socid', 'int');
58 if ($user->socid) {
59  $socid = $user->socid;
60 }
61 $result = restrictedArea($user, 'expensereport', '', '');
62 $id = GETPOST('id', 'int');
63 // If we are on the view of a specific user
64 if ($id > 0) {
65  $canread = 0;
66  if ($id == $user->id) {
67  $canread = 1;
68  }
69  if (!empty($user->rights->expensereport->readall)) {
70  $canread = 1;
71  }
72  if (!empty($user->rights->expensereport->lire) && in_array($id, $childids)) {
73  $canread = 1;
74  }
75  if (!$canread) {
77  }
78 }
79 
80 $diroutputmassaction = $conf->expensereport->dir_output.'/temp/massgeneration/'.$user->id;
81 
82 
83 // Load variable for pagination
84 $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
85 $sortfield = GETPOST('sortfield', 'aZ09comma');
86 $sortorder = GETPOST('sortorder', 'aZ09comma');
87 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
88 if (empty($page) || $page == -1) {
89  $page = 0;
90 } // If $page is not defined, or '' or -1
91 $offset = $limit * $page;
92 $pageprev = $page - 1;
93 $pagenext = $page + 1;
94 if (!$sortorder) {
95  $sortorder = "DESC";
96 }
97 if (!$sortfield) {
98  $sortfield = "d.date_debut";
99 }
100 
101 
102 $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
103 
104 $search_ref = GETPOST('search_ref', 'alpha');
105 $search_user = GETPOST('search_user', 'int');
106 $search_amount_ht = GETPOST('search_amount_ht', 'alpha');
107 $search_amount_vat = GETPOST('search_amount_vat', 'alpha');
108 $search_amount_ttc = GETPOST('search_amount_ttc', 'alpha');
109 $search_status = (GETPOST('search_status', 'intcomma') != '' ?GETPOST('search_status', 'intcomma') : GETPOST('statut', 'intcomma'));
110 
111 $search_date_startday = GETPOST('search_date_startday', 'int');
112 $search_date_startmonth = GETPOST('search_date_startmonth', 'int');
113 $search_date_startyear = GETPOST('search_date_startyear', 'int');
114 $search_date_startendday = GETPOST('search_date_startendday', 'int');
115 $search_date_startendmonth = GETPOST('search_date_startendmonth', 'int');
116 $search_date_startendyear = GETPOST('search_date_startendyear', 'int');
117 $search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
118 $search_date_startend = dol_mktime(23, 59, 59, $search_date_startendmonth, $search_date_startendday, $search_date_startendyear);
119 
120 $search_date_endday = GETPOST('search_date_endday', 'int');
121 $search_date_endmonth = GETPOST('search_date_endmonth', 'int');
122 $search_date_endyear = GETPOST('search_date_endyear', 'int');
123 $search_date_endendday = GETPOST('search_date_endendday', 'int');
124 $search_date_endendmonth = GETPOST('search_date_endendmonth', 'int');
125 $search_date_endendyear = GETPOST('search_date_endendyear', 'int');
126 $search_date_end = dol_mktime(0, 0, 0, $search_date_endmonth, $search_date_endday, $search_date_endyear); // Use tzserver
127 $search_date_endend = dol_mktime(23, 59, 59, $search_date_endendmonth, $search_date_endendday, $search_date_endendyear);
128 
129 $optioncss = GETPOST('optioncss', 'alpha');
130 
131 if ($search_status == '') {
132  $search_status = -1;
133 }
134 if ($search_user == '') {
135  $search_user = -1;
136 }
137 
138 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
139 $object = new ExpenseReport($db);
140 $hookmanager->initHooks(array('expensereportlist'));
141 $extrafields = new ExtraFields($db);
142 
143 // fetch optionals attributes and labels
144 $extrafields->fetch_name_optionals_label($object->table_element);
145 
146 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
147 
148 
149 // List of fields to search into when doing a "search in all"
150 $fieldstosearchall = array(
151  'd.ref'=>'Ref',
152  'd.note_public'=>"NotePublic",
153  'u.lastname'=>'EmployeeLastname',
154  'u.firstname'=>"EmployeeFirstname",
155  'u.login'=>"Login",
156 );
157 if (empty($user->socid)) {
158  $fieldstosearchall["d.note_private"] = "NotePrivate";
159 }
160 
161 $arrayfields = array(
162  'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
163  'user'=>array('label'=>$langs->trans("User"), 'checked'=>1),
164  'd.date_debut'=>array('label'=>$langs->trans("DateStart"), 'checked'=>1),
165  'd.date_fin'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1),
166  'd.date_valid'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>1),
167  'd.date_approve'=>array('label'=>$langs->trans("DateApprove"), 'checked'=>1),
168  'd.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1),
169  'd.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>1),
170  'd.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>1),
171  'd.date_create'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
172  'd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
173  'd.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
174 );
175 // Extra fields
176 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
177 
178 $canedituser = (!empty($user->admin) || $user->rights->user->user->creer);
179 
180 $objectuser = new User($db);
181 
182 
183 /*
184  * Actions
185  */
186 
187 if (GETPOST('cancel', 'alpha')) {
188  $action = 'list'; $massaction = '';
189 }
190 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
191  $massaction = '';
192 }
193 
194 $parameters = array('socid'=>$socid);
195 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
196 if ($reshook < 0) {
197  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
198 }
199 
200 if (empty($reshook)) {
201  // Selection of new fields
202  include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
203 
204  // Purge search criteria
205  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
206  $search_ref = "";
207  $search_user = "";
208  $search_amount_ht = "";
209  $search_amount_vat = "";
210  $search_amount_ttc = "";
211  $search_status = "";
212  $search_date_startday = '';
213  $search_date_startmonth = '';
214  $search_date_startyear = '';
215  $search_date_startendday = '';
216  $search_date_startendmonth = '';
217  $search_date_startendyear = '';
218  $search_date_start = '';
219  $search_date_startend = '';
220  $search_date_endday = '';
221  $search_date_endmonth = '';
222  $search_date_endyear = '';
223  $search_date_endendday = '';
224  $search_date_endendmonth = '';
225  $search_date_endendyear = '';
226  $search_date_end = '';
227  $search_date_endend = '';
228  $toselect = array();
229  $search_array_options = array();
230  }
231  if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
232  || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
233  $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
234  }
235 
236  // Mass actions
237  $objectclass = 'ExpenseReport';
238  $objectlabel = 'ExpenseReport';
239  $permissiontoread = $user->rights->expensereport->lire;
240  $permissiontodelete = $user->rights->expensereport->supprimer;
241  $uploaddir = $conf->expensereport->dir_output;
242  include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
243 }
244 
245 
246 /*
247  * View
248  */
249 
250 $form = new Form($db);
251 $formother = new FormOther($db);
252 $formfile = new FormFile($db);
253 $formexpensereport = new FormExpenseReport($db);
254 
255 $fuser = new User($db);
256 
257 $title = $langs->trans("TripsAndExpenses");
258 llxHeader('', $title);
259 
260 $max_year = 5;
261 $min_year = 10;
262 
263 // Get current user id
264 $user_id = $user->id;
265 
266 if ($id > 0) {
267  // Charge utilisateur edite
268  $fuser->fetch($id, '', '', 1);
269  $fuser->getrights();
270  $user_id = $fuser->id;
271 
272  $search_user = $user_id;
273 }
274 
275 $sql = "SELECT d.rowid, d.ref, d.fk_user_author, d.total_ht, d.total_tva, d.total_ttc, d.fk_statut as status,";
276 $sql .= " d.date_debut, d.date_fin, d.date_create, d.tms as date_modif, d.date_valid, d.date_approve, d.note_private, d.note_public,";
277 $sql .= " u.rowid as id_user, u.firstname, u.lastname, u.login, u.email, u.statut, u.photo";
278 // Add fields from extrafields
279 if (!empty($extrafields->attributes[$object->table_element]['label'])) {
280  foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
281  $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
282  }
283 }
284 // Add fields from hooks
285 $parameters = array();
286 $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
287 $sql .= $hookmanager->resPrint;
288 
289 $sqlfields = $sql; // $sql fields to remove for count total
290 
291 $sql .= " FROM ".MAIN_DB_PREFIX."expensereport as d";
292 if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
293  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (d.rowid = ef.fk_object)";
294 }
295 $sql .= ", ".MAIN_DB_PREFIX."user as u";
296 $sql .= " WHERE d.fk_user_author = u.rowid AND d.entity IN (".getEntity('expensereport').")";
297 // Search all
298 if (!empty($sall)) {
299  $sql .= natural_search(array_keys($fieldstosearchall), $sall);
300 }
301 // Ref
302 if (!empty($search_ref)) {
303  $sql .= natural_search('d.ref', $search_ref);
304 }
305 // Date Start
306 if ($search_date_start) {
307  $sql .= " AND d.date_debut >= '".$db->idate($search_date_start)."'";
308 }
309 if ($search_date_startend) {
310  $sql .= " AND d.date_debut <= '".$db->idate($search_date_startend)."'";
311 }
312 // Date End
313 if ($search_date_end) {
314  $sql .= " AND d.date_fin >= '".$db->idate($search_date_end)."'";
315 }
316 if ($search_date_endend) {
317  $sql .= " AND d.date_fin <= '".$db->idate($search_date_endend)."'";
318 }
319 
320 if ($search_amount_ht != '') {
321  $sql .= natural_search('d.total_ht', $search_amount_ht, 1);
322 }
323 if ($search_amount_ttc != '') {
324  $sql .= natural_search('d.total_ttc', $search_amount_ttc, 1);
325 }
326 // User
327 if ($search_user != '' && $search_user >= 0) {
328  $sql .= " AND u.rowid = '".$db->escape($search_user)."'";
329 }
330 // Status
331 if ($search_status != '' && $search_status >= 0) {
332  $sql .= " AND d.fk_statut IN (".$db->sanitize($search_status).")";
333 }
334 // RESTRICT RIGHTS
335 if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)
336  && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->expensereport->writeall_advance))) {
337  $sql .= " AND d.fk_user_author IN (".$db->sanitize(join(',', $childids)).")\n";
338 }
339 // Add where from extra fields
340 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
341 // Add where from hooks
342 $parameters = array();
343 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
344 $sql .= $hookmanager->resPrint;
345 
346 // Count total nb of records
347 $nbtotalofrecords = '';
348 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
349  /* The fast and low memory method to get and count full list converts the sql into a sql count */
350  $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
351  $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
352  $resql = $db->query($sqlforcount);
353  if ($resql) {
354  $objforcount = $db->fetch_object($resql);
355  $nbtotalofrecords = $objforcount->nbtotalofrecords;
356  } else {
357  dol_print_error($db);
358  }
359 
360  if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
361  $page = 0;
362  $offset = 0;
363  }
364  $db->free($resql);
365 }
366 
367 // Complete request and execute it with limit
368 $sql .= $db->order($sortfield, $sortorder);
369 if ($limit) {
370  $sql .= $db->plimit($limit + 1, $offset);
371 }
372 
373 //print $sql;
374 $resql = $db->query($sql);
375 if ($resql) {
376  $num = $db->num_rows($resql);
377 
378  $arrayofselected = is_array($toselect) ? $toselect : array();
379 
380  $param = '';
381  if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
382  $param .= '&contextpage='.urlencode($contextpage);
383  }
384  if ($limit > 0 && $limit != $conf->liste_limit) {
385  $param .= '&limit='.urlencode($limit);
386  }
387  if ($sall) {
388  $param .= "&sall=".urlencode($sall);
389  }
390  if ($search_ref) {
391  $param .= "&search_ref=".urlencode($search_ref);
392  }
393  // Start date
394  if ($search_date_startday) {
395  $param .= '&search_date_startday='.urlencode($search_date_startday);
396  }
397  if ($search_date_startmonth) {
398  $param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
399  }
400  if ($search_date_startyear) {
401  $param .= '&search_date_startyear='.urlencode($search_date_startyear);
402  }
403  if ($search_date_startendday) {
404  $param .= '&search_date_startendday='.urlencode($search_date_startendday);
405  }
406  if ($search_date_startendmonth) {
407  $param .= '&search_date_startendmonth='.urlencode($search_date_startendmonth);
408  }
409  if ($search_date_startendyear) {
410  $param .= '&search_date_startendyear='.urlencode($search_date_startendyear);
411  }
412  // End date
413  if ($search_date_endday) {
414  $param .= '&search_date_endday='.urlencode($search_date_endday);
415  }
416  if ($search_date_endmonth) {
417  $param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
418  }
419  if ($search_date_endyear) {
420  $param .= '&search_date_endyear='.urlencode($search_date_endyear);
421  }
422  if ($search_date_endendday) {
423  $param .= '&search_date_endendday='.urlencode($search_date_endendday);
424  }
425  if ($search_date_endendmonth) {
426  $param .= '&search_date_endendmonth='.urlencode($search_date_endendmonth);
427  }
428  if ($search_date_endendyear) {
429  $param .= '&search_date_endendyear='.urlencode($search_date_endendyear);
430  }
431  if ($search_user) {
432  $param .= "&search_user=".urlencode($search_user);
433  }
434  if ($search_amount_ht) {
435  $param .= "&search_amount_ht=".urlencode($search_amount_ht);
436  }
437  if ($search_amount_ttc) {
438  $param .= "&search_amount_ttc=".urlencode($search_amount_ttc);
439  }
440  if ($search_status >= 0) {
441  $param .= "&search_status=".urlencode($search_status);
442  }
443  if ($optioncss != '') {
444  $param .= '&optioncss='.urlencode($optioncss);
445  }
446  // Add $param from extra fields
447  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
448 
449  // List of mass actions available
450  $arrayofmassactions = array(
451  'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
452  'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
453  'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
454  );
455  if ($user->rights->expensereport->supprimer) {
456  $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
457  }
458  if (in_array($massaction, array('presend', 'predelete'))) {
459  $arrayofmassactions = array();
460  }
461  $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
462 
463  // Lines of title fields
464  print '<form id="searchFormList" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
465  if ($optioncss != '') {
466  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
467  }
468  print '<input type="hidden" name="token" value="'.newToken().'">';
469  print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
470  print '<input type="hidden" name="action" value="'.($action == 'edit' ? 'update' : 'list').'">';
471  print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
472  print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
473  print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
474  if ($id > 0) {
475  print '<input type="hidden" name="id" value="'.$id.'">';
476  }
477 
478  if ($id > 0) { // For user tab
479  $title = $langs->trans("User");
480  $linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
481  $head = user_prepare_head($fuser);
482 
483  print dol_get_fiche_head($head, 'expensereport', $title, -1, 'user');
484 
485  dol_banner_tab($fuser, 'id', $linkback, $user->rights->user->user->lire || $user->admin);
486 
487  print dol_get_fiche_end();
488 
489  if ($action != 'edit') {
490  print '<div class="tabsAction">';
491 
492  $childids = $user->getAllChildIds(1);
493 
494  $canedit = ((in_array($user_id, $childids) && $user->rights->expensereport->creer)
495  || ($conf->global->MAIN_USE_ADVANCED_PERMS && $user->rights->expensereport->writeall_advance));
496 
497  // Buttons for actions
498  if ($canedit) {
499  print '<a href="'.DOL_URL_ROOT.'/expensereport/card.php?action=create&fk_user_author='.$fuser->id.'" class="butAction">'.$langs->trans("AddTrip").'</a>';
500  } else {
501  print '<a href="#" class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("AddTrip").'</a>';
502  }
503 
504  print '</div>';
505  } else {
506  print $form->buttonsSaveCancel("Save", '');
507  }
508  } else {
509  $title = $langs->trans("ListTripsAndExpenses");
510 
511  $url = DOL_URL_ROOT.'/expensereport/card.php?action=create';
512  if (!empty($socid)) {
513  $url .= '&socid='.$socid;
514  }
515  $newcardbutton = dolGetButtonTitle($langs->trans('NewTrip'), '', 'fa fa-plus-circle', $url, '', $user->rights->expensereport->creer);
516 
517  print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'trip', 0, $newcardbutton, '', $limit, 0, 0, 1);
518  }
519 
520  $topicmail = "SendExpenseReport";
521  $modelmail = "expensereport";
522  $objecttmp = new ExpenseReport($db);
523  $trackid = 'exp'.$object->id;
524  include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
525 
526  if ($sall) {
527  foreach ($fieldstosearchall as $key => $val) {
528  $fieldstosearchall[$key] = $langs->trans($val);
529  }
530  print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
531  }
532 
533  $moreforfilter = '';
534 
535  $parameters = array();
536  $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
537  if (empty($reshook)) {
538  $moreforfilter .= $hookmanager->resPrint;
539  } else {
540  $moreforfilter = $hookmanager->resPrint;
541  }
542 
543  if (!empty($moreforfilter)) {
544  print '<div class="liste_titre liste_titre_bydiv centpercent">';
545  print $moreforfilter;
546  print '</div>';
547  }
548 
549  $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
550  $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields
551  $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
552 
553  print '<div class="div-table-responsive">';
554  print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
555 
556  // Filters
557  print '<tr class="liste_titre_filter">';
558  // Action column
559  if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
560  print '<td class="liste_titre maxwidthsearch">';
561  $searchpicto = $form->showFilterButtons('left');
562  print $searchpicto;
563  print '</td>';
564  }
565  if (!empty($arrayfields['d.ref']['checked'])) {
566  print '<td class="liste_titre" align="left">';
567  print '<input class="flat" size="15" type="text" name="search_ref" value="'.$search_ref.'">';
568  print '</td>';
569  }
570  // User
571  if (!empty($arrayfields['user']['checked'])) {
572  if ($user->rights->expensereport->readall || $user->rights->expensereport->lire_tous) {
573  print '<td class="liste_titre maxwidthonspartphone" align="left">';
574  print $form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200');
575  print '</td>';
576  } else {
577  print '<td class="liste_titre">&nbsp;</td>';
578  }
579  }
580  // Date start
581  if (!empty($arrayfields['d.date_debut']['checked'])) {
582  print '<td class="liste_titre" align="center">';
583  print '<div class="nowrap">';
584  print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
585  print '</div>';
586  print '<div class="nowrap">';
587  print $form->selectDate($search_date_startend ? $search_date_startend : -1, 'search_date_startend', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
588  print '</div>';
589  print '</td>';
590  }
591  // Date end
592  if (!empty($arrayfields['d.date_fin']['checked'])) {
593  print '<td class="liste_titre" align="center">';
594  print '<div class="nowrap">';
595  print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
596  print '</div>';
597  print '<div class="nowrap">';
598  print $form->selectDate($search_date_endend ? $search_date_endend : -1, 'search_date_endend', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
599  print '</div>';
600  print '</td>';
601  }
602  // Date valid
603  if (!empty($arrayfields['d.date_valid']['checked'])) {
604  print '<td class="liste_titre" align="center">';
605  //print '<input class="flat" type="text" size="1" maxlength="2" name="month_end" value="'.$month_end.'">';
606  //print $formother->selectyear($year_end,'year_end',1, $min_year, $max_year);
607  print '</td>';
608  }
609  // Date approve
610  if (!empty($arrayfields['d.date_approve']['checked'])) {
611  print '<td class="liste_titre" align="center">';
612  //print '<input class="flat" type="text" size="1" maxlength="2" name="month_end" value="'.$month_end.'">';
613  //print $formother->selectyear($year_end,'year_end',1, $min_year, $max_year);
614  print '</td>';
615  }
616  // Amount with no tax
617  if (!empty($arrayfields['d.total_ht']['checked'])) {
618  print '<td class="liste_titre right"><input class="flat" type="text" size="5" name="search_amount_ht" value="'.$search_amount_ht.'"></td>';
619  }
620  if (!empty($arrayfields['d.total_vat']['checked'])) {
621  print '<td class="liste_titre right"><input class="flat" type="text" size="5" name="search_amount_vat" value="'.$search_amount_vat.'"></td>';
622  }
623  // Amount with all taxes
624  if (!empty($arrayfields['d.total_ttc']['checked'])) {
625  print '<td class="liste_titre right"><input class="flat" type="text" size="5" name="search_amount_ttc" value="'.$search_amount_ttc.'"></td>';
626  }
627  // Extra fields
628  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
629 
630  // Fields from hook
631  $parameters = array('arrayfields'=>$arrayfields);
632  $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
633  print $hookmanager->resPrint;
634  // Date creation
635  if (!empty($arrayfields['d.date_create']['checked'])) {
636  print '<td class="liste_titre">';
637  print '</td>';
638  }
639  // Date modification
640  if (!empty($arrayfields['d.tms']['checked'])) {
641  print '<td class="liste_titre">';
642  print '</td>';
643  }
644  // Status
645  if (!empty($arrayfields['d.fk_statut']['checked'])) {
646  print '<td class="liste_titre right">';
647  $formexpensereport->selectExpensereportStatus($search_status, 'search_status', 1, 1);
648  print '</td>';
649  }
650  // Action column
651  if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
652  print '<td class="liste_titre maxwidthsearch">';
653  $searchpicto = $form->showFilterButtons();
654  print $searchpicto;
655  print '</td>';
656  }
657 
658  print "</tr>\n";
659 
660  print '<tr class="liste_titre">';
661  if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
662  print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
663  }
664  if (!empty($arrayfields['d.ref']['checked'])) {
665  print_liste_field_titre($arrayfields['d.ref']['label'], $_SERVER["PHP_SELF"], "d.ref", "", $param, '', $sortfield, $sortorder);
666  }
667  if (!empty($arrayfields['user']['checked'])) {
668  print_liste_field_titre($arrayfields['user']['label'], $_SERVER["PHP_SELF"], "u.lastname", "", $param, '', $sortfield, $sortorder);
669  }
670  if (!empty($arrayfields['d.date_debut']['checked'])) {
671  print_liste_field_titre($arrayfields['d.date_debut']['label'], $_SERVER["PHP_SELF"], "d.date_debut", "", $param, 'align="center"', $sortfield, $sortorder);
672  }
673  if (!empty($arrayfields['d.date_fin']['checked'])) {
674  print_liste_field_titre($arrayfields['d.date_fin']['label'], $_SERVER["PHP_SELF"], "d.date_fin", "", $param, 'align="center"', $sortfield, $sortorder);
675  }
676  if (!empty($arrayfields['d.date_valid']['checked'])) {
677  print_liste_field_titre($arrayfields['d.date_valid']['label'], $_SERVER["PHP_SELF"], "d.date_valid", "", $param, 'align="center"', $sortfield, $sortorder);
678  }
679  if (!empty($arrayfields['d.date_approve']['checked'])) {
680  print_liste_field_titre($arrayfields['d.date_approve']['label'], $_SERVER["PHP_SELF"], "d.date_approve", "", $param, 'align="center"', $sortfield, $sortorder);
681  }
682  if (!empty($arrayfields['d.total_ht']['checked'])) {
683  print_liste_field_titre($arrayfields['d.total_ht']['label'], $_SERVER["PHP_SELF"], "d.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
684  }
685  if (!empty($arrayfields['d.total_vat']['checked'])) {
686  print_liste_field_titre($arrayfields['d.total_vat']['label'], $_SERVER["PHP_SELF"], "d.total_tva", "", $param, 'align="right"', $sortfield, $sortorder);
687  }
688  if (!empty($arrayfields['d.total_ttc']['checked'])) {
689  print_liste_field_titre($arrayfields['d.total_ttc']['label'], $_SERVER["PHP_SELF"], "d.total_ttc", "", $param, 'align="right"', $sortfield, $sortorder);
690  }
691  // Extra fields
692  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
693  // Hook fields
694  $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
695  $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
696  print $hookmanager->resPrint;
697  if (!empty($arrayfields['d.date_create']['checked'])) {
698  print_liste_field_titre($arrayfields['d.date_create']['label'], $_SERVER["PHP_SELF"], "d.date_create", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
699  }
700  if (!empty($arrayfields['d.tms']['checked'])) {
701  print_liste_field_titre($arrayfields['d.tms']['label'], $_SERVER["PHP_SELF"], "d.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
702  }
703  if (!empty($arrayfields['d.fk_statut']['checked'])) {
704  print_liste_field_titre($arrayfields['d.fk_statut']['label'], $_SERVER["PHP_SELF"], "d.fk_statut", "", $param, 'align="right"', $sortfield, $sortorder);
705  }
706  if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
707  print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
708  }
709  print "</tr>\n";
710 
711  $total_total_ht = 0;
712  $total_total_ttc = 0;
713  $total_total_tva = 0;
714 
715  $expensereportstatic = new ExpenseReport($db);
716  $usertmp = new User($db);
717 
718  if ($num > 0) {
719  $i = 0;
720  $totalarray = array();
721  $totalarray['nbfield'] = 0;
722  $totalarray['val'] = array();
723  $totalarray['val']['d.total_ht'] = 0;
724  $totalarray['val']['d.total_tva'] = 0;
725  $totalarray['val']['d.total_ttc'] = 0;
726  $totalarray['totalizable'] = array();
727  while ($i < min($num, $limit)) {
728  $obj = $db->fetch_object($resql);
729 
730  $expensereportstatic->id = $obj->rowid;
731  $expensereportstatic->ref = $obj->ref;
732  $expensereportstatic->status = $obj->status;
733  $expensereportstatic->date_debut = $db->jdate($obj->date_debut);
734  $expensereportstatic->date_fin = $db->jdate($obj->date_fin);
735  $expensereportstatic->date_create = $db->jdate($obj->date_create);
736  $expensereportstatic->date_modif = $db->jdate($obj->date_modif);
737  $expensereportstatic->date_valid = $db->jdate($obj->date_valid);
738  $expensereportstatic->date_approve = $db->jdate($obj->date_approve);
739  $expensereportstatic->note_private = $obj->note_private;
740  $expensereportstatic->note_public = $obj->note_public;
741 
742 
743  print '<tr class="oddeven">';
744  // Action column
745  if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
746  print '<td class="nowrap center">';
747  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
748  $selected = 0;
749  if (in_array($obj->rowid, $arrayofselected)) {
750  $selected = 1;
751  }
752  print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
753  }
754  print '</td>';
755  }
756  // Ref
757  if (!empty($arrayfields['d.ref']['checked'])) {
758  print '<td>';
759  print '<table class="nobordernopadding"><tr class="nocellnopadd">';
760  print '<td class="nobordernopadding nowrap">';
761  print $expensereportstatic->getNomUrl(1);
762  print '</td>';
763  // Warning late icon and note
764  print '<td class="nobordernopadding nowrap">';
765  if ($expensereportstatic->status == 2 && $expensereportstatic->hasDelay('toappove')) {
766  print img_warning($langs->trans("Late"));
767  }
768  if ($expensereportstatic->status == 5 && $expensereportstatic->hasDelay('topay')) {
769  print img_warning($langs->trans("Late"));
770  }
771  if (!empty($obj->note_private) || !empty($obj->note_public)) {
772  print ' <span class="note">';
773  print '<a href="'.DOL_URL_ROOT.'/expensereport/note.php?id='.$obj->rowid.'">'.img_picto($langs->trans("ViewPrivateNote"), 'object_generic').'</a>';
774  print '</span>';
775  }
776  print '</td>';
777  print '<td width="16" class="nobordernopadding hideonsmartphone right">';
778  $filename = dol_sanitizeFileName($obj->ref);
779  $filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($obj->ref);
780  $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid;
781  print $formfile->getDocumentsLink($expensereportstatic->element, $filename, $filedir);
782  print '</td>';
783  print '</tr></table>';
784  print '</td>';
785  if (!$i) {
786  $totalarray['nbfield']++;
787  }
788  }
789  // User
790  if (!empty($arrayfields['user']['checked'])) {
791  print '<td class="left">';
792  $usertmp->id = $obj->id_user;
793  $usertmp->lastname = $obj->lastname;
794  $usertmp->firstname = $obj->firstname;
795  $usertmp->login = $obj->login;
796  $usertmp->statut = $obj->statut;
797  $usertmp->photo = $obj->photo;
798  $usertmp->email = $obj->email;
799  print $usertmp->getNomUrl(-1);
800  print '</td>';
801  if (!$i) {
802  $totalarray['nbfield']++;
803  }
804  }
805  // Start date
806  if (!empty($arrayfields['d.date_debut']['checked'])) {
807  print '<td class="center">'.($obj->date_debut > 0 ? dol_print_date($db->jdate($obj->date_debut), 'day') : '').'</td>';
808  if (!$i) {
809  $totalarray['nbfield']++;
810  }
811  }
812  // End date
813  if (!empty($arrayfields['d.date_fin']['checked'])) {
814  print '<td class="center">'.($obj->date_fin > 0 ? dol_print_date($db->jdate($obj->date_fin), 'day') : '').'</td>';
815  if (!$i) {
816  $totalarray['nbfield']++;
817  }
818  }
819  // Date validation
820  if (!empty($arrayfields['d.date_valid']['checked'])) {
821  print '<td class="center">'.($obj->date_valid > 0 ? dol_print_date($db->jdate($obj->date_valid), 'day') : '').'</td>';
822  if (!$i) {
823  $totalarray['nbfield']++;
824  }
825  }
826  // Date approval
827  if (!empty($arrayfields['d.date_approve']['checked'])) {
828  print '<td class="center">'.($obj->date_approve > 0 ? dol_print_date($db->jdate($obj->date_approve), 'day') : '').'</td>';
829  if (!$i) {
830  $totalarray['nbfield']++;
831  }
832  }
833  // Amount HT
834  if (!empty($arrayfields['d.total_ht']['checked'])) {
835  print '<td class="right">'.price($obj->total_ht)."</td>\n";
836  if (!$i) {
837  $totalarray['nbfield']++;
838  }
839  if (!$i) {
840  $totalarray['pos'][$totalarray['nbfield']] = 'd.total_ht';
841  }
842  $totalarray['val']['d.total_ht'] += $obj->total_ht;
843  }
844  // Amount VAT
845  if (!empty($arrayfields['d.total_vat']['checked'])) {
846  print '<td class="right">'.price($obj->total_tva)."</td>\n";
847  if (!$i) {
848  $totalarray['nbfield']++;
849  }
850  if (!$i) {
851  $totalarray['pos'][$totalarray['nbfield']] = 'd.total_tva';
852  }
853  $totalarray['val']['d.total_tva'] += $obj->total_tva;
854  }
855  // Amount TTC
856  if (!empty($arrayfields['d.total_ttc']['checked'])) {
857  print '<td class="right">'.price($obj->total_ttc)."</td>\n";
858  if (!$i) {
859  $totalarray['nbfield']++;
860  }
861  if (!$i) {
862  $totalarray['pos'][$totalarray['nbfield']] = 'd.total_ttc';
863  }
864  $totalarray['val']['d.total_ttc'] += $obj->total_ttc;
865  }
866 
867  // Extra fields
868  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
869  // Fields from hook
870  $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
871  $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
872  print $hookmanager->resPrint;
873 
874  // Date creation
875  if (!empty($arrayfields['d.date_create']['checked'])) {
876  print '<td class="nowrap center">';
877  print dol_print_date($db->jdate($obj->date_create), 'dayhour');
878  print '</td>';
879  if (!$i) {
880  $totalarray['nbfield']++;
881  }
882  }
883  // Date modification
884  if (!empty($arrayfields['d.tms']['checked'])) {
885  print '<td class="nowrap center">';
886  print dol_print_date($db->jdate($obj->date_modif), 'dayhour');
887  print '</td>';
888  if (!$i) {
889  $totalarray['nbfield']++;
890  }
891  }
892  // Status
893  if (!empty($arrayfields['d.fk_statut']['checked'])) {
894  print '<td class="nowrap right">'.$expensereportstatic->getLibStatut(5).'</td>';
895  if (!$i) {
896  $totalarray['nbfield']++;
897  }
898  }
899  // Action column
900  if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
901  print '<td class="nowrap center">';
902  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
903  $selected = 0;
904  if (in_array($obj->rowid, $arrayofselected)) {
905  $selected = 1;
906  }
907  print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
908  }
909  print '</td>';
910  }
911  if (!$i) {
912  $totalarray['nbfield']++;
913  }
914 
915  print "</tr>\n";
916 
917  $total_total_ht = $total_total_ht + $obj->total_ht;
918  $total_total_tva = $total_total_tva + $obj->total_tva;
919  $total_total_ttc = $total_total_ttc + $obj->total_ttc;
920 
921  $i++;
922  }
923  } else {
924  $colspan = 1;
925  foreach ($arrayfields as $key => $val) {
926  if (!empty($val['checked'])) {
927  $colspan++;
928  }
929  }
930  print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
931  }
932 
933  // Show total line
934  include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
935 
936  $db->free($resql);
937 
938  $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
939  $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
940  print $hookmanager->resPrint;
941 
942  print '</table>'."\n";
943  print '</div>';
944 
945  print '</form>'."\n";
946 
947  if (empty($id)) {
948  $hidegeneratedfilelistifempty = 1;
949  if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
950  $hidegeneratedfilelistifempty = 0;
951  }
952 
953  // Show list of available documents
954  $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
955  $urlsource .= str_replace('&amp;', '&', $param);
956 
957  $filedir = $diroutputmassaction;
958  $genallowed = $user->rights->expensereport->lire;
959  $delallowed = $user->rights->expensereport->creer;
960 
961  print $formfile->showdocuments('massfilesarea_expensereport', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
962  }
963 } else {
964  dol_print_error($db);
965 }
966 
967 // End of page
968 llxFooter();
969 $db->close();
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 manage Trips and Expenses.
Class to manage standard extra fields.
Class to manage generation of HTML components for contract module.
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
Classe permettant la generation de composants html autre Only common components are here.
Class to manage Dolibarr users.
Definition: user.class.php:47
if(isModEnabled('facture') &&!empty($user->rights->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') &&!empty($user->rights->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)) $resql
Social contributions to pay.
Definition: index.php:745
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
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_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
$nbtotalofrecords
Count total nb of records.
Definition: list.php:329
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
user_prepare_head(User $object)
Prepare array with list of tabs.