32require
'../main.inc.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
45require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
53$langs->loadLangs(array(
'users',
'other',
'holiday',
'hrm'));
56if ($user->socid > 0) {
60$action =
GETPOST(
'action',
'aZ09');
61$massaction =
GETPOST(
'massaction',
'alpha');
63$confirm =
GETPOST(
'confirm',
'alpha');
64$cancel =
GETPOST(
'cancel',
'alpha');
65$toselect =
GETPOST(
'toselect',
'array:int');
66$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'holidaylist';
67$mode =
GETPOST(
'mode',
'alpha');
68$backtopage =
GETPOST(
'backtopage',
'alpha');
69$optioncss =
GETPOST(
'optioncss',
'aZ');
73$childids = $user->getAllChildIds(1);
75$diroutputmassaction =
$conf->holiday->dir_output.
'/temp/massgeneration/'.$user->id;
79$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
80$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
82if (empty($page) || $page == -1) {
85$offset = $limit * $page;
92 $sortfield =
"cp.date_debut";
95$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
96$search_ref =
GETPOST(
'search_ref',
'alphanohtml');
97$search_day_create =
GETPOST(
'search_day_create',
'int');
98$search_month_create =
GETPOST(
'search_month_create',
'int');
99$search_year_create =
GETPOST(
'search_year_create',
'int');
100$search_day_start =
GETPOST(
'search_day_start',
'int');
101$search_month_start =
GETPOST(
'search_month_start',
'int');
102$search_year_start =
GETPOST(
'search_year_start',
'int');
103$search_day_end =
GETPOST(
'search_day_end',
'int');
104$search_month_end =
GETPOST(
'search_month_end',
'int');
105$search_year_end =
GETPOST(
'search_year_end',
'int');
106$search_employee =
GETPOST(
'search_employee',
'intcomma');
107$search_valideur =
GETPOST(
'search_valideur',
'intcomma');
108$search_status =
GETPOST(
'search_status',
'intcomma');
109$search_type =
GETPOST(
'search_type',
'intcomma');
114$hookmanager->initHooks(array(
'holidaylist'));
117$extrafields->fetch_name_optionals_label(
$object->table_element);
119$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
122$fieldstosearchall = array(
124 'cp.description' =>
'Description',
125 'uu.lastname' =>
'EmployeeLastname',
126 'uu.firstname' =>
'EmployeeFirstname',
127 'uu.login' =>
'Login'
131 'cp.ref' => array(
'label' => $langs->trans(
"Ref"),
'checked' =>
'1'),
132 'cp.fk_user' => array(
'label' => $langs->trans(
"Employee"),
'checked' =>
'1',
'position' => 20),
133 'cp.fk_validator' => array(
'label' => $langs->trans(
"ValidatorCP"),
'checked' =>
'1',
'position' => 30),
134 'cp.fk_type' => array(
'label' => $langs->trans(
"Type"),
'checked' =>
'1',
'position' => 35),
135 'duration' => array(
'label' => $langs->trans(
"NbUseDaysCPShort"),
'checked' =>
'1',
'position' => 38),
136 'cp.date_debut' => array(
'label' => $langs->trans(
"DateStart"),
'checked' =>
'1',
'position' => 40),
137 'cp.date_fin' => array(
'label' => $langs->trans(
"DateEnd"),
'checked' =>
'1',
'position' => 42),
138 'cp.date_valid' => array(
'label' => $langs->trans(
"DateValidation"),
'checked' =>
'1',
'position' => 60),
139 'cp.date_approval' => array(
'label' => $langs->trans(
"DateApprove"),
'checked' =>
'1',
'position' => 70),
140 'cp.date_create' => array(
'label' => $langs->trans(
"DateCreation"),
'checked' =>
'0',
'position' => 500),
141 'cp.tms' => array(
'label' => $langs->trans(
"DateModificationShort"),
'checked' =>
'0',
'position' => 501),
142 'cp.statut' => array(
'label' => $langs->trans(
"Status"),
'checked' =>
'1',
'position' => 1000),
145include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
150if ($user->socid > 0) {
155$permissiontoread = $user->hasRight(
'holiday',
'read');
156$permissiontodelete = $user->hasRight(
'holiday',
'delete');
157$permissiontoapprove = $user->hasRight(
'holiday',
'approve');
167 if (
$id == $user->id) {
170 if ($user->hasRight(
'holiday',
'readall')) {
173 if ($user->hasRight(
'holiday',
'read') && in_array(
$id, $childids)) {
187if (
GETPOST(
'cancel',
'alpha')) {
191if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
195$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
196$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
201if (empty($reshook)) {
203 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
206 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
208 $search_month_create =
"";
209 $search_year_create =
"";
210 $search_month_start =
"";
211 $search_year_start =
"";
212 $search_month_end =
"";
213 $search_year_end =
"";
214 $search_employee =
"";
215 $search_valideur =
"";
219 $search_array_options = array();
221 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
222 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
227 $objectclass =
'Holiday';
228 $objectlabel =
'Holiday';
229 $uploaddir =
$conf->holiday->dir_output;
230 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
246$result =
$object->updateBalance();
248$title = $langs->trans(
'Holidays');
249$help_url =
'EN:Module_Holiday';
251llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-holiday page-list');
261 $fuser->fetch(
$id,
'',
'', 1);
262 $fuser->loadRights();
263 $user_id = $fuser->id;
265 $search_employee = $user_id;
275$sql .=
" cp.fk_user,";
276$sql .=
" cp.fk_type,";
277$sql .=
" cp.date_create,";
278$sql .=
" cp.tms as date_modification,";
279$sql .=
" cp.description,";
280$sql .=
" cp.date_debut,";
281$sql .=
" cp.date_fin,";
282$sql .=
" cp.halfday,";
283$sql .=
" cp.statut as status,";
284$sql .=
" cp.fk_validator,";
285$sql .=
" cp.date_valid,";
286$sql .=
" cp.fk_user_valid,";
287$sql .=
" cp.date_approval,";
288$sql .=
" cp.fk_user_approve,";
289$sql .=
" cp.date_refuse,";
290$sql .=
" cp.fk_user_refuse,";
291$sql .=
" cp.date_cancel,";
292$sql .=
" cp.fk_user_cancel,";
293$sql .=
" cp.detail_refuse,";
295$sql .=
" uu.lastname as user_lastname,";
296$sql .=
" uu.firstname as user_firstname,";
297$sql .=
" uu.admin as user_admin,";
298$sql .=
" uu.email as user_email,";
299$sql .=
" uu.login as user_login,";
300$sql .=
" uu.statut as user_status,";
301$sql .=
" uu.photo as user_photo,";
302$sql .=
" uu.fk_country as user_country_id,";
304$sql .=
" ua.lastname as validator_lastname,";
305$sql .=
" ua.firstname as validator_firstname,";
306$sql .=
" ua.admin as validator_admin,";
307$sql .=
" ua.email as validator_email,";
308$sql .=
" ua.login as validator_login,";
309$sql .=
" ua.statut as validator_status,";
310$sql .=
" ua.photo as validator_photo";
312if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
313 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
314 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
318$parameters = array();
319$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
320$sql .= $hookmanager->resPrint;
321$sql = preg_replace(
'/,\s*$/',
'', $sql);
325$sql .=
" FROM ".MAIN_DB_PREFIX.
"holiday as cp";
326if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
327 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (cp.rowid = ef.fk_object)";
329$sql .=
", ".MAIN_DB_PREFIX.
"user as uu, ".MAIN_DB_PREFIX.
"user as ua";
330$sql .=
" WHERE cp.entity IN (".getEntity(
'holiday').
")";
331$sql .=
" AND cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid ";
333if (!empty($search_all)) {
334 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
337if (!empty($search_ref)) {
341$sql .=
dolSqlDateFilter(
"cp.date_debut", $search_day_start, $search_month_start, $search_year_start);
343$sql .=
dolSqlDateFilter(
"cp.date_fin", $search_day_end, $search_month_end, $search_year_end);
345$sql .=
dolSqlDateFilter(
"cp.date_create", $search_day_create, $search_month_create, $search_year_create);
347if (!empty($search_employee) && $search_employee != -1) {
348 $sql .=
" AND cp.fk_user = '".$db->escape($search_employee).
"'\n";
351if (!empty($search_valideur) && $search_valideur != -1) {
352 $sql .=
" AND cp.fk_validator = '".$db->escape($search_valideur).
"'\n";
355if (!empty($search_type) && $search_type != -1) {
356 $sql .=
' AND cp.fk_type IN ('.$db->sanitize(
$db->escape($search_type)).
')';
359if (!empty($search_status) && $search_status != -1) {
360 $sql .=
" AND cp.statut = '".$db->escape($search_status).
"'\n";
363if (!$user->hasRight(
'holiday',
'readall')) {
364 $sql .=
' AND cp.fk_user IN ('.$db->sanitize(implode(
',', $childids)).
')';
367 $sql .=
" AND cp.fk_user = ".((int)
$id);
371include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
373$parameters = array();
374$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
375$sql .= $hookmanager->resPrint;
378$nbtotalofrecords =
'';
381 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
382 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
383 $resql =
$db->query($sqlforcount);
385 $objforcount =
$db->fetch_object($resql);
386 $nbtotalofrecords = $objforcount->nbtotalofrecords;
391 if (($page * $limit) > (
int) $nbtotalofrecords) {
399$sql .=
$db->order($sortfield, $sortorder);
401 $sql .=
$db->plimit($limit + 1, $offset);
405$resql =
$db->query($sql);
411$num =
$db->num_rows($resql);
413$arrayofselected = is_array($toselect) ? $toselect : array();
417 $param .=
'&mode='.urlencode($mode);
419if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
420 $param .=
'&contextpage='.urlencode($contextpage);
422if ($limit > 0 && $limit !=
$conf->liste_limit) {
423 $param .=
'&limit='.((int) $limit);
425if ($optioncss !=
'') {
426 $param .=
'&optioncss='.urlencode($optioncss);
429 $param .=
'&search_ref='.urlencode($search_ref);
431if ($search_day_create) {
432 $param .=
'&search_day_create='.urlencode($search_day_create);
434if ($search_month_create) {
435 $param .=
'&search_month_create='.urlencode($search_month_create);
437if ($search_year_create) {
438 $param .=
'&search_year_create='.urlencode($search_year_create);
440if ($search_day_start) {
441 $param .=
'&search_day_start='.urlencode($search_day_start);
443if ($search_month_start) {
444 $param .=
'&search_month_start='.urlencode($search_month_start);
446if ($search_year_start) {
447 $param .=
'&search_year_start='.urlencode($search_year_start);
449if ($search_day_end) {
450 $param .=
'&search_day_end='.urlencode($search_day_end);
452if ($search_month_end) {
453 $param .=
'&search_month_end='.urlencode($search_month_end);
455if ($search_year_end) {
456 $param .=
'&search_year_end='.urlencode($search_year_end);
458if ($search_employee > 0) {
459 $param .=
'&search_employee='.urlencode($search_employee);
461if ($search_valideur > 0) {
462 $param .=
'&search_valideur='.urlencode((
string) ($search_valideur));
464if ($search_type > 0) {
465 $param .=
'&search_type='.urlencode((
string) ($search_type));
467if ($search_status > 0) {
468 $param .=
'&search_status='.urlencode($search_status);
471include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
474$arrayofmassactions = array(
479if (!empty($permissiontodelete)) {
480 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
482if (!empty($permissiontoapprove)) {
483 $arrayofmassactions[
'preapproveleave'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Approve");
485if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
486 $arrayofmassactions = array();
488$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
490print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
491if ($optioncss !=
'') {
492 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
494print
'<input type="hidden" name="token" value="'.newToken().
'">';
495print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
496print
'<input type="hidden" name="action" value="'.($action ==
'edit' ?
'update' :
'list').
'">';
497print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
498print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
499print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
500print
'<input type="hidden" name="page" value="'.$page.
'">';
501print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
502print
'<input type="hidden" name="page_y" value="">';
503print
'<input type="hidden" name="mode" value="'.$mode.
'">';
505 print
'<input type="hidden" name="id" value="'.$id.
'">';
509 $title = $langs->trans(
"User");
510 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
515 dol_banner_tab($fuser,
'id', $linkback, $user->hasRight(
'user',
'user',
'lire') || $user->admin);
518 print
'<div class="underbanner clearboth"></div>';
529 print
'<div class="tabsAction">';
532 if ($user->hasRight(
'holiday',
'writeall')) {
535 if ($user->hasRight(
'holiday',
'write') && in_array($user_id, $childids)) {
540 print
'<a href="'.DOL_URL_ROOT.
'/holiday/card.php?action=create&fuserid='.$user_id.
'" class="butAction">'.$langs->trans(
"AddCP").
'</a>';
546 $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'));
547 $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'));
548 $newcardbutton .= dolGetButtonTitleSeparator();
549 $newcardbutton .= dolGetButtonTitle($langs->trans(
'MenuAddCP'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/holiday/card.php?action=create',
'', $user->hasRight(
'holiday',
'write'));
551 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'title_hrm', 0, $newcardbutton,
'', $limit, 0, 0, 1);
554$topicmail =
"Information";
555$modelmail =
"leaverequest";
557$trackid =
'leav'.$object->id;
558include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
562 foreach ($fieldstosearchall as $key => $val) {
563 $fieldstosearchall[$key] = $langs->trans($val);
564 $setupstring .= $key.
"=".$val.
";";
566 print
'<!-- Search done like if HOLIDAY_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
567 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
572$parameters = array();
573$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
574if (empty($reshook)) {
575 $moreforfilter .= $hookmanager->resPrint;
577 $moreforfilter = $hookmanager->resPrint;
580if (!empty($moreforfilter)) {
581 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
582 print $moreforfilter;
586$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
587$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
588$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
589$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
592if (!$user->hasRight(
'holiday',
'readall')) {
593 $include =
'hierarchyme';
596print
'<div class="div-table-responsive">';
597print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
601print
'<tr class="liste_titre_filter">';
603if (
$conf->main_checkbox_left_column) {
604 print
'<td class="liste_titre center maxwidthsearch">';
605 $searchpicto = $form->showFilterButtons(
'left');
609if (!empty($arrayfields[
'cp.ref'][
'checked'])) {
610 print
'<td class="liste_titre">';
611 print
'<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
616if (!empty($arrayfields[
'cp.fk_user'][
'checked'])) {
618 $morefilter =
'AND employee = 1';
624 if (
$id && !GETPOSTISSET(
'search_employee')) {
625 $search_employee =
$id;
629 print
'<td class="liste_titre maxwidthonsmartphone left">';
630 print $form->select_dolusers($search_employee,
"search_employee", 1,
null, $disabled, $include,
'',
'0', 0, 0, $morefilter, 0,
'',
'maxwidth125');
635if (!empty($arrayfields[
'cp.fk_validator'][
'checked'])) {
636 if ($user->hasRight(
'holiday',
'readall')) {
637 print
'<td class="liste_titre maxwidthonsmartphone left">';
639 $excludefilter = $user->admin ?
'' :
'u.rowid <> '.((int) $user->id);
640 $valideurobjects = $validator->listUsersForGroup($excludefilter, 1);
641 $valideurarray = array();
642 foreach ($valideurobjects as $val) {
643 $valideurarray[$val] = $val;
645 print $form->select_dolusers($search_valideur,
"search_valideur", 1,
null, 0, $valideurarray,
'',
'0', 0, 0, $morefilter, 0,
'',
'maxwidth125');
648 print
'<td class="liste_titre"> </td>';
653if (!empty($arrayfields[
'cp.fk_type'][
'checked'])) {
654 print
'<td class="liste_titre">';
655 if (empty(
$mysoc->country_id)) {
656 setEventMessages(
null, array($langs->trans(
"ErrorSetACountryFirst"), $langs->trans(
"CompanyFoundation")),
'errors');
658 $typeleaves = $holidaystatic->getTypes(1, -1);
659 $arraytypeleaves = array();
660 foreach ($typeleaves as $key => $val) {
661 $labeltoshow = ($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']);
663 $arraytypeleaves[$val[
'rowid']] = $labeltoshow;
665 print $form->selectarray(
'search_type', $arraytypeleaves, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100', 1);
671if (!empty($arrayfields[
'duration'][
'checked'])) {
672 print
'<td class="liste_titre"> </td>';
676if (!empty($arrayfields[
'cp.date_debut'][
'checked'])) {
677 print
'<td class="liste_titre center nowraponall">';
678 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_start" value="'.dol_escape_htmltag($search_month_start).
'">';
679 print $formother->selectyear($search_year_start,
'search_year_start', 1, $min_year, $max_year);
684if (!empty($arrayfields[
'cp.date_fin'][
'checked'])) {
685 print
'<td class="liste_titre center nowraponall">';
686 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_end" value="'.dol_escape_htmltag($search_month_end).
'">';
687 print $formother->selectyear($search_year_end,
'search_year_end', 1, $min_year, $max_year);
692if (!empty($arrayfields[
'cp.date_valid'][
'checked'])) {
693 print
'<td class="liste_titre center nowraponall">';
698if (!empty($arrayfields[
'cp.date_approval'][
'checked'])) {
699 print
'<td class="liste_titre center nowraponall">';
704include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
707$parameters = array(
'arrayfields' => $arrayfields);
708$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
709print $hookmanager->resPrint;
712if (!empty($arrayfields[
'cp.date_create'][
'checked'])) {
713 print
'<td class="liste_titre center width200">';
714 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_create" value="'.dol_escape_htmltag($search_month_create).
'">';
715 print $formother->selectyear($search_year_create,
'search_year_create', 1, $min_year, 0);
720if (!empty($arrayfields[
'cp.tms'][
'checked'])) {
721 print
'<td class="liste_titre center width200">';
722 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_update" value="'.dol_escape_htmltag($search_month_update).
'">';
723 print $formother->selectyear($search_year_update,
'search_year_update', 1, $min_year, 0);
728if (!empty($arrayfields[
'cp.statut'][
'checked'])) {
729 print
'<td class="liste_titre center parentonrightofpage">';
730 print
$object->selectStatutCP($search_status,
'search_status',
'search_status width100 onrightofpage');
735if (!
$conf->main_checkbox_left_column) {
736 print
'<td class="liste_titre center maxwidthsearch">';
737 $searchpicto = $form->showFilterButtons();
749print
'<tr class="liste_titre">';
750if (
$conf->main_checkbox_left_column) {
751 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
754if (!empty($arrayfields[
'cp.ref'][
'checked'])) {
755 print_liste_field_titre($arrayfields[
'cp.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.ref",
"", $param,
'', $sortfield, $sortorder);
758if (!empty($arrayfields[
'cp.fk_user'][
'checked'])) {
759 print_liste_field_titre($arrayfields[
'cp.fk_user'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.fk_user",
"", $param,
'', $sortfield, $sortorder);
762if (!empty($arrayfields[
'cp.fk_validator'][
'checked'])) {
763 print_liste_field_titre($arrayfields[
'cp.fk_validator'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.fk_validator",
"", $param,
'', $sortfield, $sortorder);
766if (!empty($arrayfields[
'cp.fk_type'][
'checked'])) {
767 print_liste_field_titre($arrayfields[
'cp.fk_type'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder);
770if (!empty($arrayfields[
'duration'][
'checked'])) {
771 print_liste_field_titre($arrayfields[
'duration'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right maxwidth100');
774if (!empty($arrayfields[
'cp.date_debut'][
'checked'])) {
775 print_liste_field_titre($arrayfields[
'cp.date_debut'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.date_debut",
"", $param,
'', $sortfield, $sortorder,
'center ');
778if (!empty($arrayfields[
'cp.date_fin'][
'checked'])) {
779 print_liste_field_titre($arrayfields[
'cp.date_fin'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.date_fin",
"", $param,
'', $sortfield, $sortorder,
'center ');
782if (!empty($arrayfields[
'cp.date_valid'][
'checked'])) {
783 print_liste_field_titre($arrayfields[
'cp.date_valid'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.date_valid",
"", $param,
'', $sortfield, $sortorder,
'center ');
786if (!empty($arrayfields[
'cp.date_approval'][
'checked'])) {
787 print_liste_field_titre($arrayfields[
'cp.date_approval'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.date_approval",
"", $param,
'', $sortfield, $sortorder,
'center ');
791include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
793$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &
$totalarray);
794$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
795print $hookmanager->resPrint;
796if (!empty($arrayfields[
'cp.date_create'][
'checked'])) {
797 print_liste_field_titre($arrayfields[
'cp.date_create'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.date_create",
"", $param,
'', $sortfield, $sortorder,
'center ');
800if (!empty($arrayfields[
'cp.tms'][
'checked'])) {
801 print_liste_field_titre($arrayfields[
'cp.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.tms",
"", $param,
'', $sortfield, $sortorder,
'center ');
804if (!empty($arrayfields[
'cp.statut'][
'checked'])) {
805 print_liste_field_titre(
"Status", $_SERVER[
"PHP_SELF"],
"cp.statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
809if (!
$conf->main_checkbox_left_column) {
810 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
815$listhalfday = array(
'morning' => $langs->trans(
"Morning"),
"afternoon" => $langs->trans(
"Afternoon"));
822if (
$id && !$user->hasRight(
'holiday',
'readall') && !in_array(
$id, $childids)) {
823 $langs->load(
"errors");
824 print
'<tr class="oddeven opacitymedium"><td colspan="10">'.$langs->trans(
"NotEnoughPermissions").
'</td></tr>';
826} elseif ($num > 0 && !empty(
$mysoc->country_id)) {
829 $approbatorstatic =
new User(
$db);
831 $typeleaves =
$object->getTypes(1, -1);
838 $imaxinloop = ($limit ? min($num, $limit) : $num);
839 while ($i < $imaxinloop) {
840 $obj =
$db->fetch_object($resql);
846 $holidaystatic->id = $obj->rowid;
847 $holidaystatic->ref = ($obj->ref ? $obj->ref : $obj->rowid);
848 $holidaystatic->status = $obj->status;
849 $holidaystatic->date_debut =
$db->jdate($obj->date_debut);
850 $holidaystatic->date_fin =
$db->jdate($obj->date_fin);
853 $userstatic->id = $obj->fk_user;
854 $userstatic->lastname = $obj->user_lastname;
855 $userstatic->firstname = $obj->user_firstname;
856 $userstatic->admin = $obj->user_admin;
857 $userstatic->email = $obj->user_email;
858 $userstatic->login = $obj->user_login;
859 $userstatic->status = $obj->user_status;
860 $userstatic->photo = $obj->user_photo;
861 $userstatic->country_id = $obj->user_country_id;
864 $approbatorstatic->id = $obj->fk_validator;
865 $approbatorstatic->lastname = $obj->validator_lastname;
866 $approbatorstatic->firstname = $obj->validator_firstname;
867 $approbatorstatic->admin = $obj->validator_admin;
868 $approbatorstatic->email = $obj->validator_email;
869 $approbatorstatic->login = $obj->validator_login;
870 $approbatorstatic->status = $obj->validator_status;
871 $approbatorstatic->photo = $obj->validator_photo;
873 $date = $obj->date_create;
874 $date_modif = $obj->date_modification;
876 $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ?
'afternoon' :
'morning';
877 $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ?
'morning' :
'afternoon';
879 $nbopenedday =
num_open_day(
$db->jdate($obj->date_debut, 1),
$db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday, $userstatic->country_id, $obj->fk_user);
880 $totalduration += $nbopenedday;
882 if ($mode ==
'kanban') {
884 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
885 print
'<div class="box-flex-container kanban">';
888 $holidaystatic->fk_type = empty($typeleaves[$obj->fk_type][
'rowid']) ? 0 : $typeleaves[$obj->fk_type][
'rowid'];
890 $arraydata = array();
892 if ($massactionbutton || $massaction) {
894 if (in_array(
$object->id, $arrayofselected)) {
897 if (empty($typeleaves[$obj->fk_type])) {
898 $labeltypeleavetoshow = $langs->trans(
"TypeWasDisabledOrRemoved", $obj->fk_type);
900 $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']);
903 $arraydata = array(
'user' => $userstatic,
'labeltype' => $labeltypeleavetoshow,
'selected' => $selected,
'nbopenedday' => $nbopenedday);
905 print $holidaystatic->getKanbanView(
'', $arraydata);
906 if ($i == ($imaxinloop - 1)) {
913 print
'<tr data-rowid="'.$holidaystatic->id.
'" class="oddeven row-with-select">';
915 if (
$conf->main_checkbox_left_column) {
916 print
'<td class="nowrap center">';
917 if ($massactionbutton || $massaction) {
919 if (in_array($obj->rowid, $arrayofselected)) {
922 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
929 if (!empty($arrayfields[
'cp.ref'][
'checked'])) {
930 print
'<td class="nowraponall">';
931 print $holidaystatic->getNomUrl(1, 1);
937 if (!empty($arrayfields[
'cp.fk_user'][
'checked'])) {
938 print
'<td class="tdoverflowmax125">'.$userstatic->getNomUrl(-1,
'leave').
'</td>';
943 if (!empty($arrayfields[
'cp.fk_validator'][
'checked'])) {
944 print
'<td class="tdoverflowmax125">'.$approbatorstatic->getNomUrl(-1).
'</td>';
949 if (!empty($arrayfields[
'cp.fk_type'][
'checked'])) {
950 if (empty($typeleaves[$obj->fk_type])) {
951 $labeltypeleavetoshow = $langs->trans(
"TypeWasDisabledOrRemoved", $obj->fk_type);
953 $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']);
956 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($labeltypeleavetoshow).
'">';
957 print $labeltypeleavetoshow;
963 if (!empty($arrayfields[
'duration'][
'checked'])) {
964 print
'<td class="right">';
972 if (!empty($arrayfields[
'cp.date_debut'][
'checked'])) {
973 print
'<td class="center">';
975 print
' <span class="opacitymedium nowraponall">('.$langs->trans($listhalfday[$starthalfday]).
')</span>';
981 if (!empty($arrayfields[
'cp.date_fin'][
'checked'])) {
982 print
'<td class="center">';
984 print
' <span class="opacitymedium nowraponall">('.$langs->trans($listhalfday[$endhalfday]).
')</span>';
991 if (!empty($arrayfields[
'cp.date_valid'][
'checked'])) {
992 print
'<td class="center" title="'.dol_print_date(
$db->jdate($obj->date_valid),
'dayhour').
'">';
1000 if (!empty($arrayfields[
'cp.date_approval'][
'checked'])) {
1001 print
'<td class="center" title="'.dol_print_date(
$db->jdate($obj->date_approval),
'dayhour').
'">';
1010 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1012 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &
$totalarray);
1013 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
1014 print $hookmanager->resPrint;
1017 if (!empty($arrayfields[
'cp.date_create'][
'checked'])) {
1018 print
'<td style="text-align: center;">'.dol_print_date($date,
'dayhour').
'</td>';
1023 if (!empty($arrayfields[
'cp.tms'][
'checked'])) {
1024 print
'<td style="text-align: center;">'.dol_print_date($date_modif,
'dayhour').
'</td>';
1030 if (!empty($arrayfields[
'cp.statut'][
'checked'])) {
1031 print
'<td class="center nowrap">'.$holidaystatic->getLibStatut(5).
'</td>';
1038 if (!
$conf->main_checkbox_left_column) {
1039 print
'<td class="nowrap center">';
1040 if ($massactionbutton || $massaction) {
1042 if (in_array($obj->rowid, $arrayofselected)) {
1045 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1059 if ($mode !=
'kanban' && !empty($arrayfields[
'duration'][
'checked'])) {
1060 print
'<tr class="total">';
1061 if (
$conf->main_checkbox_left_column) {
1064 foreach ($arrayfields as $key => $val) {
1065 if (!empty($val[
'checked'])) {
1066 if ($key ==
'duration') {
1067 print
'<td class="right">'.$totalduration.
' '.$langs->trans(
'DurationDays').
'</td>';
1074 if (!
$conf->main_checkbox_left_column) {
1084 foreach ($arrayfields as $key => $val) {
1085 if (!empty($val[
'checked'])) {
1089 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1094$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1095$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1096print $hookmanager->resPrint;
1098print
'</table>'.
"\n";
1101print
'</form>'.
"\n";
1126 $typeleaves = $holiday->getTypes(1, 1);
1127 foreach ($typeleaves as $key => $val) {
1128 $nb_type = $holiday->getCPforUser($user_id, $val[
'rowid']);
1129 $nb_holiday += $nb_type;
1130 $out .=
' - '.$val[
'label'].
': <strong>'.($nb_type ?
price2num($nb_type) : 0).
'</strong><br>';
1132 $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='', $user_id=0)
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 '.
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.
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.