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';
45$langs->loadLangs(array(
'companies',
'users',
'trips'));
47$action =
GETPOST(
'action',
'aZ09');
48$massaction =
GETPOST(
'massaction',
'alpha');
50$confirm =
GETPOST(
'confirm',
'alpha');
51$cancel =
GETPOST(
'cancel',
'alpha');
52$toselect =
GETPOST(
'toselect',
'array');
53$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'expensereportlist';
54$mode =
GETPOST(
'mode',
'alpha');
56$childids = $user->getAllChildIds(1);
62 if (
$id == $user->id) {
65 if ($user->hasRight(
'expensereport',
'readall')) {
68 if ($user->hasRight(
'expensereport',
'lire') && in_array(
$id, $childids)) {
76$diroutputmassaction = $conf->expensereport->dir_output.
'/temp/massgeneration/'.$user->id;
81$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
82$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
84if (empty($page) || $page == -1) {
87$offset = $limit * $page;
94 $sortfield =
"d.date_debut";
98$search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
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'));
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);
114$search_date_startend =
dol_mktime(23, 59, 59, $search_date_startendmonth, $search_date_startendday, $search_date_startendyear);
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);
123$search_date_endend =
dol_mktime(23, 59, 59, $search_date_endendmonth, $search_date_endendday, $search_date_endendyear);
125$optioncss =
GETPOST(
'optioncss',
'alpha');
127if ($search_status ==
'') {
130if ($search_user ==
'') {
137 $socid = $user->socid;
139$hookmanager->initHooks(array(
'expensereportlist'));
147$extrafields->fetch_name_optionals_label(
$object->table_element);
149$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
153$fieldstosearchall = array(
155 'd.note_public' =>
"NotePublic",
156 'u.lastname' =>
'EmployeeLastname',
157 'u.firstname' =>
"EmployeeFirstname",
158 'u.login' =>
"Login",
160if (empty($user->socid)) {
161 $fieldstosearchall[
"d.note_private"] =
"NotePrivate";
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),
179include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
181$canedituser = (!empty($user->admin) || $user->hasRight(
'user',
'user',
'creer'));
183$permissiontoread = $user->hasRight(
'expensereport',
'lire');
184$permissiontodelete = $user->hasRight(
'expensereport',
'supprimer');
186$objectuser =
new User($db);
193if (
GETPOST(
'cancel',
'alpha')) {
197if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
201$parameters = array(
'socid' => $socid);
202$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
207if (empty($reshook)) {
209 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
212 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
215 $search_amount_ht =
"";
216 $search_amount_vat =
"";
217 $search_amount_ttc =
"";
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 =
'';
236 $search_array_options = array();
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')) {
244 $objectclass =
'ExpenseReport';
245 $objectlabel =
'ExpenseReport';
246 $uploaddir = $conf->expensereport->dir_output;
247 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
255$form =
new Form($db);
260$fuser =
new User($db);
262$title = $langs->trans(
"TripsAndExpenses");
275 $fuser->fetch(
$id,
'',
'', 1);
276 $fuser->loadRights();
277 $user_id = $fuser->id;
279 $search_user = $user_id;
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";
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 :
'');
294$parameters = array();
295$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
296$sql .= $hookmanager->resPrint;
297$sql = preg_replace(
'/,\s*$/',
'', $sql);
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)";
305$sql .=
", ".MAIN_DB_PREFIX.
"user as u";
306$sql .=
" WHERE d.fk_user_author = u.rowid AND d.entity IN (".getEntity(
'expensereport').
")";
308if (!empty($search_all)) {
309 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
312if (!empty($search_ref)) {
316if ($search_date_start) {
317 $sql .=
" AND d.date_debut >= '".$db->idate($search_date_start).
"'";
319if ($search_date_startend) {
320 $sql .=
" AND d.date_debut <= '".$db->idate($search_date_startend).
"'";
323if ($search_date_end) {
324 $sql .=
" AND d.date_fin >= '".$db->idate($search_date_end).
"'";
326if ($search_date_endend) {
327 $sql .=
" AND d.date_fin <= '".$db->idate($search_date_endend).
"'";
330if ($search_amount_ht !=
'') {
333if ($search_amount_ttc !=
'') {
337if ($search_user !=
'' && $search_user >= 0) {
338 $sql .=
" AND u.rowid = '".$db->escape($search_user).
"'";
341if ($search_status !=
'' && $search_status >= 0) {
342 $sql .=
" AND d.fk_statut IN (".$db->sanitize($search_status).
")";
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";
350include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
352$parameters = array();
353$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
354$sql .= $hookmanager->resPrint;
357$nbtotalofrecords =
'';
360 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
361 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
362 $resql = $db->query($sqlforcount);
364 $objforcount = $db->fetch_object($resql);
365 $nbtotalofrecords = $objforcount->nbtotalofrecords;
370 if (($page * $limit) > $nbtotalofrecords) {
378$sql .= $db->order($sortfield, $sortorder);
380 $sql .= $db->plimit($limit + 1, $offset);
384$resql = $db->query($sql);
390$num = $db->num_rows($resql);
396llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist');
398$arrayofselected = is_array($toselect) ? $toselect : array();
402 $param .=
'&mode='.urlencode($mode);
404if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
405 $param .=
'&contextpage='.urlencode($contextpage);
407if ($limit > 0 && $limit != $conf->liste_limit) {
408 $param .=
'&limit='.((int) $limit);
410if ($optioncss !=
'') {
411 $param .=
'&optioncss='.urlencode($optioncss);
414 $param .=
"&search_all=".urlencode($search_all);
417 $param .=
"&search_ref=".urlencode($search_ref);
420if ($search_date_startday) {
421 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
423if ($search_date_startmonth) {
424 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
426if ($search_date_startyear) {
427 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
429if ($search_date_startendday) {
430 $param .=
'&search_date_startendday='.urlencode((
string) ($search_date_startendday));
432if ($search_date_startendmonth) {
433 $param .=
'&search_date_startendmonth='.urlencode((
string) ($search_date_startendmonth));
435if ($search_date_startendyear) {
436 $param .=
'&search_date_startendyear='.urlencode((
string) ($search_date_startendyear));
439if ($search_date_endday) {
440 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
442if ($search_date_endmonth) {
443 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
445if ($search_date_endyear) {
446 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
448if ($search_date_endendday) {
449 $param .=
'&search_date_endendday='.urlencode((
string) ($search_date_endendday));
451if ($search_date_endendmonth) {
452 $param .=
'&search_date_endendmonth='.urlencode((
string) ($search_date_endendmonth));
454if ($search_date_endendyear) {
455 $param .=
'&search_date_endendyear='.urlencode((
string) ($search_date_endendyear));
458 $param .=
"&search_user=".urlencode($search_user);
460if ($search_amount_ht) {
461 $param .=
"&search_amount_ht=".urlencode($search_amount_ht);
463if ($search_amount_ttc) {
464 $param .=
"&search_amount_ttc=".urlencode($search_amount_ttc);
466if ($search_status >= 0) {
467 $param .=
"&search_status=".urlencode($search_status);
470include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
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"),
478if ($user->hasRight(
'expensereport',
'supprimer')) {
479 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
481if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
482 $arrayofmassactions = array();
484$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
487print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
488if ($optioncss !=
'') {
489 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
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.
'">';
501 print
'<input type="hidden" name="id" value="'.$id.
'">';
505 $title = $langs->trans(
"User");
506 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
511 dol_banner_tab($fuser,
'id', $linkback, $user->hasRight(
'user',
'user',
'lire') || $user->admin);
515 if ($action !=
'edit') {
516 print
'<div class="tabsAction">';
518 $childids = $user->getAllChildIds(1);
520 $canedit = ((in_array($user_id, $childids) && $user->hasRight(
'expensereport',
'creer'))
521 || ($conf->global->MAIN_USE_ADVANCED_PERMS && $user->hasRight(
'expensereport',
'writeall_advance')));
525 print
'<a href="'.DOL_URL_ROOT.
'/expensereport/card.php?action=create&fk_user_author='.$fuser->id.
'" class="butAction">'.$langs->trans(
"AddTrip").
'</a>';
527 print
'<a href="#" class="butActionRefused" title="'.$langs->trans(
"NotEnoughPermissions").
'">'.$langs->trans(
"AddTrip").
'</a>';
532 print $form->buttonsSaveCancel(
"Save",
'');
535 $title = $langs->trans(
"ListTripsAndExpenses");
537 $url = DOL_URL_ROOT.
'/expensereport/card.php?action=create';
538 if (!empty($socid)) {
539 $url .=
'&socid='.$socid;
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'));
545 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'expensereport',
'creer'));
547 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'expensereport', 0, $newcardbutton,
'', $limit, 0, 0, 1);
551$topicmail =
"SendExpenseReport";
552$modelmail =
"expensereport";
554$trackid =
'exp'.$object->id;
555include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
559 foreach ($fieldstosearchall as $key => $val) {
560 $fieldstosearchall[$key] = $langs->trans($val);
561 $setupstring .= $key.
"=".$val.
";";
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";
569$parameters = array();
570$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
571if (empty($reshook)) {
572 $moreforfilter .= $hookmanager->resPrint;
574 $moreforfilter = $hookmanager->resPrint;
577if (!empty($moreforfilter)) {
578 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
579 print $moreforfilter;
583$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
584$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
585$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
586$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
588print
'<div class="div-table-responsive">';
589print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
593print
'<tr class="liste_titre_filter">';
596 print
'<td class="liste_titre center maxwidthsearch">';
597 $searchpicto = $form->showFilterButtons(
'left');
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.
'">';
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');
613 print
'<td class="liste_titre"> </td>';
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'));
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'));
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'));
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'));
639if (!empty($arrayfields[
'd.date_valid'][
'checked'])) {
640 print
'<td class="liste_titre" align="center">';
646if (!empty($arrayfields[
'd.date_approve'][
'checked'])) {
647 print
'<td class="liste_titre" align="center">';
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>';
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>';
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>';
664include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
667$parameters = array(
'arrayfields' => $arrayfields);
668$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
669print $hookmanager->resPrint;
671if (!empty($arrayfields[
'd.date_create'][
'checked'])) {
672 print
'<td class="liste_titre">';
676if (!empty($arrayfields[
'd.tms'][
'checked'])) {
677 print
'<td class="liste_titre">';
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');
688 print
'<td class="liste_titre center maxwidthsearch">';
689 $searchpicto = $form->showFilterButtons();
696$totalarray = array();
697$totalarray[
'nbfield'] = 0;
701print
'<tr class="liste_titre">';
703 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch center ');
704 $totalarray[
'nbfield']++;
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']++;
710if (!empty($arrayfields[
'user'][
'checked'])) {
711 print_liste_field_titre($arrayfields[
'user'][
'label'], $_SERVER[
"PHP_SELF"],
"u.lastname",
"", $param,
'', $sortfield, $sortorder);
712 $totalarray[
'nbfield']++;
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']++;
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']++;
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']++;
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']++;
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']++;
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']++;
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']++;
743include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
745$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
746$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
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']++;
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']++;
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']++;
761 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
762 $totalarray[
'nbfield']++;
775$usertmp =
new User($db);
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();
788 $imaxinloop = ($limit ? min($num, $limit) : $num);
789 while ($i < $imaxinloop) {
790 $obj = $db->fetch_object($resql);
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;
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;
817 if ($mode ==
'kanban') {
819 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
820 print
'<div class="box-flex-container kanban">';
823 $usertmp->fetch($obj->id_user);
826 if ($massactionbutton || $massaction) {
829 print $expensereportstatic->getKanbanView(
'', array(
'userauthor' => $usertmp,
'selected' => in_array($expensereportstatic->id, $arrayofselected)));
831 if ($i == ($imaxinloop - 1)) {
838 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
842 print
'<td class="nowrap center">';
843 if ($massactionbutton || $massaction) {
845 if (in_array($obj->rowid, $arrayofselected)) {
848 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
852 $totalarray[
'nbfield']++;
856 if (!empty($arrayfields[
'd.ref'][
'checked'])) {
858 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
859 print
'<td class="nobordernopadding nowrap">';
860 print $expensereportstatic->getNomUrl(1);
863 print
'<td class="nobordernopadding nowrap">';
864 if ($expensereportstatic->status == 2 && $expensereportstatic->hasDelay(
'toappove')) {
867 if ($expensereportstatic->status == 5 && $expensereportstatic->hasDelay(
'topay')) {
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>';
876 print
'<td width="16" class="nobordernopadding hideonsmartphone right">';
879 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
880 print $formfile->getDocumentsLink($expensereportstatic->element, $filename, $filedir);
882 print
'</tr></table>';
885 $totalarray[
'nbfield']++;
889 if (!empty($arrayfields[
'user'][
'checked'])) {
890 print
'<td class="left">';
891 print $usertmp->getNomUrl(-1);
894 $totalarray[
'nbfield']++;
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>';
901 $totalarray[
'nbfield']++;
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>';
908 $totalarray[
'nbfield']++;
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>';
915 $totalarray[
'nbfield']++;
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>';
922 $totalarray[
'nbfield']++;
926 if (!empty($arrayfields[
'd.total_ht'][
'checked'])) {
927 print
'<td class="right">'.price($obj->total_ht).
"</td>\n";
929 $totalarray[
'nbfield']++;
932 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'd.total_ht';
934 $totalarray[
'val'][
'd.total_ht'] += $obj->total_ht;
937 if (!empty($arrayfields[
'd.total_vat'][
'checked'])) {
938 print
'<td class="right">'.price($obj->total_tva).
"</td>\n";
940 $totalarray[
'nbfield']++;
943 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'd.total_tva';
945 $totalarray[
'val'][
'd.total_tva'] += $obj->total_tva;
948 if (!empty($arrayfields[
'd.total_ttc'][
'checked'])) {
949 print
'<td class="right">'.price($obj->total_ttc).
"</td>\n";
951 $totalarray[
'nbfield']++;
954 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'd.total_ttc';
956 $totalarray[
'val'][
'd.total_ttc'] += $obj->total_ttc;
960 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
962 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
963 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
964 print $hookmanager->resPrint;
967 if (!empty($arrayfields[
'd.date_create'][
'checked'])) {
968 print
'<td class="nowrap center">';
972 $totalarray[
'nbfield']++;
976 if (!empty($arrayfields[
'd.tms'][
'checked'])) {
977 print
'<td class="nowrap center">';
981 $totalarray[
'nbfield']++;
985 if (!empty($arrayfields[
'd.fk_statut'][
'checked'])) {
986 print
'<td class="nowrap center">'.$expensereportstatic->getLibStatut(5).
'</td>';
988 $totalarray[
'nbfield']++;
993 print
'<td class="nowrap center">';
994 if ($massactionbutton || $massaction) {
996 if (in_array($obj->rowid, $arrayofselected)) {
999 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1003 $totalarray[
'nbfield']++;
1010 $total_total_ht += $obj->total_ht;
1011 $total_total_tva += $obj->total_tva;
1012 $total_total_ttc += $obj->total_ttc;
1019include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1024 foreach ($arrayfields as $key => $val) {
1025 if (!empty($val[
'checked'])) {
1029 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1034$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1035$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1036print $hookmanager->resPrint;
1038print
'</table>'.
"\n";
1041print
'</form>'.
"\n";
1044 $hidegeneratedfilelistifempty = 1;
1045 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1046 $hidegeneratedfilelistifempty = 0;
1050 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1051 $urlsource .= str_replace(
'&',
'&', $param);
1053 $filedir = $diroutputmassaction;
1054 $genallowed = $user->hasRight(
'expensereport',
'lire');
1055 $delallowed = $user->hasRight(
'expensereport',
'creer');
1057 print $formfile->showdocuments(
'massfilesarea_expensereport',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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.
Class to manage Trips and Expenses.
Class to manage Dolibarr users.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_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.