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