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