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-2021 Frédéric France <frederic.france@netlogic.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 $parameters = array();
581 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
582 print $hookmanager->resPrint;
583 print '</div>';
584}
585
586$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
587$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup
588$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
589$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
590
591print '<div class="div-table-responsive">';
592print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
593
594// Fields title search
595// --------------------------------------------------------------------
596print '<tr class="liste_titre_filter">';
597// Action column
598if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
599 print '<td class="liste_titre center maxwidthsearch">';
600 $searchpicto = $form->showFilterButtons('left');
601 print $searchpicto;
602 print '</td>';
603}
604if (!empty($arrayfields['d.ref']['checked'])) {
605 print '<td class="liste_titre" align="left">';
606 print '<input class="flat" size="15" type="text" name="search_ref" value="'.$search_ref.'">';
607 print '</td>';
608}
609// User
610if (!empty($arrayfields['user']['checked'])) {
611 if ($user->hasRight('expensereport', 'readall') || $user->hasRight('expensereport', 'lire_tous')) {
612 print '<td class="liste_titre maxwidthonspartphone" align="left">';
613 print $form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200');
614 print '</td>';
615 } else {
616 print '<td class="liste_titre">&nbsp;</td>';
617 }
618}
619// Date start
620if (!empty($arrayfields['d.date_debut']['checked'])) {
621 print '<td class="liste_titre" align="center">';
622 print '<div class="nowrapfordate">';
623 print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
624 print '</div>';
625 print '<div class="nowrapfordate">';
626 print $form->selectDate($search_date_startend ? $search_date_startend : -1, 'search_date_startend', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
627 print '</div>';
628 print '</td>';
629}
630// Date end
631if (!empty($arrayfields['d.date_fin']['checked'])) {
632 print '<td class="liste_titre" align="center">';
633 print '<div class="nowrapfordate">';
634 print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
635 print '</div>';
636 print '<div class="nowrapfordate">';
637 print $form->selectDate($search_date_endend ? $search_date_endend : -1, 'search_date_endend', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
638 print '</div>';
639 print '</td>';
640}
641// Date valid
642if (!empty($arrayfields['d.date_valid']['checked'])) {
643 print '<td class="liste_titre" align="center">';
644 //print '<input class="flat" type="text" size="1" maxlength="2" name="month_end" value="'.$month_end.'">';
645 //print $formother->selectyear($year_end,'year_end',1, $min_year, $max_year);
646 print '</td>';
647}
648// Date approve
649if (!empty($arrayfields['d.date_approve']['checked'])) {
650 print '<td class="liste_titre" align="center">';
651 //print '<input class="flat" type="text" size="1" maxlength="2" name="month_end" value="'.$month_end.'">';
652 //print $formother->selectyear($year_end,'year_end',1, $min_year, $max_year);
653 print '</td>';
654}
655// Amount with no tax
656if (!empty($arrayfields['d.total_ht']['checked'])) {
657 print '<td class="liste_titre right"><input class="flat" type="text" size="5" name="search_amount_ht" value="'.$search_amount_ht.'"></td>';
658}
659if (!empty($arrayfields['d.total_vat']['checked'])) {
660 print '<td class="liste_titre right"><input class="flat" type="text" size="5" name="search_amount_vat" value="'.$search_amount_vat.'"></td>';
661}
662// Amount with all taxes
663if (!empty($arrayfields['d.total_ttc']['checked'])) {
664 print '<td class="liste_titre right"><input class="flat" type="text" size="5" name="search_amount_ttc" value="'.$search_amount_ttc.'"></td>';
665}
666// Extra fields
667include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
668
669// Fields from hook
670$parameters = array('arrayfields' => $arrayfields);
671$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
672print $hookmanager->resPrint;
673// Date creation
674if (!empty($arrayfields['d.date_create']['checked'])) {
675 print '<td class="liste_titre">';
676 print '</td>';
677}
678// Date modification
679if (!empty($arrayfields['d.tms']['checked'])) {
680 print '<td class="liste_titre">';
681 print '</td>';
682}
683// Status
684if (!empty($arrayfields['d.fk_statut']['checked'])) {
685 print '<td class="liste_titre center parentonrightofpage">';
686 print $formexpensereport->selectExpensereportStatus($search_status, 'search_status', 1, 1, 'search_status width100 onrightofpage');
687 print '</td>';
688}
689// Action column
690if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
691 print '<td class="liste_titre center maxwidthsearch">';
692 $searchpicto = $form->showFilterButtons();
693 print $searchpicto;
694 print '</td>';
695}
696
697print '</tr>'."\n";
698
699$totalarray = array();
700$totalarray['nbfield'] = 0;
701
702// Fields title label
703// --------------------------------------------------------------------
704print '<tr class="liste_titre">';
705if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
706 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ');
707 $totalarray['nbfield']++;
708}
709if (!empty($arrayfields['d.ref']['checked'])) {
710 print_liste_field_titre($arrayfields['d.ref']['label'], $_SERVER["PHP_SELF"], "d.ref", "", $param, '', $sortfield, $sortorder);
711 $totalarray['nbfield']++;
712}
713if (!empty($arrayfields['user']['checked'])) {
714 print_liste_field_titre($arrayfields['user']['label'], $_SERVER["PHP_SELF"], "u.lastname", "", $param, '', $sortfield, $sortorder);
715 $totalarray['nbfield']++;
716}
717if (!empty($arrayfields['d.date_debut']['checked'])) {
718 print_liste_field_titre($arrayfields['d.date_debut']['label'], $_SERVER["PHP_SELF"], "d.date_debut", "", $param, '', $sortfield, $sortorder, 'center ');
719 $totalarray['nbfield']++;
720}
721if (!empty($arrayfields['d.date_fin']['checked'])) {
722 print_liste_field_titre($arrayfields['d.date_fin']['label'], $_SERVER["PHP_SELF"], "d.date_fin", "", $param, '', $sortfield, $sortorder, 'center ');
723 $totalarray['nbfield']++;
724}
725if (!empty($arrayfields['d.date_valid']['checked'])) {
726 print_liste_field_titre($arrayfields['d.date_valid']['label'], $_SERVER["PHP_SELF"], "d.date_valid", "", $param, '', $sortfield, $sortorder, 'center ');
727 $totalarray['nbfield']++;
728}
729if (!empty($arrayfields['d.date_approve']['checked'])) {
730 print_liste_field_titre($arrayfields['d.date_approve']['label'], $_SERVER["PHP_SELF"], "d.date_approve", "", $param, '', $sortfield, $sortorder, 'center ');
731 $totalarray['nbfield']++;
732}
733if (!empty($arrayfields['d.total_ht']['checked'])) {
734 print_liste_field_titre($arrayfields['d.total_ht']['label'], $_SERVER["PHP_SELF"], "d.total_ht", "", $param, '', $sortfield, $sortorder, 'right ');
735 $totalarray['nbfield']++;
736}
737if (!empty($arrayfields['d.total_vat']['checked'])) {
738 print_liste_field_titre($arrayfields['d.total_vat']['label'], $_SERVER["PHP_SELF"], "d.total_tva", "", $param, '', $sortfield, $sortorder, 'right ');
739 $totalarray['nbfield']++;
740}
741if (!empty($arrayfields['d.total_ttc']['checked'])) {
742 print_liste_field_titre($arrayfields['d.total_ttc']['label'], $_SERVER["PHP_SELF"], "d.total_ttc", "", $param, '', $sortfield, $sortorder, 'right ');
743 $totalarray['nbfield']++;
744}
745// Extra fields
746include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
747// Hook fields
748$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
749$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
750print $hookmanager->resPrint;
751if (!empty($arrayfields['d.date_create']['checked'])) {
752 print_liste_field_titre($arrayfields['d.date_create']['label'], $_SERVER["PHP_SELF"], "d.date_create", "", $param, '', $sortfield, $sortorder, 'nowraponall center');
753 $totalarray['nbfield']++;
754}
755if (!empty($arrayfields['d.tms']['checked'])) {
756 print_liste_field_titre($arrayfields['d.tms']['label'], $_SERVER["PHP_SELF"], "d.tms", "", $param, '', $sortfield, $sortorder, 'nowraponall center');
757 $totalarray['nbfield']++;
758}
759if (!empty($arrayfields['d.fk_statut']['checked'])) {
760 print_liste_field_titre($arrayfields['d.fk_statut']['label'], $_SERVER["PHP_SELF"], "d.fk_statut", "", $param, '', $sortfield, $sortorder, 'center ');
761 $totalarray['nbfield']++;
762}
763if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
764 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
765 $totalarray['nbfield']++;
766}
767print '</tr>'."\n";
768
769
770// Loop on record
771// --------------------------------------------------------------------
772
773$total_total_ht = 0;
774$total_total_ttc = 0;
775$total_total_tva = 0;
776
777$expensereportstatic = new ExpenseReport($db);
778$usertmp = new User($db);
779
780if ($num > 0) {
781 $i = 0;
782 $savnbfield = $totalarray['nbfield'];
783 $totalarray = array();
784 $totalarray['nbfield'] = 0;
785 $totalarray['val'] = array();
786 $totalarray['val']['d.total_ht'] = 0;
787 $totalarray['val']['d.total_tva'] = 0;
788 $totalarray['val']['d.total_ttc'] = 0;
789 $totalarray['totalizable'] = array();
790
791 $imaxinloop = ($limit ? min($num, $limit) : $num);
792 while ($i < $imaxinloop) {
793 $obj = $db->fetch_object($resql);
794 if (empty($obj)) {
795 break; // Should not happen
796 }
797
798 $expensereportstatic->id = $obj->rowid;
799 $expensereportstatic->ref = $obj->ref;
800 $expensereportstatic->status = $obj->status;
801 $expensereportstatic->date_debut = $db->jdate($obj->date_debut);
802 $expensereportstatic->date_fin = $db->jdate($obj->date_fin);
803 $expensereportstatic->date_create = $db->jdate($obj->date_create);
804 $expensereportstatic->date_modif = $db->jdate($obj->date_modif);
805 $expensereportstatic->date_valid = $db->jdate($obj->date_valid);
806 $expensereportstatic->date_approve = $db->jdate($obj->date_approve);
807 $expensereportstatic->note_private = $obj->note_private;
808 $expensereportstatic->note_public = $obj->note_public;
809 $expensereportstatic->fk_user = $obj->id_user;
810
811 $usertmp->id = $obj->id_user;
812 $usertmp->lastname = $obj->lastname;
813 $usertmp->firstname = $obj->firstname;
814 $usertmp->login = $obj->login;
815 $usertmp->statut = $obj->user_status;
816 $usertmp->status = $obj->user_status;
817 $usertmp->photo = $obj->photo;
818 $usertmp->email = $obj->email;
819
820 if ($mode == 'kanban') {
821 if ($i == 0) {
822 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
823 print '<div class="box-flex-container kanban">';
824 }
825 // TODO Use a cache on user
826 $usertmp->fetch($obj->id_user);
827
828 // Output Kanban
829 if ($massactionbutton || $massaction) {
830 $selected = 0;
831
832 print $expensereportstatic->getKanbanView('', array('userauthor' => $usertmp, 'selected' => in_array($expensereportstatic->id, $arrayofselected)));
833 }
834 if ($i == ($imaxinloop - 1)) {
835 print '</div>';
836 print '</td></tr>';
837 }
838 } else {
839 // Show line of result
840 $j = 0;
841 print '<tr data-rowid="'.$object->id.'" class="oddeven">';
842
843 // Action column
844 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
845 print '<td class="nowrap center">';
846 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
847 $selected = 0;
848 if (in_array($obj->rowid, $arrayofselected)) {
849 $selected = 1;
850 }
851 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
852 }
853 print '</td>';
854 if (!$i) {
855 $totalarray['nbfield']++;
856 }
857 }
858 // Ref
859 if (!empty($arrayfields['d.ref']['checked'])) {
860 print '<td>';
861 print '<table class="nobordernopadding"><tr class="nocellnopadd">';
862 print '<td class="nobordernopadding nowrap">';
863 print $expensereportstatic->getNomUrl(1);
864 print '</td>';
865 // Warning late icon and note
866 print '<td class="nobordernopadding nowrap">';
867 if ($expensereportstatic->status == 2 && $expensereportstatic->hasDelay('toappove')) {
868 print img_warning($langs->trans("Late"));
869 }
870 if ($expensereportstatic->status == 5 && $expensereportstatic->hasDelay('topay')) {
871 print img_warning($langs->trans("Late"));
872 }
873 if (!empty($obj->note_private) || !empty($obj->note_public)) {
874 print ' <span class="note">';
875 print '<a href="'.DOL_URL_ROOT.'/expensereport/note.php?id='.$obj->rowid.'">'.img_picto($langs->trans("ViewPrivateNote"), 'object_generic').'</a>';
876 print '</span>';
877 }
878 print '</td>';
879 print '<td width="16" class="nobordernopadding hideonsmartphone right">';
880 $filename = dol_sanitizeFileName($obj->ref);
881 $filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($obj->ref);
882 $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid;
883 print $formfile->getDocumentsLink($expensereportstatic->element, $filename, $filedir);
884 print '</td>';
885 print '</tr></table>';
886 print '</td>';
887 if (!$i) {
888 $totalarray['nbfield']++;
889 }
890 }
891 // User
892 if (!empty($arrayfields['user']['checked'])) {
893 print '<td class="left">';
894 print $usertmp->getNomUrl(-1);
895 print '</td>';
896 if (!$i) {
897 $totalarray['nbfield']++;
898 }
899 }
900 // Start date
901 if (!empty($arrayfields['d.date_debut']['checked'])) {
902 print '<td class="center">'.($obj->date_debut > 0 ? dol_print_date($db->jdate($obj->date_debut), 'day') : '').'</td>';
903 if (!$i) {
904 $totalarray['nbfield']++;
905 }
906 }
907 // End date
908 if (!empty($arrayfields['d.date_fin']['checked'])) {
909 print '<td class="center">'.($obj->date_fin > 0 ? dol_print_date($db->jdate($obj->date_fin), 'day') : '').'</td>';
910 if (!$i) {
911 $totalarray['nbfield']++;
912 }
913 }
914 // Date validation
915 if (!empty($arrayfields['d.date_valid']['checked'])) {
916 print '<td class="center">'.($obj->date_valid > 0 ? dol_print_date($db->jdate($obj->date_valid), 'day') : '').'</td>';
917 if (!$i) {
918 $totalarray['nbfield']++;
919 }
920 }
921 // Date approval
922 if (!empty($arrayfields['d.date_approve']['checked'])) {
923 print '<td class="center">'.($obj->date_approve > 0 ? dol_print_date($db->jdate($obj->date_approve), 'day') : '').'</td>';
924 if (!$i) {
925 $totalarray['nbfield']++;
926 }
927 }
928 // Amount HT
929 if (!empty($arrayfields['d.total_ht']['checked'])) {
930 print '<td class="right">'.price($obj->total_ht)."</td>\n";
931 if (!$i) {
932 $totalarray['nbfield']++;
933 }
934 if (!$i) {
935 $totalarray['pos'][$totalarray['nbfield']] = 'd.total_ht';
936 }
937 $totalarray['val']['d.total_ht'] += $obj->total_ht;
938 }
939 // Amount VAT
940 if (!empty($arrayfields['d.total_vat']['checked'])) {
941 print '<td class="right">'.price($obj->total_tva)."</td>\n";
942 if (!$i) {
943 $totalarray['nbfield']++;
944 }
945 if (!$i) {
946 $totalarray['pos'][$totalarray['nbfield']] = 'd.total_tva';
947 }
948 $totalarray['val']['d.total_tva'] += $obj->total_tva;
949 }
950 // Amount TTC
951 if (!empty($arrayfields['d.total_ttc']['checked'])) {
952 print '<td class="right">'.price($obj->total_ttc)."</td>\n";
953 if (!$i) {
954 $totalarray['nbfield']++;
955 }
956 if (!$i) {
957 $totalarray['pos'][$totalarray['nbfield']] = 'd.total_ttc';
958 }
959 $totalarray['val']['d.total_ttc'] += $obj->total_ttc;
960 }
961
962 // Extra fields
963 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
964 // Fields from hook
965 $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
966 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
967 print $hookmanager->resPrint;
968
969 // Date creation
970 if (!empty($arrayfields['d.date_create']['checked'])) {
971 print '<td class="nowrap center">';
972 print dol_print_date($db->jdate($obj->date_create), 'dayhour');
973 print '</td>';
974 if (!$i) {
975 $totalarray['nbfield']++;
976 }
977 }
978 // Date modification
979 if (!empty($arrayfields['d.tms']['checked'])) {
980 print '<td class="nowrap center">';
981 print dol_print_date($db->jdate($obj->date_modif), 'dayhour');
982 print '</td>';
983 if (!$i) {
984 $totalarray['nbfield']++;
985 }
986 }
987 // Status
988 if (!empty($arrayfields['d.fk_statut']['checked'])) {
989 print '<td class="nowrap center">'.$expensereportstatic->getLibStatut(5).'</td>';
990 if (!$i) {
991 $totalarray['nbfield']++;
992 }
993 }
994 // Action column
995 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
996 print '<td class="nowrap center">';
997 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
998 $selected = 0;
999 if (in_array($obj->rowid, $arrayofselected)) {
1000 $selected = 1;
1001 }
1002 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1003 }
1004 print '</td>';
1005 if (!$i) {
1006 $totalarray['nbfield']++;
1007 }
1008 }
1009
1010 print '</tr>'."\n";
1011 }
1012
1013 $total_total_ht += $obj->total_ht;
1014 $total_total_tva += $obj->total_tva;
1015 $total_total_ttc += $obj->total_ttc;
1016
1017 $i++;
1018 }
1019}
1020
1021// Show total line
1022include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1023
1024// If no record found
1025if ($num == 0) {
1026 $colspan = 1;
1027 foreach ($arrayfields as $key => $val) {
1028 if (!empty($val['checked'])) {
1029 $colspan++;
1030 }
1031 }
1032 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1033}
1034
1035$db->free($resql);
1036
1037$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
1038$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1039print $hookmanager->resPrint;
1040
1041print '</table>'."\n";
1042print '</div>'."\n";
1043
1044print '</form>'."\n";
1045
1046if (empty($id)) {
1047 $hidegeneratedfilelistifempty = 1;
1048 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
1049 $hidegeneratedfilelistifempty = 0;
1050 }
1051
1052 // Show list of available documents
1053 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
1054 $urlsource .= str_replace('&amp;', '&', $param);
1055
1056 $filedir = $diroutputmassaction;
1057 $genallowed = $user->hasRight('expensereport', 'lire');
1058 $delallowed = $user->hasRight('expensereport', 'creer');
1059
1060 print $formfile->showdocuments('massfilesarea_expensereport', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
1061}
1062
1063// End of page
1064llxFooter();
1065$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...
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 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.