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