29 require
'../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
34 require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
41 $langs->loadLangs(array(
'users',
'other',
'holiday',
'hrm'));
44 if ($user->socid > 0) {
48 $action =
GETPOST(
'action',
'aZ09');
49 $massaction =
GETPOST(
'massaction',
'alpha');
50 $show_files =
GETPOST(
'show_files',
'int');
51 $confirm =
GETPOST(
'confirm',
'alpha');
52 $cancel =
GETPOST(
'cancel',
'alpha');
53 $toselect =
GETPOST(
'toselect',
'array');
54 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'holidaylist';
56 $backtopage =
GETPOST(
'backtopage',
'alpha');
57 $optioncss =
GETPOST(
'optioncss',
'aZ');
61 $childids = $user->getAllChildIds(1);
64 $diroutputmassaction = $conf->holiday->dir_output.
'/temp/massgeneration/'.$user->id;
68 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
69 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
70 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
72 if (empty($page) || $page == -1) {
75 $offset = $limit * $page;
76 $pageprev = $page - 1;
77 $pagenext = $page + 1;
82 $sortfield =
"cp.ref";
85 $sall = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
86 $search_ref =
GETPOST(
'search_ref',
'alphanohtml');
87 $search_day_create =
GETPOST(
'search_day_create',
'int');
88 $search_month_create =
GETPOST(
'search_month_create',
'int');
89 $search_year_create =
GETPOST(
'search_year_create',
'int');
90 $search_day_start =
GETPOST(
'search_day_start',
'int');
91 $search_month_start =
GETPOST(
'search_month_start',
'int');
92 $search_year_start =
GETPOST(
'search_year_start',
'int');
93 $search_day_end =
GETPOST(
'search_day_end',
'int');
94 $search_month_end =
GETPOST(
'search_month_end',
'int');
95 $search_year_end =
GETPOST(
'search_year_end',
'int');
96 $search_employee =
GETPOST(
'search_employee',
'int');
97 $search_valideur =
GETPOST(
'search_valideur',
'int');
99 $search_type =
GETPOST(
'search_type',
'int');
104 $hookmanager->initHooks(array(
'holidaylist'));
107 $extrafields->fetch_name_optionals_label($object->table_element);
109 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
112 $fieldstosearchall = array(
114 'cp.description'=>
'Description',
115 'uu.lastname'=>
'EmployeeLastname',
116 'uu.firstname'=>
'EmployeeFirstname',
120 $arrayfields = array(
121 'cp.ref'=>array(
'label'=>$langs->trans(
"Ref"),
'checked'=>1),
122 'cp.fk_user'=>array(
'label'=>$langs->trans(
"Employee"),
'checked'=>1,
'position'=>20),
123 'cp.fk_validator'=>array(
'label'=>$langs->trans(
"ValidatorCP"),
'checked'=>1,
'position'=>30),
124 'cp.fk_type'=>array(
'label'=>$langs->trans(
"Type"),
'checked'=>1,
'position'=>35),
125 'duration'=>array(
'label'=>$langs->trans(
"NbUseDaysCPShort"),
'checked'=>1,
'position'=>38),
126 'cp.date_debut'=>array(
'label'=>$langs->trans(
"DateStart"),
'checked'=>1,
'position'=>40),
127 'cp.date_fin'=>array(
'label'=>$langs->trans(
"DateEnd"),
'checked'=>1,
'position'=>42),
128 'cp.date_valid'=>array(
'label'=>$langs->trans(
"DateValidation"),
'checked'=>1,
'position'=>60),
129 'cp.date_approval'=>array(
'label'=>$langs->trans(
"DateApprove"),
'checked'=>1,
'position'=>70),
130 'cp.date_create'=>array(
'label'=>$langs->trans(
"DateCreation"),
'checked'=>0,
'position'=>500),
131 'cp.tms'=>array(
'label'=>$langs->trans(
"DateModificationShort"),
'checked'=>0,
'position'=>501),
132 'cp.statut'=>array(
'label'=>$langs->trans(
"Status"),
'checked'=>1,
'position'=>1000),
135 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
140 if ($user->socid > 0) {
145 if (empty($conf->holiday->enabled))
accessforbidden(
'Module not enabled');
151 if ($id == $user->id) {
154 if (!empty($user->rights->holiday->readall)) {
157 if (!empty($user->rights->holiday->read) && in_array($id, $childids)) {
172 if (
GETPOST(
'cancel',
'alpha')) {
173 $action =
'list'; $massaction =
'';
175 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
179 $parameters = array(
'socid'=>$socid);
180 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
185 if (empty($reshook)) {
187 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
190 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
192 $search_month_create =
"";
193 $search_year_create =
"";
194 $search_month_start =
"";
195 $search_year_start =
"";
196 $search_month_end =
"";
197 $search_year_end =
"";
198 $search_employee =
"";
199 $search_valideur =
"";
203 $search_array_options = array();
205 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
206 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
211 $objectclass =
'Holiday';
212 $objectlabel =
'Holiday';
213 $permissiontoread = $user->hasRight(
'holiday',
'read');
214 $permissiontodelete = $user->hasRight(
'holiday',
'delete');
215 $permissiontoapprove = $user->hasRight(
'holiday',
'approve');
216 $uploaddir = $conf->holiday->dir_output;
217 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
231 $fuser =
new User($db);
232 $holidaystatic =
new Holiday($db);
235 $result = $object->updateBalance();
237 $title = $langs->trans(
'CPTitreMenu');
244 $user_id = $user->id;
248 $fuser->fetch($id,
'',
'', 1);
250 $user_id = $fuser->id;
252 $search_employee = $user_id;
259 $sql .=
" cp.rowid,";
262 $sql .=
" cp.fk_user,";
263 $sql .=
" cp.fk_type,";
264 $sql .=
" cp.date_create,";
265 $sql .=
" cp.tms as date_update,";
266 $sql .=
" cp.description,";
267 $sql .=
" cp.date_debut,";
268 $sql .=
" cp.date_fin,";
269 $sql .=
" cp.halfday,";
270 $sql .=
" cp.statut as status,";
271 $sql .=
" cp.fk_validator,";
272 $sql .=
" cp.date_valid,";
273 $sql .=
" cp.fk_user_valid,";
274 $sql .=
" cp.date_approval,";
275 $sql .=
" cp.fk_user_approve,";
276 $sql .=
" cp.date_refuse,";
277 $sql .=
" cp.fk_user_refuse,";
278 $sql .=
" cp.date_cancel,";
279 $sql .=
" cp.fk_user_cancel,";
280 $sql .=
" cp.detail_refuse,";
282 $sql .=
" uu.lastname as user_lastname,";
283 $sql .=
" uu.firstname as user_firstname,";
284 $sql .=
" uu.admin as user_admin,";
285 $sql .=
" uu.email as user_email,";
286 $sql .=
" uu.login as user_login,";
287 $sql .=
" uu.statut as user_status,";
288 $sql .=
" uu.photo as user_photo,";
290 $sql .=
" ua.lastname as validator_lastname,";
291 $sql .=
" ua.firstname as validator_firstname,";
292 $sql .=
" ua.admin as validator_admin,";
293 $sql .=
" ua.email as validator_email,";
294 $sql .=
" ua.login as validator_login,";
295 $sql .=
" ua.statut as validator_status,";
296 $sql .=
" ua.photo as validator_photo";
298 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
299 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
300 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
304 $parameters = array();
305 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
306 $sql .= $hookmanager->resPrint;
310 $sql .=
" FROM ".MAIN_DB_PREFIX.
"holiday as cp";
311 if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
312 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (cp.rowid = ef.fk_object)";
314 $sql .=
", ".MAIN_DB_PREFIX.
"user as uu, ".MAIN_DB_PREFIX.
"user as ua";
315 $sql .=
" WHERE cp.entity IN (".getEntity(
'holiday').
")";
316 $sql .=
" AND cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid ";
322 if (!empty($search_ref)) {
326 $sql .=
dolSqlDateFilter(
"cp.date_debut", $search_day_start, $search_month_start, $search_year_start);
328 $sql .=
dolSqlDateFilter(
"cp.date_fin", $search_day_end, $search_month_end, $search_year_end);
330 $sql .=
dolSqlDateFilter(
"cp.date_create", $search_day_create, $search_month_create, $search_year_create);
332 if (!empty($search_employee) && $search_employee != -1) {
333 $sql .=
" AND cp.fk_user = '".$db->escape($search_employee).
"'\n";
336 if (!empty($search_valideur) && $search_valideur != -1) {
337 $sql .=
" AND cp.fk_validator = '".$db->escape($search_valideur).
"'\n";
340 if (!empty($search_type) && $search_type != -1) {
341 $sql .=
' AND cp.fk_type IN ('.$db->sanitize($db->escape($search_type)).
')';
344 if (!empty($search_status) && $search_status != -1) {
345 $sql .=
" AND cp.statut = '".$db->escape($search_status).
"'\n";
348 if (empty($user->rights->holiday->readall)) {
349 $sql .=
' AND cp.fk_user IN ('.$db->sanitize(join(
',', $childids)).
')';
352 $sql .=
" AND cp.fk_user IN (".$db->sanitize($id).
")";
356 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
358 $parameters = array();
359 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
360 $sql .= $hookmanager->resPrint;
364 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
366 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
367 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
368 $resql = $db->query($sqlforcount);
370 $objforcount = $db->fetch_object(
$resql);
384 $sql .= $db->order($sortfield, $sortorder);
386 $sql .= $db->plimit($limit + 1, $offset);
390 $resql = $db->query($sql);
392 $num = $db->num_rows(
$resql);
394 $arrayofselected = is_array($toselect) ? $toselect : array();
397 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
398 $param .=
'&contextpage='.urlencode($contextpage);
400 if ($limit > 0 && $limit != $conf->liste_limit) {
401 $param .=
'&limit='.urlencode($limit);
403 if ($optioncss !=
'') {
404 $param .=
'&optioncss='.urlencode($optioncss);
407 $param .=
'&search_ref='.urlencode($search_ref);
409 if ($search_day_create) {
410 $param .=
'&search_day_create='.urlencode($search_day_create);
412 if ($search_month_create) {
413 $param .=
'&search_month_create='.urlencode($search_month_create);
415 if ($search_year_create) {
416 $param .=
'&search_year_create='.urlencode($search_year_create);
418 if ($search_day_start) {
419 $param .=
'&search_day_start='.urlencode($search_day_start);
421 if ($search_month_start) {
422 $param .=
'&search_month_start='.urlencode($search_month_start);
424 if ($search_year_start) {
425 $param .=
'&search_year_start='.urlencode($search_year_start);
427 if ($search_day_end) {
428 $param .=
'&search_day_end='.urlencode($search_day_end);
430 if ($search_month_end) {
431 $param .=
'&search_month_end='.urlencode($search_month_end);
433 if ($search_year_end) {
434 $param .=
'&search_year_end='.urlencode($search_year_end);
436 if ($search_employee > 0) {
437 $param .=
'&search_employee='.urlencode($search_employee);
439 if ($search_valideur > 0) {
440 $param .=
'&search_valideur='.urlencode($search_valideur);
442 if ($search_type > 0) {
443 $param .=
'&search_type='.urlencode($search_type);
445 if ($search_status > 0) {
446 $param .=
'&search_status='.urlencode($search_status);
449 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
452 $arrayofmassactions = array(
457 if (!empty($user->rights->holiday->delete)) {
458 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
460 if (!empty($user->rights->holiday->approve)) {
461 $arrayofmassactions[
'preapproveleave'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Approve");
463 if (in_array($massaction, array(
'presend',
'predelete'))) {
464 $arrayofmassactions = array();
466 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
469 print
'<form id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">'.
"\n";
470 if ($optioncss !=
'') {
471 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
473 print
'<input type="hidden" name="token" value="'.newToken().
'">';
474 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
475 print
'<input type="hidden" name="action" value="'.($action ==
'edit' ?
'update' :
'list').
'">';
476 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
477 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
478 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
480 print
'<input type="hidden" name="id" value="'.$id.
'">';
484 $title = $langs->trans(
"User");
485 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
490 dol_banner_tab($fuser,
'id', $linkback, $user->rights->user->user->lire || $user->admin);
492 if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) {
493 print
'<div class="underbanner clearboth"></div>';
504 print
'<div class="tabsAction">';
507 if (!empty($user->rights->holiday->writeall)) {
510 if (!empty($user->rights->holiday->write) && in_array($user_id, $childids)) {
515 print
'<a href="'.DOL_URL_ROOT.
'/holiday/card.php?action=create&fuserid='.$user_id.
'" class="butAction">'.$langs->trans(
"AddCP").
'</a>';
520 $title = $langs->trans(
"ListeCP");
522 $newcardbutton =
dolGetButtonTitle($langs->trans(
'MenuAddCP'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/holiday/card.php?action=create',
'', $user->rights->holiday->write);
524 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num,
$nbtotalofrecords,
'title_hrm', 0, $newcardbutton,
'', $limit, 0, 0, 1);
527 $topicmail =
"Information";
528 $modelmail =
"leaverequest";
530 $trackid =
'leav'.$object->id;
531 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
534 foreach ($fieldstosearchall as $key => $val) {
535 $fieldstosearchall[$key] = $langs->trans($val);
537 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
542 $parameters = array();
543 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
544 if (empty($reshook)) {
545 $moreforfilter .= $hookmanager->resPrint;
547 $moreforfilter = $hookmanager->resPrint;
550 if (!empty($moreforfilter)) {
551 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
552 print $moreforfilter;
556 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
557 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
558 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
562 if (empty($user->rights->holiday->readall)) {
563 $include =
'hierarchyme';
566 print
'<div class="div-table-responsive">';
567 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
571 print
'<tr class="liste_titre_filter">';
574 print
'<td class="liste_titre maxwidthsearch">';
575 $searchpicto =
$form->showFilterButtons(
'left');
579 if (!empty($arrayfields[
'cp.ref'][
'checked'])) {
580 print
'<td class="liste_titre">';
581 print
'<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
585 if (!empty($arrayfields[
'cp.fk_user'][
'checked'])) {
587 if (!empty($conf->global->HOLIDAY_HIDE_FOR_NON_SALARIES)) {
588 $morefilter =
'AND employee = 1';
595 $search_employee = $id;
599 print
'<td class="liste_titre maxwidthonsmartphone left">';
600 print
$form->select_dolusers($search_employee,
"search_employee", 1,
"", $disabled, $include,
'', 0, 0, 0, $morefilter, 0,
'',
'maxwidth150');
605 if (!empty($arrayfields[
'cp.fk_validator'][
'checked'])) {
606 if ($user->hasRight(
'holiday',
'readall')) {
607 print
'<td class="liste_titre maxwidthonsmartphone left">';
609 $excludefilter = $user->admin ?
'' :
'u.rowid <> '.$user->id;
610 $valideurobjects = $validator->listUsersForGroup($excludefilter);
611 $valideurarray = array();
612 foreach ($valideurobjects as $val) {
613 $valideurarray[$val->id] = $val->id;
615 print
$form->select_dolusers($search_valideur,
"search_valideur", 1,
"", 0, $valideurarray,
'', 0, 0, 0, $morefilter, 0,
'',
'maxwidth150');
618 print
'<td class="liste_titre"> </td>';
623 if (!empty($arrayfields[
'cp.fk_type'][
'checked'])) {
624 print
'<td class="liste_titre">';
625 if (empty($mysoc->country_id)) {
626 setEventMessages(
null, array($langs->trans(
"ErrorSetACountryFirst"), $langs->trans(
"CompanyFoundation")),
'errors');
628 $typeleaves = $holidaystatic->getTypes(1, -1);
629 $arraytypeleaves = array();
630 foreach ($typeleaves as $key => $val) {
631 $labeltoshow = ($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']);
633 $arraytypeleaves[$val[
'rowid']] = $labeltoshow;
635 print
$form->selectarray(
'search_type', $arraytypeleaves, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'', 1);
641 if (!empty($arrayfields[
'duration'][
'checked'])) {
642 print
'<td class="liste_titre"> </td>';
646 if (!empty($arrayfields[
'cp.date_debut'][
'checked'])) {
647 print
'<td class="liste_titre center nowraponall">';
648 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_start" value="'.dol_escape_htmltag($search_month_start).
'">';
649 print $formother->selectyear($search_year_start,
'search_year_start', 1, $min_year, $max_year);
654 if (!empty($arrayfields[
'cp.date_fin'][
'checked'])) {
655 print
'<td class="liste_titre center nowraponall">';
656 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_end" value="'.dol_escape_htmltag($search_month_end).
'">';
657 print $formother->selectyear($search_year_end,
'search_year_end', 1, $min_year, $max_year);
662 if (!empty($arrayfields[
'cp.date_valid'][
'checked'])) {
663 print
'<td class="liste_titre center nowraponall">';
668 if (!empty($arrayfields[
'cp.date_approval'][
'checked'])) {
669 print
'<td class="liste_titre center nowraponall">';
674 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
676 $parameters = array(
'arrayfields'=>$arrayfields);
677 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
678 print $hookmanager->resPrint;
681 if (!empty($arrayfields[
'cp.date_create'][
'checked'])) {
682 print
'<td class="liste_titre center width200">';
683 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_create" value="'.dol_escape_htmltag($search_month_create).
'">';
684 print $formother->selectyear($search_year_create,
'search_year_create', 1, $min_year, 0);
689 if (!empty($arrayfields[
'cp.tms'][
'checked'])) {
690 print
'<td class="liste_titre center width200">';
691 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_update" value="'.dol_escape_htmltag($search_month_update).
'">';
692 print $formother->selectyear($search_year_update,
'search_year_update', 1, $min_year, 0);
697 if (!empty($arrayfields[
'cp.statut'][
'checked'])) {
698 print
'<td class="liste_titre right">';
699 $object->selectStatutCP($search_status,
'search_status',
'minwidth125');
705 print
'<td class="liste_titre maxwidthsearch">';
706 $searchpicto =
$form->showFilterButtons();
713 print
'<tr class="liste_titre">';
715 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch center ');
717 if (!empty($arrayfields[
'cp.ref'][
'checked'])) {
718 print_liste_field_titre($arrayfields[
'cp.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.ref",
"", $param,
'', $sortfield, $sortorder);
720 if (!empty($arrayfields[
'cp.fk_user'][
'checked'])) {
721 print_liste_field_titre($arrayfields[
'cp.fk_user'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.fk_user",
"", $param,
'', $sortfield, $sortorder);
723 if (!empty($arrayfields[
'cp.fk_validator'][
'checked'])) {
724 print_liste_field_titre($arrayfields[
'cp.fk_validator'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.fk_validator",
"", $param,
'', $sortfield, $sortorder);
726 if (!empty($arrayfields[
'cp.fk_type'][
'checked'])) {
727 print_liste_field_titre($arrayfields[
'cp.fk_type'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder);
729 if (!empty($arrayfields[
'duration'][
'checked'])) {
730 print_liste_field_titre($arrayfields[
'duration'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right maxwidth100');
732 if (!empty($arrayfields[
'cp.date_debut'][
'checked'])) {
733 print_liste_field_titre($arrayfields[
'cp.date_debut'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.date_debut",
"", $param,
'', $sortfield, $sortorder,
'center ');
735 if (!empty($arrayfields[
'cp.date_fin'][
'checked'])) {
736 print_liste_field_titre($arrayfields[
'cp.date_fin'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.date_fin",
"", $param,
'', $sortfield, $sortorder,
'center ');
738 if (!empty($arrayfields[
'cp.date_valid'][
'checked'])) {
739 print_liste_field_titre($arrayfields[
'cp.date_valid'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.date_valid",
"", $param,
'', $sortfield, $sortorder,
'center ');
741 if (!empty($arrayfields[
'cp.date_approval'][
'checked'])) {
742 print_liste_field_titre($arrayfields[
'cp.date_approval'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.date_approval",
"", $param,
'', $sortfield, $sortorder,
'center ');
745 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
747 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
748 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
749 print $hookmanager->resPrint;
750 if (!empty($arrayfields[
'cp.date_create'][
'checked'])) {
751 print_liste_field_titre($arrayfields[
'cp.date_create'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.date_create",
"", $param,
'', $sortfield, $sortorder,
'center ');
753 if (!empty($arrayfields[
'cp.tms'][
'checked'])) {
754 print_liste_field_titre($arrayfields[
'cp.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.tms",
"", $param,
'', $sortfield, $sortorder,
'center ');
756 if (!empty($arrayfields[
'cp.statut'][
'checked'])) {
757 print_liste_field_titre(
"Status", $_SERVER[
"PHP_SELF"],
"cp.statut",
"", $param,
'', $sortfield, $sortorder,
'right ');
760 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch center ');
764 $listhalfday = array(
'morning'=>$langs->trans(
"Morning"),
"afternoon"=>$langs->trans(
"Afternoon"));
768 if ($id && empty($user->rights->holiday->readall) && !in_array($id, $childids)) {
769 $langs->load(
"errors");
770 print
'<tr class="oddeven opacitymediuem"><td colspan="10">'.$langs->trans(
"NotEnoughPermissions").
'</td></tr>';
772 } elseif ($num > 0 && !empty($mysoc->country_id)) {
774 $userstatic =
new User($db);
775 $approbatorstatic =
new User($db);
777 $typeleaves = $object->getTypes(1, -1);
780 $totalarray = array();
781 $totalarray[
'nbfield'] = 0;
783 while ($i < min($num, $limit)) {
784 $obj = $db->fetch_object(
$resql);
787 $holidaystatic->id = $obj->rowid;
788 $holidaystatic->ref = ($obj->ref ? $obj->ref : $obj->rowid);
789 $holidaystatic->statut = $obj->status;
790 $holidaystatic->date_debut = $db->jdate($obj->date_debut);
793 $userstatic->id = $obj->fk_user;
794 $userstatic->lastname = $obj->user_lastname;
795 $userstatic->firstname = $obj->user_firstname;
796 $userstatic->admin = $obj->user_admin;
797 $userstatic->email = $obj->user_email;
798 $userstatic->login = $obj->user_login;
799 $userstatic->statut = $obj->user_status;
800 $userstatic->photo = $obj->user_photo;
803 $approbatorstatic->id = $obj->fk_validator;
804 $approbatorstatic->lastname = $obj->validator_lastname;
805 $approbatorstatic->firstname = $obj->validator_firstname;
806 $approbatorstatic->admin = $obj->validator_admin;
807 $approbatorstatic->email = $obj->validator_email;
808 $approbatorstatic->login = $obj->validator_login;
809 $approbatorstatic->statut = $obj->validator_status;
810 $approbatorstatic->photo = $obj->validator_photo;
812 $date = $obj->date_create;
813 $date_modif = $obj->date_update;
815 $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ?
'afternoon' :
'morning';
816 $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ?
'morning' :
'afternoon';
818 print
'<tr class="oddeven">';
821 print
'<td class="nowrap center">';
822 if ($massactionbutton || $massaction) {
824 if (in_array($obj->rowid, $arrayofselected)) {
827 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
831 if (!empty($arrayfields[
'cp.ref'][
'checked'])) {
832 print
'<td class="nowraponall">';
833 print $holidaystatic->getNomUrl(1, 1);
836 $totalarray[
'nbfield']++;
839 if (!empty($arrayfields[
'cp.fk_user'][
'checked'])) {
840 print
'<td class="tdoverflowmax125">'.$userstatic->getNomUrl(-1,
'leave').
'</td>';
842 $totalarray[
'nbfield']++;
845 if (!empty($arrayfields[
'cp.fk_validator'][
'checked'])) {
846 print
'<td class="tdoverflowmax125">'.$approbatorstatic->getNomUrl(-1).
'</td>';
848 $totalarray[
'nbfield']++;
851 if (!empty($arrayfields[
'cp.fk_type'][
'checked'])) {
852 $labeltypeleavetoshow = ($langs->trans($typeleaves[$obj->fk_type][
'code']) != $typeleaves[$obj->fk_type][
'code'] ? $langs->trans($typeleaves[$obj->fk_type][
'code']) : $typeleaves[$obj->fk_type][
'label']);
853 $labeltypeleavetoshow = empty($typeleaves[$obj->fk_type][
'label']) ? $langs->trans(
"TypeWasDisabledOrRemoved", $obj->fk_type) : $labeltypeleavetoshow;
855 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($labeltypeleavetoshow).
'">';
856 print $labeltypeleavetoshow;
859 $totalarray[
'nbfield']++;
862 if (!empty($arrayfields[
'duration'][
'checked'])) {
863 print
'<td class="right">';
864 $nbopenedday =
num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday);
865 $totalduration += $nbopenedday;
870 $totalarray[
'nbfield']++;
873 if (!empty($arrayfields[
'cp.date_debut'][
'checked'])) {
874 print
'<td class="center">';
876 print
' <span class="opacitymedium nowraponall">('.$langs->trans($listhalfday[$starthalfday]).
')</span>';
879 $totalarray[
'nbfield']++;
882 if (!empty($arrayfields[
'cp.date_fin'][
'checked'])) {
883 print
'<td class="center">';
885 print
' <span class="opacitymedium nowraponall">('.$langs->trans($listhalfday[$endhalfday]).
')</span>';
888 $totalarray[
'nbfield']++;
892 if (!empty($arrayfields[
'cp.date_valid'][
'checked'])) {
893 print
'<td class="center" title="'.dol_print_date($db->jdate($obj->date_valid),
'dayhour').
'">';
896 if (!$i) $totalarray[
'nbfield']++;
899 if (!empty($arrayfields[
'cp.date_approval'][
'checked'])) {
900 print
'<td class="center" title="'.dol_print_date($db->jdate($obj->date_approval),
'dayhour').
'">';
903 if (!$i) $totalarray[
'nbfield']++;
907 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
909 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
910 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
911 print $hookmanager->resPrint;
914 if (!empty($arrayfields[
'cp.date_create'][
'checked'])) {
915 print
'<td style="text-align: center;">'.dol_print_date($date,
'dayhour').
'</td>';
917 $totalarray[
'nbfield']++;
920 if (!empty($arrayfields[
'cp.tms'][
'checked'])) {
921 print
'<td style="text-align: center;">'.dol_print_date($date_modif,
'dayhour').
'</td>';
923 $totalarray[
'nbfield']++;
926 if (!empty($arrayfields[
'cp.statut'][
'checked'])) {
927 print
'<td class="right nowrap">'.$holidaystatic->getLibStatut(5).
'</td>';
929 $totalarray[
'nbfield']++;
935 print
'<td class="nowrap center">';
936 if ($massactionbutton || $massaction) {
938 if (in_array($obj->rowid, $arrayofselected)) {
941 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
946 $totalarray[
'nbfield']++;
955 if (!empty($arrayfields[
'duration'][
'checked'])) {
956 print
'<tr class="total">';
957 foreach ($arrayfields as $key => $val) {
958 if (!empty($val[
'checked'])) {
959 if ($key ==
'duration') {
960 print
'<td class="right">'.$totalduration.
' '.$langs->trans(
'DurationDays').
'</td>';
975 foreach ($arrayfields as $key => $val) {
976 if (!empty($val[
'checked'])) {
980 print
'<tr><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</td></tr>';
1008 global $conf, $langs;
1010 $alltypeleaves = $holiday->getTypes(1, -1);
1014 $typeleaves = $holiday->getTypes(1, 1);
1015 foreach ($typeleaves as $key => $val) {
1016 $nb_type = $holiday->getCPforUser($user_id, $val[
'rowid']);
1017 $nb_holiday += $nb_type;
1018 $out .=
' - '.$val[
'label'].
': <strong>'.($nb_type ?
price2num($nb_type) : 0).
'</strong><br>';
1020 print $langs->trans(
'SoldeCPUser', round($nb_holiday, 5)).
'<br>';
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class of the module paid holiday.
Class to manage user groups.
Class to manage Dolibarr users.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $excludefirstand=0, $gm=false)
Generate a SQL string to make a filter into a range (for second of date until last second of date).
num_open_day($timestampStart, $timestampEnd, $inhour=0, $lastday=0, $halfday=0, $country_code='')
Function to return number of working days (and text of units) between two dates (working days)
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.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
showMyBalance($holiday, $user_id)
Show balance of user.
$nbtotalofrecords
Count total nb of records.
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.