32 require
'../main.inc.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
35 require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formexpensereport.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
40 require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport_ik.class.php';
43 $langs->loadLangs(array(
'companies',
'users',
'trips'));
45 $action =
GETPOST(
'action',
'aZ09');
46 $massaction =
GETPOST(
'massaction',
'alpha');
47 $show_files =
GETPOST(
'show_files',
'int');
48 $confirm =
GETPOST(
'confirm',
'alpha');
49 $cancel =
GETPOST(
'cancel',
'alpha');
50 $toselect =
GETPOST(
'toselect',
'array');
51 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'expensereportlist';
53 $childids = $user->getAllChildIds(1);
56 $socid =
GETPOST(
'socid',
'int');
57 if ($user->socid) $socid = $user->socid;
64 if ($id == $user->id) $canread = 1;
65 if (!empty($user->rights->expensereport->readall)) $canread = 1;
66 if (!empty($user->rights->expensereport->lire) && in_array($id, $childids)) $canread = 1;
73 $diroutputmassaction = $conf->expensereport->dir_output.
'/temp/massgeneration/'.$user->id;
77 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
78 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
79 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
81 if (empty($page) || $page == -1) { $page = 0; }
82 $offset = $limit * $page;
83 $pageprev = $page - 1;
84 $pagenext = $page + 1;
85 if (!$sortorder) $sortorder =
"DESC";
86 if (!$sortfield) $sortfield =
"d.date_debut";
89 $sall = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
90 $search_ref =
GETPOST(
'search_ref',
'alpha');
91 $search_user =
GETPOST(
'search_user',
'int');
92 $search_amount_ht =
GETPOST(
'search_amount_ht',
'alpha');
93 $search_amount_vat =
GETPOST(
'search_amount_vat',
'alpha');
94 $search_amount_ttc =
GETPOST(
'search_amount_ttc',
'alpha');
95 $search_status = (
GETPOST(
'search_status',
'intcomma') !=
'' ?
GETPOST(
'search_status',
'intcomma') :
GETPOST(
'statut',
'intcomma'));
96 $month_start =
GETPOST(
"month_start",
"int");
97 $year_start =
GETPOST(
"year_start",
"int");
98 $day_start =
GETPOST(
"day_start",
"int");
99 $day_end =
GETPOST(
"day_end",
"int");
100 $month_end =
GETPOST(
"month_end",
"int");
101 $year_end =
GETPOST(
"year_end",
"int");
102 $optioncss =
GETPOST(
'optioncss',
'alpha');
104 if ($search_status ==
'') $search_status = -1;
105 if ($search_user ==
'') $search_user = -1;
109 $hookmanager->initHooks(array(
'expensereportlist'));
113 $extrafields->fetch_name_optionals_label($object->table_element);
115 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
119 $fieldstosearchall = array(
121 'd.note_public'=>
"NotePublic",
122 'u.lastname'=>
'Lastname',
123 'u.firstname'=>
"Firstname",
126 if (empty($user->socid)) $fieldstosearchall[
"d.note_private"] =
"NotePrivate";
128 $arrayfields = array(
129 'd.ref'=>array(
'label'=>$langs->trans(
"Ref"),
'checked'=>1),
130 'user'=>array(
'label'=>$langs->trans(
"User"),
'checked'=>1),
131 'd.date_debut'=>array(
'label'=>$langs->trans(
"DateStart"),
'checked'=>1),
132 'd.date_fin'=>array(
'label'=>$langs->trans(
"DateEnd"),
'checked'=>1),
133 'd.date_valid'=>array(
'label'=>$langs->trans(
"DateValidation"),
'checked'=>1),
134 'd.date_approve'=>array(
'label'=>$langs->trans(
"DateApprove"),
'checked'=>1),
135 'd.total_ht'=>array(
'label'=>$langs->trans(
"AmountHT"),
'checked'=>1),
136 'd.total_vat'=>array(
'label'=>$langs->trans(
"AmountVAT"),
'checked'=>1),
137 'd.total_ttc'=>array(
'label'=>$langs->trans(
"AmountTTC"),
'checked'=>1),
138 'd.date_create'=>array(
'label'=>$langs->trans(
"DateCreation"),
'checked'=>0,
'position'=>500),
139 'd.tms'=>array(
'label'=>$langs->trans(
"DateModificationShort"),
'checked'=>0,
'position'=>500),
140 'd.fk_statut'=>array(
'label'=>$langs->trans(
"Status"),
'checked'=>1,
'position'=>1000),
143 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
145 $canedituser = (!empty($user->admin) || $user->rights->user->user->creer);
147 $objectuser =
new User($db);
154 if (
GETPOST(
'cancel',
'alpha')) { $action =
'list'; $massaction =
''; }
155 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') { $massaction =
''; }
157 $parameters = array(
'socid'=>$socid);
158 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
159 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
164 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
167 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha'))
171 $search_amount_ht =
"";
172 $search_amount_vat =
"";
173 $search_amount_ttc =
"";
181 $search_array_options = array();
183 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
184 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha'))
190 $objectclass =
'ExpenseReport';
191 $objectlabel =
'ExpenseReport';
192 $permissiontoread = $user->rights->expensereport->lire;
193 $permissiontodelete = $user->rights->expensereport->supprimer;
194 $uploaddir = $conf->expensereport->dir_output;
195 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
203 $form =
new Form($db);
208 $fuser =
new User($db);
210 $title = $langs->trans(
"ListOfTrips");
217 $user_id = $user->id;
222 $fuser->fetch($id,
'',
'', 1);
224 $user_id = $fuser->id;
226 $search_user = $user_id;
229 $sql =
"SELECT d.rowid, d.ref, d.fk_user_author, d.total_ht, d.total_tva, d.total_ttc, d.fk_statut as status,";
230 $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,";
231 $sql .=
" u.rowid as id_user, u.firstname, u.lastname, u.login, u.email, u.statut, u.photo";
233 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
234 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
' as options_'.$key :
'');
237 $parameters = array();
238 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
239 $sql .= $hookmanager->resPrint;
240 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expensereport as d";
241 if (is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (d.rowid = ef.fk_object)";
242 $sql .=
", ".MAIN_DB_PREFIX.
"user as u";
243 $sql .=
" WHERE d.fk_user_author = u.rowid AND d.entity IN (".getEntity(
'expensereport').
")";
245 if (!empty($sall)) $sql .=
natural_search(array_keys($fieldstosearchall), $sall);
247 if (!empty($search_ref)) $sql .=
natural_search(
'd.ref', $search_ref);
249 $sql .=
dolSqlDateFilter(
"d.date_debut", $day_start, $month_start, $year_start);
253 if ($search_amount_ht !=
'') $sql .=
natural_search(
'd.total_ht', $search_amount_ht, 1);
254 if ($search_amount_ttc !=
'') $sql .=
natural_search(
'd.total_ttc', $search_amount_ttc, 1);
256 if ($search_user !=
'' && $search_user >= 0) $sql .=
" AND u.rowid = '".$db->escape($search_user).
"'";
258 if ($search_status !=
'' && $search_status >= 0) $sql .=
" AND d.fk_statut IN (".$db->sanitize($db->escape($search_status)).
")";
260 if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)
261 && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->expensereport->writeall_advance)))
263 $sql .=
" AND d.fk_user_author IN (".join(
',', $childids).
")\n";
266 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
268 $parameters = array();
269 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
270 $sql .= $hookmanager->resPrint;
272 $sql .= $db->order($sortfield, $sortorder);
275 $nbtotalofrecords =
'';
276 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
278 $result = $db->query($sql);
279 $nbtotalofrecords = $db->num_rows($result);
280 if (($page * $limit) > $nbtotalofrecords)
287 $sql .= $db->plimit($limit + 1, $offset);
290 $resql = $db->query($sql);
293 $num = $db->num_rows(
$resql);
295 $arrayofselected = is_array($toselect) ? $toselect : array();
298 if (!empty($contextpage) && $contextpage !=
$_SERVER[
"PHP_SELF"]) $param .=
'&contextpage='.urlencode($contextpage);
299 if ($limit > 0 && $limit != $conf->liste_limit) $param .=
'&limit='.urlencode($limit);
300 if ($sall) $param .=
"&sall=".urlencode($sall);
301 if ($search_ref) $param .=
"&search_ref=".urlencode($search_ref);
302 if ($search_user) $param .=
"&search_user=".urlencode($search_user);
303 if ($search_amount_ht) $param .=
"&search_amount_ht=".urlencode($search_amount_ht);
304 if ($search_amount_ttc) $param .=
"&search_amount_ttc=".urlencode($search_amount_ttc);
305 if ($search_status >= 0) $param .=
"&search_status=".urlencode($search_status);
306 if ($optioncss !=
'') $param .=
'&optioncss='.urlencode($optioncss);
308 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
311 $arrayofmassactions = array(
312 'generate_doc'=>$langs->trans(
"ReGeneratePDF"),
313 'builddoc'=>$langs->trans(
"PDFMerge"),
314 'presend'=>$langs->trans(
"SendByMail"),
316 if ($user->rights->expensereport->supprimer) $arrayofmassactions[
'predelete'] =
'<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans(
"Delete");
317 if (in_array($massaction, array(
'presend',
'predelete'))) $arrayofmassactions = array();
318 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
321 print '<form id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">'.
"\n";
322 if ($optioncss !=
'')
print '<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
323 print '<input type="hidden" name="token" value="'.newToken().
'">';
324 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
325 print '<input type="hidden" name="action" value="'.($action ==
'edit' ?
'update' :
'list').
'">';
326 print '<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
327 print '<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
328 print '<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
329 if ($id > 0)
print '<input type="hidden" name="id" value="'.$id.
'">';
333 $title = $langs->trans(
"User");
334 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
339 dol_banner_tab($fuser,
'id', $linkback, $user->rights->user->user->lire || $user->admin);
343 if ($action !=
'edit')
345 print '<div class="tabsAction">';
347 $childids = $user->getAllChildIds(1);
349 $canedit = ((in_array($user_id, $childids) && $user->rights->expensereport->creer)
350 || ($conf->global->MAIN_USE_ADVANCED_PERMS && $user->rights->expensereport->writeall_advance));
354 print '<a href="'.DOL_URL_ROOT.
'/expensereport/card.php?action=create&fk_user_author='.$fuser->id.
'" class="butAction">'.$langs->trans(
"AddTrip").
'</a>';
356 print '<a href="#" class="butActionRefused" title="'.$langs->trans(
"NotEnoughPermission").
'">'.$langs->trans(
"AddTrip").
'</a>';
361 print '<div class="center">';
362 print '<input type="submit" class="button button-save" name="save" value="'.$langs->trans(
"Save").
'">';
366 $title = $langs->trans(
"ListTripsAndExpenses");
368 $url = DOL_URL_ROOT.
'/expensereport/card.php?action=create';
369 if (!empty($socid)) $url .=
'&socid='.$socid;
370 $newcardbutton =
dolGetButtonTitle($langs->trans(
'NewTrip'),
'',
'fa fa-plus-circle', $url,
'', $user->rights->expensereport->creer);
372 print_barre_liste($title, $page,
$_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'trip', 0, $newcardbutton,
'', $limit, 0, 0, 1);
375 $topicmail =
"SendExpenseReport";
376 $modelmail =
"expensereport";
378 $trackid =
'exp'.$object->id;
379 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
383 foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
384 print '<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
389 $parameters = array();
390 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
391 if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
392 else $moreforfilter = $hookmanager->resPrint;
394 if (!empty($moreforfilter))
396 print '<div class="liste_titre liste_titre_bydiv centpercent">';
397 print $moreforfilter;
401 $varpage = empty($contextpage) ?
$_SERVER[
"PHP_SELF"] : $contextpage;
402 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
403 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
405 print '<div class="div-table-responsive">';
406 print '<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
409 print '<tr class="liste_titre_filter">';
410 if (!empty($arrayfields[
'd.ref'][
'checked']))
412 print
'<td class="liste_titre" align="left">';
413 print
'<input class="flat" size="15" type="text" name="search_ref" value="'.$search_ref.
'">';
417 if (!empty($arrayfields[
'user'][
'checked']))
419 if ($user->rights->expensereport->readall || $user->rights->expensereport->lire_tous)
421 print
'<td class="liste_titre maxwidthonspartphone" align="left">';
422 print $form->select_dolusers($search_user,
'search_user', 1,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth200');
425 print
'<td class="liste_titre"> </td>';
429 if (!empty($arrayfields[
'd.date_debut'][
'checked']))
431 print
'<td class="liste_titre" align="center">';
432 if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
433 print
'<input class="flat width25" type="text" maxlength="2" name="day_start" value="'.dol_escape_htmltag($day_start).
'">';
436 print
'<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="month_start" value="'.$month_start.
'">';
437 $formother->select_year($year_start,
'year_start', 1, $min_year, $max_year);
441 if (!empty($arrayfields[
'd.date_fin'][
'checked']))
443 print
'<td class="liste_titre" align="center">';
444 if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
445 print
'<input class="flat width25" type="text" maxlength="2" name="day_end" value="'.dol_escape_htmltag($day_end).
'">';
447 print
'<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="month_end" value="'.$month_end.
'">';
448 $formother->select_year($year_end,
'year_end', 1, $min_year, $max_year);
452 if (!empty($arrayfields[
'd.date_valid'][
'checked']))
454 print
'<td class="liste_titre" align="center">';
460 if (!empty($arrayfields[
'd.date_approve'][
'checked']))
462 print
'<td class="liste_titre" align="center">';
468 if (!empty($arrayfields[
'd.total_ht'][
'checked']))
470 print
'<td class="liste_titre right"><input class="flat" type="text" size="5" name="search_amount_ht" value="'.$search_amount_ht.
'"></td>';
472 if (!empty($arrayfields[
'd.total_vat'][
'checked']))
474 print
'<td class="liste_titre right"><input class="flat" type="text" size="5" name="search_amount_vat" value="'.$search_amount_vat.
'"></td>';
477 if (!empty($arrayfields[
'd.total_ttc'][
'checked']))
479 print
'<td class="liste_titre right"><input class="flat" type="text" size="5" name="search_amount_ttc" value="'.$search_amount_ttc.
'"></td>';
482 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
485 $parameters = array(
'arrayfields'=>$arrayfields);
486 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
487 print $hookmanager->resPrint;
489 if (!empty($arrayfields[
'd.date_create'][
'checked']))
491 print
'<td class="liste_titre">';
495 if (!empty($arrayfields[
'd.tms'][
'checked']))
497 print
'<td class="liste_titre">';
501 if (!empty($arrayfields[
'd.fk_statut'][
'checked']))
503 print
'<td class="liste_titre right">';
504 $formexpensereport->selectExpensereportStatus($search_status,
'search_status', 1, 1);
508 print
'<td class="liste_titre maxwidthsearch">';
509 $searchpicto = $form->showFilterButtons();
515 print
'<tr class="liste_titre">';
516 if (!empty($arrayfields[
'd.ref'][
'checked']))
print_liste_field_titre($arrayfields[
'd.ref'][
'label'],
$_SERVER[
"PHP_SELF"],
"d.ref",
"", $param,
'', $sortfield, $sortorder);
517 if (!empty($arrayfields[
'user'][
'checked']))
print_liste_field_titre($arrayfields[
'user'][
'label'],
$_SERVER[
"PHP_SELF"],
"u.lastname",
"", $param,
'', $sortfield, $sortorder);
518 if (!empty($arrayfields[
'd.date_debut'][
'checked']))
print_liste_field_titre($arrayfields[
'd.date_debut'][
'label'],
$_SERVER[
"PHP_SELF"],
"d.date_debut",
"", $param,
'align="center"', $sortfield, $sortorder);
519 if (!empty($arrayfields[
'd.date_fin'][
'checked']))
print_liste_field_titre($arrayfields[
'd.date_fin'][
'label'],
$_SERVER[
"PHP_SELF"],
"d.date_fin",
"", $param,
'align="center"', $sortfield, $sortorder);
520 if (!empty($arrayfields[
'd.date_valid'][
'checked']))
print_liste_field_titre($arrayfields[
'd.date_valid'][
'label'],
$_SERVER[
"PHP_SELF"],
"d.date_valid",
"", $param,
'align="center"', $sortfield, $sortorder);
521 if (!empty($arrayfields[
'd.date_approve'][
'checked']))
print_liste_field_titre($arrayfields[
'd.date_approve'][
'label'],
$_SERVER[
"PHP_SELF"],
"d.date_approve",
"", $param,
'align="center"', $sortfield, $sortorder);
522 if (!empty($arrayfields[
'd.total_ht'][
'checked']))
print_liste_field_titre($arrayfields[
'd.total_ht'][
'label'],
$_SERVER[
"PHP_SELF"],
"d.total_ht",
"", $param,
'align="right"', $sortfield, $sortorder);
523 if (!empty($arrayfields[
'd.total_vat'][
'checked']))
print_liste_field_titre($arrayfields[
'd.total_vat'][
'label'],
$_SERVER[
"PHP_SELF"],
"d.total_tva",
"", $param,
'align="right"', $sortfield, $sortorder);
524 if (!empty($arrayfields[
'd.total_ttc'][
'checked']))
print_liste_field_titre($arrayfields[
'd.total_ttc'][
'label'],
$_SERVER[
"PHP_SELF"],
"d.total_ttc",
"", $param,
'align="right"', $sortfield, $sortorder);
526 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
528 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
529 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
530 print $hookmanager->resPrint;
531 if (!empty($arrayfields[
'd.date_create'][
'checked']))
print_liste_field_titre($arrayfields[
'd.date_create'][
'label'],
$_SERVER[
"PHP_SELF"],
"d.date_create",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
532 if (!empty($arrayfields[
'd.tms'][
'checked']))
print_liste_field_titre($arrayfields[
'd.tms'][
'label'],
$_SERVER[
"PHP_SELF"],
"d.tms",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
533 if (!empty($arrayfields[
'd.fk_statut'][
'checked']))
print_liste_field_titre($arrayfields[
'd.fk_statut'][
'label'],
$_SERVER[
"PHP_SELF"],
"d.fk_statut",
"", $param,
'align="right"', $sortfield, $sortorder);
538 $total_total_ttc = 0;
539 $total_total_tva = 0;
542 $usertmp =
new User($db);
547 $totalarray = array();
548 while ($i < min($num, $limit))
550 $obj = $db->fetch_object(
$resql);
552 $expensereportstatic->id = $obj->rowid;
553 $expensereportstatic->ref = $obj->ref;
554 $expensereportstatic->status = $obj->status;
555 $expensereportstatic->date_debut = $db->jdate($obj->date_debut);
556 $expensereportstatic->date_fin = $db->jdate($obj->date_fin);
557 $expensereportstatic->date_create = $db->jdate($obj->date_create);
558 $expensereportstatic->date_modif = $db->jdate($obj->date_modif);
559 $expensereportstatic->date_valid = $db->jdate($obj->date_valid);
560 $expensereportstatic->date_approve = $db->jdate($obj->date_approve);
561 $expensereportstatic->note_private = $obj->note_private;
562 $expensereportstatic->note_public = $obj->note_public;
565 print
'<tr class="oddeven">';
567 if (!empty($arrayfields[
'd.ref'][
'checked'])) {
569 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
570 print
'<td class="nobordernopadding nowrap">';
571 print $expensereportstatic->getNomUrl(1);
574 print
'<td class="nobordernopadding nowrap">';
575 if ($expensereportstatic->status == 2 && $expensereportstatic->hasDelay(
'toappove')) print
img_warning($langs->trans(
"Late"));
576 if ($expensereportstatic->status == 5 && $expensereportstatic->hasDelay(
'topay')) print
img_warning($langs->trans(
"Late"));
577 if (!empty($obj->note_private) || !empty($obj->note_public))
579 print
' <span class="note">';
580 print
'<a href="'.DOL_URL_ROOT.
'/expensereport/note.php?id='.$obj->rowid.
'">'.
img_picto($langs->trans(
"ViewPrivateNote"),
'object_generic').
'</a>';
584 print
'<td width="16" class="nobordernopadding hideonsmartphone right">';
587 $urlsource =
$_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
588 print $formfile->getDocumentsLink($expensereportstatic->element, $filename, $filedir);
590 print
'</tr></table>';
592 if (!$i) $totalarray[
'nbfield']++;
595 if (!empty($arrayfields[
'user'][
'checked'])) {
596 print
'<td class="left">';
597 $usertmp->id = $obj->id_user;
598 $usertmp->lastname = $obj->lastname;
599 $usertmp->firstname = $obj->firstname;
600 $usertmp->login = $obj->login;
601 $usertmp->statut = $obj->statut;
602 $usertmp->photo = $obj->photo;
603 $usertmp->email = $obj->email;
604 print $usertmp->getNomUrl(-1);
606 if (!$i) $totalarray[
'nbfield']++;
609 if (!empty($arrayfields[
'd.date_debut'][
'checked'])) {
610 print
'<td class="center">'.($obj->date_debut > 0 ?
dol_print_date($db->jdate($obj->date_debut),
'day') :
'').
'</td>';
611 if (!$i) $totalarray[
'nbfield']++;
614 if (!empty($arrayfields[
'd.date_fin'][
'checked'])) {
615 print
'<td class="center">'.($obj->date_fin > 0 ?
dol_print_date($db->jdate($obj->date_fin),
'day') :
'').
'</td>';
616 if (!$i) $totalarray[
'nbfield']++;
619 if (!empty($arrayfields[
'd.date_valid'][
'checked'])) {
620 print
'<td class="center">'.($obj->date_valid > 0 ?
dol_print_date($db->jdate($obj->date_valid),
'day') :
'').
'</td>';
621 if (!$i) $totalarray[
'nbfield']++;
624 if (!empty($arrayfields[
'd.date_approve'][
'checked'])) {
625 print
'<td class="center">'.($obj->date_approve > 0 ?
dol_print_date($db->jdate($obj->date_approve),
'day') :
'').
'</td>';
626 if (!$i) $totalarray[
'nbfield']++;
629 if (!empty($arrayfields[
'd.total_ht'][
'checked']))
631 print
'<td class="right">'.price($obj->total_ht).
"</td>\n";
632 if (!$i) $totalarray[
'nbfield']++;
633 if (!$i) $totalarray[
'pos'][$totalarray[
'nbfield']] =
'd.total_ht';
634 $totalarray[
'val'][
'd.total_ht'] += $obj->total_ht;
637 if (!empty($arrayfields[
'd.total_vat'][
'checked']))
639 print
'<td class="right">'.price($obj->total_tva).
"</td>\n";
640 if (!$i) $totalarray[
'nbfield']++;
641 if (!$i) $totalarray[
'pos'][$totalarray[
'nbfield']] =
'd.total_tva';
642 $totalarray[
'val'][
'd.total_tva'] += $obj->total_tva;
645 if (!empty($arrayfields[
'd.total_ttc'][
'checked']))
647 print
'<td class="right">'.price($obj->total_ttc).
"</td>\n";
648 if (!$i) $totalarray[
'nbfield']++;
649 if (!$i) $totalarray[
'pos'][$totalarray[
'nbfield']] =
'd.total_ttc';
650 $totalarray[
'val'][
'd.total_ttc'] += $obj->total_ttc;
654 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
656 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
657 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
658 print $hookmanager->resPrint;
661 if (!empty($arrayfields[
'd.date_create'][
'checked']))
663 print
'<td class="nowrap center">';
666 if (!$i) $totalarray[
'nbfield']++;
669 if (!empty($arrayfields[
'd.tms'][
'checked']))
671 print
'<td class="nowrap center">';
674 if (!$i) $totalarray[
'nbfield']++;
677 if (!empty($arrayfields[
'd.fk_statut'][
'checked']))
679 print
'<td class="nowrap right">'.$expensereportstatic->getLibStatut(5).
'</td>';
680 if (!$i) $totalarray[
'nbfield']++;
683 print
'<td class="nowrap center">';
684 if ($massactionbutton || $massaction)
687 if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
688 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
691 if (!$i) $totalarray[
'nbfield']++;
695 $total_total_ht = $total_total_ht + $obj->total_ht;
696 $total_total_tva = $total_total_tva + $obj->total_tva;
697 $total_total_ttc = $total_total_ttc + $obj->total_ttc;
703 foreach ($arrayfields as $key => $val) {
if (!empty($val[
'checked'])) $colspan++; }
704 print
'<tr><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</td></tr>';
708 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
712 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
713 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
714 print $hookmanager->resPrint;
716 print
'</table>'.
"\n";
719 print
'</form>'.
"\n";
723 $hidegeneratedfilelistifempty = 1;
724 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0;
727 $urlsource =
$_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
728 $urlsource .= str_replace(
'&',
'&', $param);
730 $filedir = $diroutputmassaction;
731 $genallowed = $user->rights->expensereport->lire;
732 $delallowed = $user->rights->expensereport->creer;
734 print $formfile->showdocuments(
'massfilesarea_expensereport',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'', null, $hidegeneratedfilelistifempty);
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
user_prepare_head($object)
Prepare array with list of tabs.
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.
Class to manage Dolibarr users.
img_warning($titlealt= 'default', $moreatt= '', $morecss= 'pictowarning')
Show warning logo.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
print_barre_liste($titre, $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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=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 Calling this function terminate execution ...
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...
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $excludefirstand=0)
Generate a SQL string to make a filter into a range (for second of date until last second of date) ...
Class to manage Trips and Expenses.
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_banner_tab($object, $paramid, $morehtml= '', $shownav=1, $fieldid= 'rowid', $fieldref= 'ref', $morehtmlref= '', $moreparam= '', $nodbprefix=0, $morehtmlleft= '', $morehtmlstatus= '', $onlybanner=0, $morehtmlright= '')
Show tab footer of a card.