32require
'../main.inc.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
37require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
52$langs->loadLangs(array(
'users',
'other',
'holiday',
'hrm'));
55if ($user->socid > 0) {
59$action =
GETPOST(
'action',
'aZ09');
60$massaction =
GETPOST(
'massaction',
'alpha');
62$confirm =
GETPOST(
'confirm',
'alpha');
63$cancel =
GETPOST(
'cancel',
'alpha');
64$toselect =
GETPOST(
'toselect',
'array:int');
65$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'holidaylist';
66$mode =
GETPOST(
'mode',
'alpha');
67$backtopage =
GETPOST(
'backtopage',
'alpha');
68$optioncss =
GETPOST(
'optioncss',
'aZ');
72$childids = $user->getAllChildIds(1);
75$diroutputmassaction = $conf->holiday->dir_output.
'/temp/massgeneration/'.$user->id;
80$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
81$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
83if (empty($page) || $page == -1) {
86$offset = $limit * $page;
93 $sortfield =
"cp.date_debut";
96$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
97$search_ref =
GETPOST(
'search_ref',
'alphanohtml');
98$search_day_create =
GETPOST(
'search_day_create',
'int');
99$search_month_create =
GETPOST(
'search_month_create',
'int');
100$search_year_create =
GETPOST(
'search_year_create',
'int');
101$search_day_start =
GETPOST(
'search_day_start',
'int');
102$search_month_start =
GETPOST(
'search_month_start',
'int');
103$search_year_start =
GETPOST(
'search_year_start',
'int');
104$search_day_end =
GETPOST(
'search_day_end',
'int');
105$search_month_end =
GETPOST(
'search_month_end',
'int');
106$search_year_end =
GETPOST(
'search_year_end',
'int');
107$search_employee =
GETPOST(
'search_employee',
'intcomma');
108$search_valideur =
GETPOST(
'search_valideur',
'intcomma');
109$search_status =
GETPOST(
'search_status',
'intcomma');
110$search_type =
GETPOST(
'search_type',
'intcomma');
115$hookmanager->initHooks(array(
'holidaylist'));
118$extrafields->fetch_name_optionals_label(
$object->table_element);
120$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
123$fieldstosearchall = array(
125 'cp.description' =>
'Description',
126 'uu.lastname' =>
'EmployeeLastname',
127 'uu.firstname' =>
'EmployeeFirstname',
128 'uu.login' =>
'Login'
132 'cp.ref' => array(
'label' => $langs->trans(
"Ref"),
'checked' =>
'1'),
133 'cp.fk_user' => array(
'label' => $langs->trans(
"Employee"),
'checked' =>
'1',
'position' => 20),
134 'cp.fk_validator' => array(
'label' => $langs->trans(
"ValidatorCP"),
'checked' =>
'1',
'position' => 30),
135 'cp.fk_type' => array(
'label' => $langs->trans(
"Type"),
'checked' =>
'1',
'position' => 35),
136 'duration' => array(
'label' => $langs->trans(
"NbUseDaysCPShort"),
'checked' =>
'1',
'position' => 38),
137 'cp.date_debut' => array(
'label' => $langs->trans(
"DateStart"),
'checked' =>
'1',
'position' => 40),
138 'cp.date_fin' => array(
'label' => $langs->trans(
"DateEnd"),
'checked' =>
'1',
'position' => 42),
139 'cp.date_valid' => array(
'label' => $langs->trans(
"DateValidation"),
'checked' =>
'1',
'position' => 60),
140 'cp.date_approval' => array(
'label' => $langs->trans(
"DateApprove"),
'checked' =>
'1',
'position' => 70),
141 'cp.date_create' => array(
'label' => $langs->trans(
"DateCreation"),
'checked' =>
'0',
'position' => 500),
142 'cp.tms' => array(
'label' => $langs->trans(
"DateModificationShort"),
'checked' =>
'0',
'position' => 501),
143 'cp.statut' => array(
'label' => $langs->trans(
"Status"),
'checked' =>
'1',
'position' => 1000),
146include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
151if ($user->socid > 0) {
156$permissiontoread = $user->hasRight(
'holiday',
'read');
157$permissiontodelete = $user->hasRight(
'holiday',
'delete');
158$permissiontoapprove = $user->hasRight(
'holiday',
'approve');
168 if (
$id == $user->id) {
171 if ($user->hasRight(
'holiday',
'readall')) {
174 if ($user->hasRight(
'holiday',
'read') && in_array(
$id, $childids)) {
188if (
GETPOST(
'cancel',
'alpha')) {
192if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
196$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
197$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
202if (empty($reshook)) {
204 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
207 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
209 $search_month_create =
"";
210 $search_year_create =
"";
211 $search_month_start =
"";
212 $search_year_start =
"";
213 $search_month_end =
"";
214 $search_year_end =
"";
215 $search_employee =
"";
216 $search_valideur =
"";
220 $search_array_options = array();
222 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
223 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
228 $objectclass =
'Holiday';
229 $objectlabel =
'Holiday';
230 $uploaddir = $conf->holiday->dir_output;
231 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
239$form =
new Form($db);
243$fuser =
new User($db);
244$holidaystatic =
new Holiday($db);
247$result =
$object->updateBalance();
249$title = $langs->trans(
'Holidays');
250$help_url =
'EN:Module_Holiday';
252llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-holiday page-list');
262 $fuser->fetch(
$id,
'',
'', 1);
263 $fuser->loadRights();
264 $user_id = $fuser->id;
266 $search_employee = $user_id;
276$sql .=
" cp.fk_user,";
277$sql .=
" cp.fk_type,";
278$sql .=
" cp.date_create,";
279$sql .=
" cp.tms as date_modification,";
280$sql .=
" cp.description,";
281$sql .=
" cp.date_debut,";
282$sql .=
" cp.date_fin,";
283$sql .=
" cp.halfday,";
284$sql .=
" cp.statut as status,";
285$sql .=
" cp.fk_validator,";
286$sql .=
" cp.date_valid,";
287$sql .=
" cp.fk_user_valid,";
288$sql .=
" cp.date_approval,";
289$sql .=
" cp.fk_user_approve,";
290$sql .=
" cp.date_refuse,";
291$sql .=
" cp.fk_user_refuse,";
292$sql .=
" cp.date_cancel,";
293$sql .=
" cp.fk_user_cancel,";
294$sql .=
" cp.detail_refuse,";
296$sql .=
" uu.lastname as user_lastname,";
297$sql .=
" uu.firstname as user_firstname,";
298$sql .=
" uu.admin as user_admin,";
299$sql .=
" uu.email as user_email,";
300$sql .=
" uu.login as user_login,";
301$sql .=
" uu.statut as user_status,";
302$sql .=
" uu.photo as user_photo,";
303$sql .=
" uu.fk_country as user_country_id,";
305$sql .=
" ua.lastname as validator_lastname,";
306$sql .=
" ua.firstname as validator_firstname,";
307$sql .=
" ua.admin as validator_admin,";
308$sql .=
" ua.email as validator_email,";
309$sql .=
" ua.login as validator_login,";
310$sql .=
" ua.statut as validator_status,";
311$sql .=
" ua.photo as validator_photo";
313if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
314 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
315 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
319$parameters = array();
320$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
321$sql .= $hookmanager->resPrint;
322$sql = preg_replace(
'/,\s*$/',
'', $sql);
326$sql .=
" FROM ".MAIN_DB_PREFIX.
"holiday as cp";
327if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
328 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (cp.rowid = ef.fk_object)";
330$sql .=
", ".MAIN_DB_PREFIX.
"user as uu, ".MAIN_DB_PREFIX.
"user as ua";
331$sql .=
" WHERE cp.entity IN (".getEntity(
'holiday').
")";
332$sql .=
" AND cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid ";
334if (!empty($search_all)) {
335 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
338if (!empty($search_ref)) {
342$sql .=
dolSqlDateFilter(
"cp.date_debut", $search_day_start, $search_month_start, $search_year_start);
344$sql .=
dolSqlDateFilter(
"cp.date_fin", $search_day_end, $search_month_end, $search_year_end);
346$sql .=
dolSqlDateFilter(
"cp.date_create", $search_day_create, $search_month_create, $search_year_create);
348if (!empty($search_employee) && $search_employee != -1) {
349 $sql .=
" AND cp.fk_user = '".$db->escape($search_employee).
"'\n";
352if (!empty($search_valideur) && $search_valideur != -1) {
353 $sql .=
" AND cp.fk_validator = '".$db->escape($search_valideur).
"'\n";
356if (!empty($search_type) && $search_type != -1) {
357 $sql .=
' AND cp.fk_type IN ('.$db->sanitize($db->escape($search_type)).
')';
360if (!empty($search_status) && $search_status != -1) {
361 $sql .=
" AND cp.statut = '".$db->escape($search_status).
"'\n";
364if (!$user->hasRight(
'holiday',
'readall')) {
365 $sql .=
' AND cp.fk_user IN ('.$db->sanitize(implode(
',', $childids)).
')';
368 $sql .=
" AND cp.fk_user = ".((int)
$id);
372include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
374$parameters = array();
375$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
376$sql .= $hookmanager->resPrint;
379$nbtotalofrecords =
'';
382 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
383 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
384 $resql = $db->query($sqlforcount);
386 $objforcount = $db->fetch_object($resql);
387 $nbtotalofrecords = $objforcount->nbtotalofrecords;
392 if (($page * $limit) > (
int) $nbtotalofrecords) {
400$sql .= $db->order($sortfield, $sortorder);
402 $sql .= $db->plimit($limit + 1, $offset);
406$resql = $db->query($sql);
412$num = $db->num_rows($resql);
414$arrayofselected = is_array($toselect) ? $toselect : array();
418 $param .=
'&mode='.urlencode($mode);
420if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
421 $param .=
'&contextpage='.urlencode($contextpage);
423if ($limit > 0 && $limit != $conf->liste_limit) {
424 $param .=
'&limit='.((int) $limit);
426if ($optioncss !=
'') {
427 $param .=
'&optioncss='.urlencode($optioncss);
430 $param .=
'&search_ref='.urlencode($search_ref);
432if ($search_day_create) {
433 $param .=
'&search_day_create='.urlencode($search_day_create);
435if ($search_month_create) {
436 $param .=
'&search_month_create='.urlencode($search_month_create);
438if ($search_year_create) {
439 $param .=
'&search_year_create='.urlencode($search_year_create);
441if ($search_day_start) {
442 $param .=
'&search_day_start='.urlencode($search_day_start);
444if ($search_month_start) {
445 $param .=
'&search_month_start='.urlencode($search_month_start);
447if ($search_year_start) {
448 $param .=
'&search_year_start='.urlencode($search_year_start);
450if ($search_day_end) {
451 $param .=
'&search_day_end='.urlencode($search_day_end);
453if ($search_month_end) {
454 $param .=
'&search_month_end='.urlencode($search_month_end);
456if ($search_year_end) {
457 $param .=
'&search_year_end='.urlencode($search_year_end);
459if ($search_employee > 0) {
460 $param .=
'&search_employee='.urlencode($search_employee);
462if ($search_valideur > 0) {
463 $param .=
'&search_valideur='.urlencode((
string) ($search_valideur));
465if ($search_type > 0) {
466 $param .=
'&search_type='.urlencode((
string) ($search_type));
468if ($search_status > 0) {
469 $param .=
'&search_status='.urlencode($search_status);
472include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
475$arrayofmassactions = array(
480if (!empty($permissiontodelete)) {
481 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
483if (!empty($permissiontoapprove)) {
484 $arrayofmassactions[
'preapproveleave'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Approve");
486if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
487 $arrayofmassactions = array();
489$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
491print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
492if ($optioncss !=
'') {
493 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
495print
'<input type="hidden" name="token" value="'.newToken().
'">';
496print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
497print
'<input type="hidden" name="action" value="'.($action ==
'edit' ?
'update' :
'list').
'">';
498print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
499print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
500print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
501print
'<input type="hidden" name="page" value="'.$page.
'">';
502print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
503print
'<input type="hidden" name="page_y" value="">';
504print
'<input type="hidden" name="mode" value="'.$mode.
'">';
506 print
'<input type="hidden" name="id" value="'.$id.
'">';
510 $title = $langs->trans(
"User");
511 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
516 dol_banner_tab($fuser,
'id', $linkback, $user->hasRight(
'user',
'user',
'lire') || $user->admin);
519 print
'<div class="underbanner clearboth"></div>';
530 print
'<div class="tabsAction">';
533 if ($user->hasRight(
'holiday',
'writeall')) {
536 if ($user->hasRight(
'holiday',
'write') && in_array($user_id, $childids)) {
541 print
'<a href="'.DOL_URL_ROOT.
'/holiday/card.php?action=create&fuserid='.$user_id.
'" class="butAction">'.$langs->trans(
"AddCP").
'</a>';
547 $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'));
548 $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'));
550 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'MenuAddCP'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/holiday/card.php?action=create',
'', $user->hasRight(
'holiday',
'write'));
552 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'title_hrm', 0, $newcardbutton,
'', $limit, 0, 0, 1);
555$topicmail =
"Information";
556$modelmail =
"leaverequest";
558$trackid =
'leav'.$object->id;
559include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
563 foreach ($fieldstosearchall as $key => $val) {
564 $fieldstosearchall[$key] = $langs->trans($val);
565 $setupstring .= $key.
"=".$val.
";";
567 print
'<!-- Search done like if HOLIDAY_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
568 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
573$parameters = array();
574$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
575if (empty($reshook)) {
576 $moreforfilter .= $hookmanager->resPrint;
578 $moreforfilter = $hookmanager->resPrint;
581if (!empty($moreforfilter)) {
582 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
583 print $moreforfilter;
587$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
588$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
589$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
590$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
593if (!$user->hasRight(
'holiday',
'readall')) {
594 $include =
'hierarchyme';
597print
'<div class="div-table-responsive">';
598print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
602print
'<tr class="liste_titre_filter">';
605 print
'<td class="liste_titre center maxwidthsearch">';
606 $searchpicto = $form->showFilterButtons(
'left');
610if (!empty($arrayfields[
'cp.ref'][
'checked'])) {
611 print
'<td class="liste_titre">';
612 print
'<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
616if (!empty($arrayfields[
'cp.fk_user'][
'checked'])) {
619 $morefilter =
'AND employee = 1';
625 if (
$id && !GETPOSTISSET(
'search_employee')) {
626 $search_employee =
$id;
630 print
'<td class="liste_titre maxwidthonsmartphone left">';
631 print $form->select_dolusers($search_employee,
"search_employee", 1,
null, $disabled, $include,
'',
'0', 0, 0, $morefilter, 0,
'',
'maxwidth125');
636if (!empty($arrayfields[
'cp.fk_validator'][
'checked'])) {
637 if ($user->hasRight(
'holiday',
'readall')) {
638 print
'<td class="liste_titre maxwidthonsmartphone left">';
640 $excludefilter = $user->admin ?
'' :
'u.rowid <> '.((int) $user->id);
641 $valideurobjects = $validator->listUsersForGroup($excludefilter, 1);
642 $valideurarray = array();
643 foreach ($valideurobjects as $val) {
644 $valideurarray[$val] = $val;
646 print $form->select_dolusers($search_valideur,
"search_valideur", 1,
null, 0, $valideurarray,
'',
'0', 0, 0, $morefilter, 0,
'',
'maxwidth125');
649 print
'<td class="liste_titre"> </td>';
654if (!empty($arrayfields[
'cp.fk_type'][
'checked'])) {
655 print
'<td class="liste_titre">';
656 if (empty(
$mysoc->country_id)) {
657 setEventMessages(
null, array($langs->trans(
"ErrorSetACountryFirst"), $langs->trans(
"CompanyFoundation")),
'errors');
659 $typeleaves = $holidaystatic->getTypes(1, -1);
660 $arraytypeleaves = array();
661 foreach ($typeleaves as $key => $val) {
662 $labeltoshow = ($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']);
664 $arraytypeleaves[$val[
'rowid']] = $labeltoshow;
666 print $form->selectarray(
'search_type', $arraytypeleaves, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100', 1);
672if (!empty($arrayfields[
'duration'][
'checked'])) {
673 print
'<td class="liste_titre"> </td>';
677if (!empty($arrayfields[
'cp.date_debut'][
'checked'])) {
678 print
'<td class="liste_titre center nowraponall">';
679 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_start" value="'.dol_escape_htmltag($search_month_start).
'">';
680 print $formother->selectyear($search_year_start,
'search_year_start', 1, $min_year, $max_year);
685if (!empty($arrayfields[
'cp.date_fin'][
'checked'])) {
686 print
'<td class="liste_titre center nowraponall">';
687 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_end" value="'.dol_escape_htmltag($search_month_end).
'">';
688 print $formother->selectyear($search_year_end,
'search_year_end', 1, $min_year, $max_year);
693if (!empty($arrayfields[
'cp.date_valid'][
'checked'])) {
694 print
'<td class="liste_titre center nowraponall">';
699if (!empty($arrayfields[
'cp.date_approval'][
'checked'])) {
700 print
'<td class="liste_titre center nowraponall">';
705include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
708$parameters = array(
'arrayfields' => $arrayfields);
709$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
710print $hookmanager->resPrint;
713if (!empty($arrayfields[
'cp.date_create'][
'checked'])) {
714 print
'<td class="liste_titre center width200">';
715 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_create" value="'.dol_escape_htmltag($search_month_create).
'">';
716 print $formother->selectyear($search_year_create,
'search_year_create', 1, $min_year, 0);
721if (!empty($arrayfields[
'cp.tms'][
'checked'])) {
722 print
'<td class="liste_titre center width200">';
723 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_update" value="'.dol_escape_htmltag($search_month_update).
'">';
724 print $formother->selectyear($search_year_update,
'search_year_update', 1, $min_year, 0);
729if (!empty($arrayfields[
'cp.statut'][
'checked'])) {
730 print
'<td class="liste_titre center parentonrightofpage">';
731 print
$object->selectStatutCP($search_status,
'search_status',
'search_status width100 onrightofpage');
737 print
'<td class="liste_titre center maxwidthsearch">';
738 $searchpicto = $form->showFilterButtons();
750print
'<tr class="liste_titre">';
752 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
755if (!empty($arrayfields[
'cp.ref'][
'checked'])) {
756 print_liste_field_titre($arrayfields[
'cp.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.ref",
"", $param,
'', $sortfield, $sortorder);
759if (!empty($arrayfields[
'cp.fk_user'][
'checked'])) {
760 print_liste_field_titre($arrayfields[
'cp.fk_user'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.fk_user",
"", $param,
'', $sortfield, $sortorder);
763if (!empty($arrayfields[
'cp.fk_validator'][
'checked'])) {
764 print_liste_field_titre($arrayfields[
'cp.fk_validator'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.fk_validator",
"", $param,
'', $sortfield, $sortorder);
767if (!empty($arrayfields[
'cp.fk_type'][
'checked'])) {
768 print_liste_field_titre($arrayfields[
'cp.fk_type'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder);
771if (!empty($arrayfields[
'duration'][
'checked'])) {
772 print_liste_field_titre($arrayfields[
'duration'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right maxwidth100');
775if (!empty($arrayfields[
'cp.date_debut'][
'checked'])) {
776 print_liste_field_titre($arrayfields[
'cp.date_debut'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.date_debut",
"", $param,
'', $sortfield, $sortorder,
'center ');
779if (!empty($arrayfields[
'cp.date_fin'][
'checked'])) {
780 print_liste_field_titre($arrayfields[
'cp.date_fin'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.date_fin",
"", $param,
'', $sortfield, $sortorder,
'center ');
783if (!empty($arrayfields[
'cp.date_valid'][
'checked'])) {
784 print_liste_field_titre($arrayfields[
'cp.date_valid'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.date_valid",
"", $param,
'', $sortfield, $sortorder,
'center ');
787if (!empty($arrayfields[
'cp.date_approval'][
'checked'])) {
788 print_liste_field_titre($arrayfields[
'cp.date_approval'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.date_approval",
"", $param,
'', $sortfield, $sortorder,
'center ');
792include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
794$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
795$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
796print $hookmanager->resPrint;
797if (!empty($arrayfields[
'cp.date_create'][
'checked'])) {
798 print_liste_field_titre($arrayfields[
'cp.date_create'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.date_create",
"", $param,
'', $sortfield, $sortorder,
'center ');
801if (!empty($arrayfields[
'cp.tms'][
'checked'])) {
802 print_liste_field_titre($arrayfields[
'cp.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.tms",
"", $param,
'', $sortfield, $sortorder,
'center ');
805if (!empty($arrayfields[
'cp.statut'][
'checked'])) {
806 print_liste_field_titre(
"Status", $_SERVER[
"PHP_SELF"],
"cp.statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
811 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
816$listhalfday = array(
'morning' => $langs->trans(
"Morning"),
"afternoon" => $langs->trans(
"Afternoon"));
823if (
$id && !$user->hasRight(
'holiday',
'readall') && !in_array(
$id, $childids)) {
824 $langs->load(
"errors");
825 print
'<tr class="oddeven opacitymedium"><td colspan="10">'.$langs->trans(
"NotEnoughPermissions").
'</td></tr>';
827} elseif ($num > 0 && !empty(
$mysoc->country_id)) {
829 $userstatic =
new User($db);
830 $approbatorstatic =
new User($db);
832 $typeleaves =
$object->getTypes(1, -1);
839 $imaxinloop = ($limit ? min($num, $limit) : $num);
840 while ($i < $imaxinloop) {
841 $obj = $db->fetch_object($resql);
847 $holidaystatic->id = $obj->rowid;
848 $holidaystatic->ref = ($obj->ref ? $obj->ref : $obj->rowid);
849 $holidaystatic->status = $obj->status;
850 $holidaystatic->date_debut = $db->jdate($obj->date_debut);
851 $holidaystatic->date_fin = $db->jdate($obj->date_fin);
854 $userstatic->id = $obj->fk_user;
855 $userstatic->lastname = $obj->user_lastname;
856 $userstatic->firstname = $obj->user_firstname;
857 $userstatic->admin = $obj->user_admin;
858 $userstatic->email = $obj->user_email;
859 $userstatic->login = $obj->user_login;
860 $userstatic->status = $obj->user_status;
861 $userstatic->photo = $obj->user_photo;
862 $userstatic->country_id = $obj->user_country_id;
865 $approbatorstatic->id = $obj->fk_validator;
866 $approbatorstatic->lastname = $obj->validator_lastname;
867 $approbatorstatic->firstname = $obj->validator_firstname;
868 $approbatorstatic->admin = $obj->validator_admin;
869 $approbatorstatic->email = $obj->validator_email;
870 $approbatorstatic->login = $obj->validator_login;
871 $approbatorstatic->status = $obj->validator_status;
872 $approbatorstatic->photo = $obj->validator_photo;
874 $date = $obj->date_create;
875 $date_modif = $obj->date_modification;
877 $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ?
'afternoon' :
'morning';
878 $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ?
'morning' :
'afternoon';
880 $nbopenedday =
num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday, $userstatic->country_id);
881 $totalduration += $nbopenedday;
883 if ($mode ==
'kanban') {
885 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
886 print
'<div class="box-flex-container kanban">';
889 $holidaystatic->fk_type = empty($typeleaves[$obj->fk_type][
'rowid']) ? 0 : $typeleaves[$obj->fk_type][
'rowid'];
891 $arraydata = array();
893 if ($massactionbutton || $massaction) {
895 if (in_array(
$object->id, $arrayofselected)) {
898 if (empty($typeleaves[$obj->fk_type])) {
899 $labeltypeleavetoshow = $langs->trans(
"TypeWasDisabledOrRemoved", $obj->fk_type);
901 $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']);
904 $arraydata = array(
'user' => $userstatic,
'labeltype' => $labeltypeleavetoshow,
'selected' => $selected,
'nbopenedday' => $nbopenedday);
906 print $holidaystatic->getKanbanView(
'', $arraydata);
907 if ($i == ($imaxinloop - 1)) {
914 print
'<tr data-rowid="'.$holidaystatic->id.
'" class="oddeven row-with-select">';
917 print
'<td class="nowrap center">';
918 if ($massactionbutton || $massaction) {
920 if (in_array($obj->rowid, $arrayofselected)) {
923 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
930 if (!empty($arrayfields[
'cp.ref'][
'checked'])) {
931 print
'<td class="nowraponall">';
932 print $holidaystatic->getNomUrl(1, 1);
938 if (!empty($arrayfields[
'cp.fk_user'][
'checked'])) {
939 print
'<td class="tdoverflowmax125">'.$userstatic->getNomUrl(-1,
'leave').
'</td>';
944 if (!empty($arrayfields[
'cp.fk_validator'][
'checked'])) {
945 print
'<td class="tdoverflowmax125">'.$approbatorstatic->getNomUrl(-1).
'</td>';
950 if (!empty($arrayfields[
'cp.fk_type'][
'checked'])) {
951 if (empty($typeleaves[$obj->fk_type])) {
952 $labeltypeleavetoshow = $langs->trans(
"TypeWasDisabledOrRemoved", $obj->fk_type);
954 $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']);
957 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($labeltypeleavetoshow).
'">';
958 print $labeltypeleavetoshow;
964 if (!empty($arrayfields[
'duration'][
'checked'])) {
965 print
'<td class="right">';
973 if (!empty($arrayfields[
'cp.date_debut'][
'checked'])) {
974 print
'<td class="center">';
976 print
' <span class="opacitymedium nowraponall">('.$langs->trans($listhalfday[$starthalfday]).
')</span>';
982 if (!empty($arrayfields[
'cp.date_fin'][
'checked'])) {
983 print
'<td class="center">';
985 print
' <span class="opacitymedium nowraponall">('.$langs->trans($listhalfday[$endhalfday]).
')</span>';
992 if (!empty($arrayfields[
'cp.date_valid'][
'checked'])) {
993 print
'<td class="center" title="'.dol_print_date($db->jdate($obj->date_valid),
'dayhour').
'">';
1001 if (!empty($arrayfields[
'cp.date_approval'][
'checked'])) {
1002 print
'<td class="center" title="'.dol_print_date($db->jdate($obj->date_approval),
'dayhour').
'">';
1011 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1013 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1014 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
1015 print $hookmanager->resPrint;
1018 if (!empty($arrayfields[
'cp.date_create'][
'checked'])) {
1019 print
'<td style="text-align: center;">'.dol_print_date($date,
'dayhour').
'</td>';
1024 if (!empty($arrayfields[
'cp.tms'][
'checked'])) {
1025 print
'<td style="text-align: center;">'.dol_print_date($date_modif,
'dayhour').
'</td>';
1031 if (!empty($arrayfields[
'cp.statut'][
'checked'])) {
1032 print
'<td class="center nowrap">'.$holidaystatic->getLibStatut(5).
'</td>';
1040 print
'<td class="nowrap center">';
1041 if ($massactionbutton || $massaction) {
1043 if (in_array($obj->rowid, $arrayofselected)) {
1046 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1060 if ($mode !=
'kanban' && !empty($arrayfields[
'duration'][
'checked'])) {
1061 print
'<tr class="total">';
1065 foreach ($arrayfields as $key => $val) {
1066 if (!empty($val[
'checked'])) {
1067 if ($key ==
'duration') {
1068 print
'<td class="right">'.$totalduration.
' '.$langs->trans(
'DurationDays').
'</td>';
1085 foreach ($arrayfields as $key => $val) {
1086 if (!empty($val[
'checked'])) {
1090 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1095$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1096$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1097print $hookmanager->resPrint;
1099print
'</table>'.
"\n";
1102print
'</form>'.
"\n";
1127 $typeleaves = $holiday->getTypes(1, 1);
1128 foreach ($typeleaves as $key => $val) {
1129 $nb_type = $holiday->getCPforUser($user_id, $val[
'rowid']);
1130 $nb_holiday += $nb_type;
1131 $out .=
' - '.$val[
'label'].
': <strong>'.($nb_type ?
price2num($nb_type) : 0).
'</strong><br>';
1133 $out = $langs->trans(
'SoldeCPUser', (
string) round($nb_holiday, 5)).
'<br>'.$out;
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class of the module paid holiday.
Class to manage user groups.
Class to manage Dolibarr users.
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, $countryCodeOrId='')
Function to return number of working days (and text of units) between two dates (working days)
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
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, $morecssdiv='')
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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, $sqltoadd='')
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.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
showMyBalance($holiday, $user_id)
Show balance of user.
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.