33require
'../main.inc.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
36require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formexpensereport.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport_ik.class.php';
44$langs->loadLangs(array(
'companies',
'users',
'trips'));
46$action =
GETPOST(
'action',
'aZ09');
47$massaction =
GETPOST(
'massaction',
'alpha');
49$confirm =
GETPOST(
'confirm',
'alpha');
50$cancel =
GETPOST(
'cancel',
'alpha');
51$toselect =
GETPOST(
'toselect',
'array');
52$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'expensereportlist';
53$mode =
GETPOST(
'mode',
'alpha');
55$childids = $user->getAllChildIds(1);
60 $socid = $user->socid;
67 if ($id == $user->id) {
70 if ($user->hasRight(
'expensereport',
'readall')) {
73 if ($user->hasRight(
'expensereport',
'lire') && in_array($id, $childids)) {
81$diroutputmassaction = $conf->expensereport->dir_output.
'/temp/massgeneration/'.$user->id;
86$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
87$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
88$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOSTINT(
"page");
89if (empty($page) || $page == -1) {
92$offset = $limit * $page;
99 $sortfield =
"d.date_debut";
103$search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
105$search_ref =
GETPOST(
'search_ref',
'alpha');
106$search_user =
GETPOST(
'search_user',
'intcomma');
107$search_amount_ht =
GETPOST(
'search_amount_ht',
'alpha');
108$search_amount_vat =
GETPOST(
'search_amount_vat',
'alpha');
109$search_amount_ttc =
GETPOST(
'search_amount_ttc',
'alpha');
110$search_status = (
GETPOST(
'search_status',
'intcomma') !=
'' ?
GETPOST(
'search_status',
'intcomma') :
GETPOST(
'statut',
'intcomma'));
112$search_date_startday =
GETPOSTINT(
'search_date_startday');
113$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
114$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
115$search_date_startendday =
GETPOSTINT(
'search_date_startendday');
116$search_date_startendmonth =
GETPOSTINT(
'search_date_startendmonth');
117$search_date_startendyear =
GETPOSTINT(
'search_date_startendyear');
118$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
119$search_date_startend =
dol_mktime(23, 59, 59, $search_date_startendmonth, $search_date_startendday, $search_date_startendyear);
121$search_date_endday =
GETPOSTINT(
'search_date_endday');
122$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
123$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
124$search_date_endendday =
GETPOSTINT(
'search_date_endendday');
125$search_date_endendmonth =
GETPOSTINT(
'search_date_endendmonth');
126$search_date_endendyear =
GETPOSTINT(
'search_date_endendyear');
127$search_date_end =
dol_mktime(0, 0, 0, $search_date_endmonth, $search_date_endday, $search_date_endyear);
128$search_date_endend =
dol_mktime(23, 59, 59, $search_date_endendmonth, $search_date_endendday, $search_date_endendyear);
130$optioncss =
GETPOST(
'optioncss',
'alpha');
132if ($search_status ==
'') {
135if ($search_user ==
'') {
141$hookmanager->initHooks(array(
'expensereportlist'));
145$extrafields->fetch_name_optionals_label(
$object->table_element);
147$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
151$fieldstosearchall = array(
153 'd.note_public' =>
"NotePublic",
154 'u.lastname' =>
'EmployeeLastname',
155 'u.firstname' =>
"EmployeeFirstname",
156 'u.login' =>
"Login",
158if (empty($user->socid)) {
159 $fieldstosearchall[
"d.note_private"] =
"NotePrivate";
163 'd.ref' => array(
'label' => $langs->trans(
"Ref"),
'checked' => 1),
164 'user' => array(
'label' => $langs->trans(
"User"),
'checked' => 1),
165 'd.date_debut' => array(
'label' => $langs->trans(
"DateStart"),
'checked' => 1),
166 'd.date_fin' => array(
'label' => $langs->trans(
"DateEnd"),
'checked' => 1),
167 'd.date_valid' => array(
'label' => $langs->trans(
"DateValidation"),
'checked' => 1),
168 'd.date_approve' => array(
'label' => $langs->trans(
"DateApprove"),
'checked' => 1),
169 'd.total_ht' => array(
'label' => $langs->trans(
"AmountHT"),
'checked' => 1),
170 'd.total_vat' => array(
'label' => $langs->trans(
"AmountVAT"),
'checked' => -1),
171 'd.total_ttc' => array(
'label' => $langs->trans(
"AmountTTC"),
'checked' => 1),
172 'd.date_create' => array(
'label' => $langs->trans(
"DateCreation"),
'checked' => 0,
'position' => 500),
173 'd.tms' => array(
'label' => $langs->trans(
"DateModificationShort"),
'checked' => 0,
'position' => 500),
174 'd.fk_statut' => array(
'label' => $langs->trans(
"Status"),
'checked' => 1,
'position' => 1000),
177include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
179$canedituser = (!empty($user->admin) || $user->hasRight(
'user',
'user',
'creer'));
181$permissiontoread = $user->hasRight(
'expensereport',
'lire');
182$permissiontodelete = $user->hasRight(
'expensereport',
'supprimer');
184$objectuser =
new User($db);
191if (
GETPOST(
'cancel',
'alpha')) {
195if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
199$parameters = array(
'socid' => $socid);
200$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
205if (empty($reshook)) {
207 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
210 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
213 $search_amount_ht =
"";
214 $search_amount_vat =
"";
215 $search_amount_ttc =
"";
217 $search_date_startday =
'';
218 $search_date_startmonth =
'';
219 $search_date_startyear =
'';
220 $search_date_startendday =
'';
221 $search_date_startendmonth =
'';
222 $search_date_startendyear =
'';
223 $search_date_start =
'';
224 $search_date_startend =
'';
225 $search_date_endday =
'';
226 $search_date_endmonth =
'';
227 $search_date_endyear =
'';
228 $search_date_endendday =
'';
229 $search_date_endendmonth =
'';
230 $search_date_endendyear =
'';
231 $search_date_end =
'';
232 $search_date_endend =
'';
234 $search_array_options = array();
236 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
237 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
242 $objectclass =
'ExpenseReport';
243 $objectlabel =
'ExpenseReport';
244 $uploaddir = $conf->expensereport->dir_output;
245 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
253$form =
new Form($db);
258$fuser =
new User($db);
260$title = $langs->trans(
"TripsAndExpenses");
273 $fuser->fetch($id,
'',
'', 1);
275 $user_id = $fuser->id;
277 $search_user = $user_id;
282$sql =
"SELECT d.rowid, d.ref, d.fk_user_author, d.total_ht, d.total_tva, d.total_ttc, d.fk_statut as status,";
283$sql .=
" d.date_debut, d.date_fin, d.date_create, d.tms as date_modif, d.date_valid, d.date_approve, d.note_private, d.note_public,";
284$sql .=
" u.rowid as id_user, u.firstname, u.lastname, u.login, u.email, u.statut as user_status, u.photo";
286if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
287 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
288 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
292$parameters = array();
293$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
294$sql .= $hookmanager->resPrint;
295$sql = preg_replace(
'/,\s*$/',
'', $sql);
299$sql .=
" FROM ".MAIN_DB_PREFIX.
"expensereport as d";
300if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
301 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (d.rowid = ef.fk_object)";
303$sql .=
", ".MAIN_DB_PREFIX.
"user as u";
304$sql .=
" WHERE d.fk_user_author = u.rowid AND d.entity IN (".getEntity(
'expensereport').
")";
306if (!empty($search_all)) {
307 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
310if (!empty($search_ref)) {
314if ($search_date_start) {
315 $sql .=
" AND d.date_debut >= '".$db->idate($search_date_start).
"'";
317if ($search_date_startend) {
318 $sql .=
" AND d.date_debut <= '".$db->idate($search_date_startend).
"'";
321if ($search_date_end) {
322 $sql .=
" AND d.date_fin >= '".$db->idate($search_date_end).
"'";
324if ($search_date_endend) {
325 $sql .=
" AND d.date_fin <= '".$db->idate($search_date_endend).
"'";
328if ($search_amount_ht !=
'') {
331if ($search_amount_ttc !=
'') {
335if ($search_user !=
'' && $search_user >= 0) {
336 $sql .=
" AND u.rowid = '".$db->escape($search_user).
"'";
339if ($search_status !=
'' && $search_status >= 0) {
340 $sql .=
" AND d.fk_statut IN (".$db->sanitize($search_status).
")";
343if (!$user->hasRight(
'expensereport',
'readall') && !$user->hasRight(
'expensereport',
'lire_tous')
344 && (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || !$user->hasRight(
'expensereport',
'writeall_advance'))) {
345 $sql .=
" AND d.fk_user_author IN (".$db->sanitize(implode(
',', $childids)).
")\n";
348include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
350$parameters = array();
351$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
352$sql .= $hookmanager->resPrint;
355$nbtotalofrecords =
'';
358 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
359 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
360 $resql = $db->query($sqlforcount);
362 $objforcount = $db->fetch_object($resql);
363 $nbtotalofrecords = $objforcount->nbtotalofrecords;
368 if (($page * $limit) > $nbtotalofrecords) {
376$sql .= $db->order($sortfield, $sortorder);
378 $sql .= $db->plimit($limit + 1, $offset);
382$resql = $db->query($sql);
388$num = $db->num_rows($resql);
394llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist');
396$arrayofselected = is_array($toselect) ? $toselect : array();
400 $param .=
'&mode='.urlencode($mode);
402if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
403 $param .=
'&contextpage='.urlencode($contextpage);
405if ($limit > 0 && $limit != $conf->liste_limit) {
406 $param .=
'&limit='.((int) $limit);
408if ($optioncss !=
'') {
409 $param .=
'&optioncss='.urlencode($optioncss);
412 $param .=
"&search_all=".urlencode($search_all);
415 $param .=
"&search_ref=".urlencode($search_ref);
418if ($search_date_startday) {
419 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
421if ($search_date_startmonth) {
422 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
424if ($search_date_startyear) {
425 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
427if ($search_date_startendday) {
428 $param .=
'&search_date_startendday='.urlencode((
string) ($search_date_startendday));
430if ($search_date_startendmonth) {
431 $param .=
'&search_date_startendmonth='.urlencode((
string) ($search_date_startendmonth));
433if ($search_date_startendyear) {
434 $param .=
'&search_date_startendyear='.urlencode((
string) ($search_date_startendyear));
437if ($search_date_endday) {
438 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
440if ($search_date_endmonth) {
441 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
443if ($search_date_endyear) {
444 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
446if ($search_date_endendday) {
447 $param .=
'&search_date_endendday='.urlencode((
string) ($search_date_endendday));
449if ($search_date_endendmonth) {
450 $param .=
'&search_date_endendmonth='.urlencode((
string) ($search_date_endendmonth));
452if ($search_date_endendyear) {
453 $param .=
'&search_date_endendyear='.urlencode((
string) ($search_date_endendyear));
456 $param .=
"&search_user=".urlencode($search_user);
458if ($search_amount_ht) {
459 $param .=
"&search_amount_ht=".urlencode($search_amount_ht);
461if ($search_amount_ttc) {
462 $param .=
"&search_amount_ttc=".urlencode($search_amount_ttc);
464if ($search_status >= 0) {
465 $param .=
"&search_status=".urlencode($search_status);
468include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
471$arrayofmassactions = array(
472 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
473 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
474 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
476if ($user->hasRight(
'expensereport',
'supprimer')) {
477 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
479if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
480 $arrayofmassactions = array();
482$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
485print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
486if ($optioncss !=
'') {
487 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
489print
'<input type="hidden" name="token" value="'.newToken().
'">';
490print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
491print
'<input type="hidden" name="action" value="'.($action ==
'edit' ?
'update' :
'list').
'">';
492print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
493print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
494print
'<input type="hidden" name="page" value="'.$page.
'">';
495print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
496print
'<input type="hidden" name="page_y" value="">';
497print
'<input type="hidden" name="mode" value="'.$mode.
'">';
499 print
'<input type="hidden" name="id" value="'.$id.
'">';
503 $title = $langs->trans(
"User");
504 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
509 dol_banner_tab($fuser,
'id', $linkback, $user->hasRight(
'user',
'user',
'lire') || $user->admin);
513 if ($action !=
'edit') {
514 print
'<div class="tabsAction">';
516 $childids = $user->getAllChildIds(1);
518 $canedit = ((in_array($user_id, $childids) && $user->hasRight(
'expensereport',
'creer'))
519 || ($conf->global->MAIN_USE_ADVANCED_PERMS && $user->hasRight(
'expensereport',
'writeall_advance')));
523 print
'<a href="'.DOL_URL_ROOT.
'/expensereport/card.php?action=create&fk_user_author='.$fuser->id.
'" class="butAction">'.$langs->trans(
"AddTrip").
'</a>';
525 print
'<a href="#" class="butActionRefused" title="'.$langs->trans(
"NotEnoughPermissions").
'">'.$langs->trans(
"AddTrip").
'</a>';
530 print $form->buttonsSaveCancel(
"Save",
'');
533 $title = $langs->trans(
"ListTripsAndExpenses");
535 $url = DOL_URL_ROOT.
'/expensereport/card.php?action=create';
536 if (!empty($socid)) {
537 $url .=
'&socid='.$socid;
540 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss' =>
'reposition'));
541 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss' =>
'reposition'));
543 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'expensereport',
'creer'));
545 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'expensereport', 0, $newcardbutton,
'', $limit, 0, 0, 1);
549$topicmail =
"SendExpenseReport";
550$modelmail =
"expensereport";
552$trackid =
'exp'.$object->id;
553include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
557 foreach ($fieldstosearchall as $key => $val) {
558 $fieldstosearchall[$key] = $langs->trans($val);
559 $setupstring .= $key.
"=".$val.
";";
561 print
'<!-- Search done like if EXPENSEREPORT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
562 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
567$parameters = array();
568$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
569if (empty($reshook)) {
570 $moreforfilter .= $hookmanager->resPrint;
572 $moreforfilter = $hookmanager->resPrint;
575if (!empty($moreforfilter)) {
576 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
577 print $moreforfilter;
581$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
582$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
583$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
584$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
586print
'<div class="div-table-responsive">';
587print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
591print
'<tr class="liste_titre_filter">';
594 print
'<td class="liste_titre center maxwidthsearch">';
595 $searchpicto = $form->showFilterButtons(
'left');
599if (!empty($arrayfields[
'd.ref'][
'checked'])) {
600 print
'<td class="liste_titre" align="left">';
601 print
'<input class="flat" size="15" type="text" name="search_ref" value="'.$search_ref.
'">';
605if (!empty($arrayfields[
'user'][
'checked'])) {
606 if ($user->hasRight(
'expensereport',
'readall') || $user->hasRight(
'expensereport',
'lire_tous')) {
607 print
'<td class="liste_titre maxwidthonspartphone" align="left">';
608 print $form->select_dolusers($search_user,
'search_user', 1,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth200');
611 print
'<td class="liste_titre"> </td>';
615if (!empty($arrayfields[
'd.date_debut'][
'checked'])) {
616 print
'<td class="liste_titre" align="center">';
617 print
'<div class="nowrapfordate">';
618 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
620 print
'<div class="nowrapfordate">';
621 print $form->selectDate($search_date_startend ? $search_date_startend : -1,
'search_date_startend', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
626if (!empty($arrayfields[
'd.date_fin'][
'checked'])) {
627 print
'<td class="liste_titre" align="center">';
628 print
'<div class="nowrapfordate">';
629 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
631 print
'<div class="nowrapfordate">';
632 print $form->selectDate($search_date_endend ? $search_date_endend : -1,
'search_date_endend', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
637if (!empty($arrayfields[
'd.date_valid'][
'checked'])) {
638 print
'<td class="liste_titre" align="center">';
644if (!empty($arrayfields[
'd.date_approve'][
'checked'])) {
645 print
'<td class="liste_titre" align="center">';
651if (!empty($arrayfields[
'd.total_ht'][
'checked'])) {
652 print
'<td class="liste_titre right"><input class="flat" type="text" size="5" name="search_amount_ht" value="'.$search_amount_ht.
'"></td>';
654if (!empty($arrayfields[
'd.total_vat'][
'checked'])) {
655 print
'<td class="liste_titre right"><input class="flat" type="text" size="5" name="search_amount_vat" value="'.$search_amount_vat.
'"></td>';
658if (!empty($arrayfields[
'd.total_ttc'][
'checked'])) {
659 print
'<td class="liste_titre right"><input class="flat" type="text" size="5" name="search_amount_ttc" value="'.$search_amount_ttc.
'"></td>';
662include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
665$parameters = array(
'arrayfields' => $arrayfields);
666$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
667print $hookmanager->resPrint;
669if (!empty($arrayfields[
'd.date_create'][
'checked'])) {
670 print
'<td class="liste_titre">';
674if (!empty($arrayfields[
'd.tms'][
'checked'])) {
675 print
'<td class="liste_titre">';
679if (!empty($arrayfields[
'd.fk_statut'][
'checked'])) {
680 print
'<td class="liste_titre center parentonrightofpage">';
681 print $formexpensereport->selectExpensereportStatus($search_status,
'search_status', 1, 1,
'search_status width100 onrightofpage');
686 print
'<td class="liste_titre center maxwidthsearch">';
687 $searchpicto = $form->showFilterButtons();
694$totalarray = array();
695$totalarray[
'nbfield'] = 0;
699print
'<tr class="liste_titre">';
701 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch center ');
702 $totalarray[
'nbfield']++;
704if (!empty($arrayfields[
'd.ref'][
'checked'])) {
705 print_liste_field_titre($arrayfields[
'd.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"d.ref",
"", $param,
'', $sortfield, $sortorder);
706 $totalarray[
'nbfield']++;
708if (!empty($arrayfields[
'user'][
'checked'])) {
709 print_liste_field_titre($arrayfields[
'user'][
'label'], $_SERVER[
"PHP_SELF"],
"u.lastname",
"", $param,
'', $sortfield, $sortorder);
710 $totalarray[
'nbfield']++;
712if (!empty($arrayfields[
'd.date_debut'][
'checked'])) {
713 print_liste_field_titre($arrayfields[
'd.date_debut'][
'label'], $_SERVER[
"PHP_SELF"],
"d.date_debut",
"", $param,
'', $sortfield, $sortorder,
'center ');
714 $totalarray[
'nbfield']++;
716if (!empty($arrayfields[
'd.date_fin'][
'checked'])) {
717 print_liste_field_titre($arrayfields[
'd.date_fin'][
'label'], $_SERVER[
"PHP_SELF"],
"d.date_fin",
"", $param,
'', $sortfield, $sortorder,
'center ');
718 $totalarray[
'nbfield']++;
720if (!empty($arrayfields[
'd.date_valid'][
'checked'])) {
721 print_liste_field_titre($arrayfields[
'd.date_valid'][
'label'], $_SERVER[
"PHP_SELF"],
"d.date_valid",
"", $param,
'', $sortfield, $sortorder,
'center ');
722 $totalarray[
'nbfield']++;
724if (!empty($arrayfields[
'd.date_approve'][
'checked'])) {
725 print_liste_field_titre($arrayfields[
'd.date_approve'][
'label'], $_SERVER[
"PHP_SELF"],
"d.date_approve",
"", $param,
'', $sortfield, $sortorder,
'center ');
726 $totalarray[
'nbfield']++;
728if (!empty($arrayfields[
'd.total_ht'][
'checked'])) {
729 print_liste_field_titre($arrayfields[
'd.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
"d.total_ht",
"", $param,
'', $sortfield, $sortorder,
'right ');
730 $totalarray[
'nbfield']++;
732if (!empty($arrayfields[
'd.total_vat'][
'checked'])) {
733 print_liste_field_titre($arrayfields[
'd.total_vat'][
'label'], $_SERVER[
"PHP_SELF"],
"d.total_tva",
"", $param,
'', $sortfield, $sortorder,
'right ');
734 $totalarray[
'nbfield']++;
736if (!empty($arrayfields[
'd.total_ttc'][
'checked'])) {
737 print_liste_field_titre($arrayfields[
'd.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
"d.total_ttc",
"", $param,
'', $sortfield, $sortorder,
'right ');
738 $totalarray[
'nbfield']++;
741include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
743$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
744$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
745print $hookmanager->resPrint;
746if (!empty($arrayfields[
'd.date_create'][
'checked'])) {
747 print_liste_field_titre($arrayfields[
'd.date_create'][
'label'], $_SERVER[
"PHP_SELF"],
"d.date_create",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center');
748 $totalarray[
'nbfield']++;
750if (!empty($arrayfields[
'd.tms'][
'checked'])) {
751 print_liste_field_titre($arrayfields[
'd.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"d.tms",
"", $param,
'', $sortfield, $sortorder,
'nowraponall center');
752 $totalarray[
'nbfield']++;
754if (!empty($arrayfields[
'd.fk_statut'][
'checked'])) {
755 print_liste_field_titre($arrayfields[
'd.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"d.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
756 $totalarray[
'nbfield']++;
759 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
760 $totalarray[
'nbfield']++;
773$usertmp =
new User($db);
777 $savnbfield = $totalarray[
'nbfield'];
778 $totalarray = array();
779 $totalarray[
'nbfield'] = 0;
780 $totalarray[
'val'] = array();
781 $totalarray[
'val'][
'd.total_ht'] = 0;
782 $totalarray[
'val'][
'd.total_tva'] = 0;
783 $totalarray[
'val'][
'd.total_ttc'] = 0;
784 $totalarray[
'totalizable'] = array();
786 $imaxinloop = ($limit ? min($num, $limit) : $num);
787 while ($i < $imaxinloop) {
788 $obj = $db->fetch_object($resql);
793 $expensereportstatic->id = $obj->rowid;
794 $expensereportstatic->ref = $obj->ref;
795 $expensereportstatic->status = $obj->status;
796 $expensereportstatic->date_debut = $db->jdate($obj->date_debut);
797 $expensereportstatic->date_fin = $db->jdate($obj->date_fin);
798 $expensereportstatic->date_create = $db->jdate($obj->date_create);
799 $expensereportstatic->date_modif = $db->jdate($obj->date_modif);
800 $expensereportstatic->date_valid = $db->jdate($obj->date_valid);
801 $expensereportstatic->date_approve = $db->jdate($obj->date_approve);
802 $expensereportstatic->note_private = $obj->note_private;
803 $expensereportstatic->note_public = $obj->note_public;
804 $expensereportstatic->fk_user = $obj->id_user;
806 $usertmp->id = $obj->id_user;
807 $usertmp->lastname = $obj->lastname;
808 $usertmp->firstname = $obj->firstname;
809 $usertmp->login = $obj->login;
810 $usertmp->statut = $obj->user_status;
811 $usertmp->status = $obj->user_status;
812 $usertmp->photo = $obj->photo;
813 $usertmp->email = $obj->email;
815 if ($mode ==
'kanban') {
817 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
818 print
'<div class="box-flex-container kanban">';
821 $usertmp->fetch($obj->id_user);
824 if ($massactionbutton || $massaction) {
827 print $expensereportstatic->getKanbanView(
'', array(
'userauthor' => $usertmp,
'selected' => in_array($expensereportstatic->id, $arrayofselected)));
829 if ($i == ($imaxinloop - 1)) {
836 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
840 print
'<td class="nowrap center">';
841 if ($massactionbutton || $massaction) {
843 if (in_array($obj->rowid, $arrayofselected)) {
846 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
850 $totalarray[
'nbfield']++;
854 if (!empty($arrayfields[
'd.ref'][
'checked'])) {
856 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
857 print
'<td class="nobordernopadding nowrap">';
858 print $expensereportstatic->getNomUrl(1);
861 print
'<td class="nobordernopadding nowrap">';
862 if ($expensereportstatic->status == 2 && $expensereportstatic->hasDelay(
'toappove')) {
865 if ($expensereportstatic->status == 5 && $expensereportstatic->hasDelay(
'topay')) {
868 if (!empty($obj->note_private) || !empty($obj->note_public)) {
869 print
' <span class="note">';
870 print
'<a href="'.DOL_URL_ROOT.
'/expensereport/note.php?id='.$obj->rowid.
'">'.
img_picto($langs->trans(
"ViewPrivateNote"),
'object_generic').
'</a>';
874 print
'<td width="16" class="nobordernopadding hideonsmartphone right">';
877 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
878 print $formfile->getDocumentsLink($expensereportstatic->element, $filename, $filedir);
880 print
'</tr></table>';
883 $totalarray[
'nbfield']++;
887 if (!empty($arrayfields[
'user'][
'checked'])) {
888 print
'<td class="left">';
889 print $usertmp->getNomUrl(-1);
892 $totalarray[
'nbfield']++;
896 if (!empty($arrayfields[
'd.date_debut'][
'checked'])) {
897 print
'<td class="center">'.($obj->date_debut > 0 ?
dol_print_date($db->jdate($obj->date_debut),
'day') :
'').
'</td>';
899 $totalarray[
'nbfield']++;
903 if (!empty($arrayfields[
'd.date_fin'][
'checked'])) {
904 print
'<td class="center">'.($obj->date_fin > 0 ?
dol_print_date($db->jdate($obj->date_fin),
'day') :
'').
'</td>';
906 $totalarray[
'nbfield']++;
910 if (!empty($arrayfields[
'd.date_valid'][
'checked'])) {
911 print
'<td class="center">'.($obj->date_valid > 0 ?
dol_print_date($db->jdate($obj->date_valid),
'day') :
'').
'</td>';
913 $totalarray[
'nbfield']++;
917 if (!empty($arrayfields[
'd.date_approve'][
'checked'])) {
918 print
'<td class="center">'.($obj->date_approve > 0 ?
dol_print_date($db->jdate($obj->date_approve),
'day') :
'').
'</td>';
920 $totalarray[
'nbfield']++;
924 if (!empty($arrayfields[
'd.total_ht'][
'checked'])) {
925 print
'<td class="right">'.price($obj->total_ht).
"</td>\n";
927 $totalarray[
'nbfield']++;
930 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'd.total_ht';
932 $totalarray[
'val'][
'd.total_ht'] += $obj->total_ht;
935 if (!empty($arrayfields[
'd.total_vat'][
'checked'])) {
936 print
'<td class="right">'.price($obj->total_tva).
"</td>\n";
938 $totalarray[
'nbfield']++;
941 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'd.total_tva';
943 $totalarray[
'val'][
'd.total_tva'] += $obj->total_tva;
946 if (!empty($arrayfields[
'd.total_ttc'][
'checked'])) {
947 print
'<td class="right">'.price($obj->total_ttc).
"</td>\n";
949 $totalarray[
'nbfield']++;
952 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'd.total_ttc';
954 $totalarray[
'val'][
'd.total_ttc'] += $obj->total_ttc;
958 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
960 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
961 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
962 print $hookmanager->resPrint;
965 if (!empty($arrayfields[
'd.date_create'][
'checked'])) {
966 print
'<td class="nowrap center">';
970 $totalarray[
'nbfield']++;
974 if (!empty($arrayfields[
'd.tms'][
'checked'])) {
975 print
'<td class="nowrap center">';
979 $totalarray[
'nbfield']++;
983 if (!empty($arrayfields[
'd.fk_statut'][
'checked'])) {
984 print
'<td class="nowrap center">'.$expensereportstatic->getLibStatut(5).
'</td>';
986 $totalarray[
'nbfield']++;
991 print
'<td class="nowrap center">';
992 if ($massactionbutton || $massaction) {
994 if (in_array($obj->rowid, $arrayofselected)) {
997 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1001 $totalarray[
'nbfield']++;
1008 $total_total_ht = $total_total_ht + $obj->total_ht;
1009 $total_total_tva = $total_total_tva + $obj->total_tva;
1010 $total_total_ttc = $total_total_ttc + $obj->total_ttc;
1017include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1022 foreach ($arrayfields as $key => $val) {
1023 if (!empty($val[
'checked'])) {
1027 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1032$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1033$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1034print $hookmanager->resPrint;
1036print
'</table>'.
"\n";
1039print
'</form>'.
"\n";
1042 $hidegeneratedfilelistifempty = 1;
1043 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1044 $hidegeneratedfilelistifempty = 0;
1048 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1049 $urlsource .= str_replace(
'&',
'&', $param);
1051 $filedir = $diroutputmassaction;
1052 $genallowed = $user->hasRight(
'expensereport',
'lire');
1053 $delallowed = $user->hasRight(
'expensereport',
'creer');
1055 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()
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...
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
user_prepare_head(User $object)
Prepare array with list of tabs.