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