30require
'../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
42$langs->loadLangs(array(
'users',
'other',
'holiday',
'hrm'));
45if ($user->socid > 0) {
49$action =
GETPOST(
'action',
'aZ09');
50$massaction =
GETPOST(
'massaction',
'alpha');
52$confirm =
GETPOST(
'confirm',
'alpha');
53$cancel =
GETPOST(
'cancel',
'alpha');
54$toselect =
GETPOST(
'toselect',
'array');
55$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'holidaylist';
56$mode =
GETPOST(
'mode',
'alpha');
57$backtopage =
GETPOST(
'backtopage',
'alpha');
58$optioncss =
GETPOST(
'optioncss',
'aZ');
62$childids = $user->getAllChildIds(1);
65$diroutputmassaction = $conf->holiday->dir_output.
'/temp/massgeneration/'.$user->id;
70$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
71$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
73if (empty($page) || $page == -1) {
76$offset = $limit * $page;
83 $sortfield =
"cp.ref";
86$search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
87$search_ref =
GETPOST(
'search_ref',
'alphanohtml');
88$search_day_create =
GETPOST(
'search_day_create',
'int');
89$search_month_create =
GETPOST(
'search_month_create',
'int');
90$search_year_create =
GETPOST(
'search_year_create',
'int');
91$search_day_start =
GETPOST(
'search_day_start',
'int');
92$search_month_start =
GETPOST(
'search_month_start',
'int');
93$search_year_start =
GETPOST(
'search_year_start',
'int');
94$search_day_end =
GETPOST(
'search_day_end',
'int');
95$search_month_end =
GETPOST(
'search_month_end',
'int');
96$search_year_end =
GETPOST(
'search_year_end',
'int');
97$search_employee =
GETPOST(
'search_employee',
'intcomma');
98$search_valideur =
GETPOST(
'search_valideur',
'intcomma');
99$search_status =
GETPOST(
'search_status',
'intcomma');
100$search_type =
GETPOST(
'search_type',
'intcomma');
105$hookmanager->initHooks(array(
'holidaylist'));
108$extrafields->fetch_name_optionals_label(
$object->table_element);
110$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
113$fieldstosearchall = array(
115 'cp.description' =>
'Description',
116 'uu.lastname' =>
'EmployeeLastname',
117 'uu.firstname' =>
'EmployeeFirstname',
118 'uu.login' =>
'Login'
122 'cp.ref' => array(
'label' => $langs->trans(
"Ref"),
'checked' => 1),
123 'cp.fk_user' => array(
'label' => $langs->trans(
"Employee"),
'checked' => 1,
'position' => 20),
124 'cp.fk_validator' => array(
'label' => $langs->trans(
"ValidatorCP"),
'checked' => 1,
'position' => 30),
125 'cp.fk_type' => array(
'label' => $langs->trans(
"Type"),
'checked' => 1,
'position' => 35),
126 'duration' => array(
'label' => $langs->trans(
"NbUseDaysCPShort"),
'checked' => 1,
'position' => 38),
127 'cp.date_debut' => array(
'label' => $langs->trans(
"DateStart"),
'checked' => 1,
'position' => 40),
128 'cp.date_fin' => array(
'label' => $langs->trans(
"DateEnd"),
'checked' => 1,
'position' => 42),
129 'cp.date_valid' => array(
'label' => $langs->trans(
"DateValidation"),
'checked' => 1,
'position' => 60),
130 'cp.date_approval' => array(
'label' => $langs->trans(
"DateApprove"),
'checked' => 1,
'position' => 70),
131 'cp.date_create' => array(
'label' => $langs->trans(
"DateCreation"),
'checked' => 0,
'position' => 500),
132 'cp.tms' => array(
'label' => $langs->trans(
"DateModificationShort"),
'checked' => 0,
'position' => 501),
133 'cp.statut' => array(
'label' => $langs->trans(
"Status"),
'checked' => 1,
'position' => 1000),
136include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
141if ($user->socid > 0) {
146$permissiontoread = $user->hasRight(
'holiday',
'read');
147$permissiontodelete = $user->hasRight(
'holiday',
'delete');
148$permissiontoapprove = $user->hasRight(
'holiday',
'approve');
150if (!isModEnabled(
'holiday')) {
158 if ($id == $user->id) {
161 if ($user->hasRight(
'holiday',
'readall')) {
164 if ($user->hasRight(
'holiday',
'read') && in_array($id, $childids)) {
178if (
GETPOST(
'cancel',
'alpha')) {
182if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
186$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
187$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
192if (empty($reshook)) {
194 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
197 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
199 $search_month_create =
"";
200 $search_year_create =
"";
201 $search_month_start =
"";
202 $search_year_start =
"";
203 $search_month_end =
"";
204 $search_year_end =
"";
205 $search_employee =
"";
206 $search_valideur =
"";
210 $search_array_options = array();
212 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
213 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
218 $objectclass =
'Holiday';
219 $objectlabel =
'Holiday';
220 $uploaddir = $conf->holiday->dir_output;
221 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
229$form =
new Form($db);
233$fuser =
new User($db);
234$holidaystatic =
new Holiday($db);
237$result =
$object->updateBalance();
239$title = $langs->trans(
'CPTitreMenu');
242llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist');
252 $fuser->fetch($id,
'',
'', 1);
254 $user_id = $fuser->id;
256 $search_employee = $user_id;
266$sql .=
" cp.fk_user,";
267$sql .=
" cp.fk_type,";
268$sql .=
" cp.date_create,";
269$sql .=
" cp.tms as date_modification,";
270$sql .=
" cp.description,";
271$sql .=
" cp.date_debut,";
272$sql .=
" cp.date_fin,";
273$sql .=
" cp.halfday,";
274$sql .=
" cp.statut as status,";
275$sql .=
" cp.fk_validator,";
276$sql .=
" cp.date_valid,";
277$sql .=
" cp.fk_user_valid,";
278$sql .=
" cp.date_approval,";
279$sql .=
" cp.fk_user_approve,";
280$sql .=
" cp.date_refuse,";
281$sql .=
" cp.fk_user_refuse,";
282$sql .=
" cp.date_cancel,";
283$sql .=
" cp.fk_user_cancel,";
284$sql .=
" cp.detail_refuse,";
286$sql .=
" uu.lastname as user_lastname,";
287$sql .=
" uu.firstname as user_firstname,";
288$sql .=
" uu.admin as user_admin,";
289$sql .=
" uu.email as user_email,";
290$sql .=
" uu.login as user_login,";
291$sql .=
" uu.statut as user_status,";
292$sql .=
" uu.photo as user_photo,";
294$sql .=
" ua.lastname as validator_lastname,";
295$sql .=
" ua.firstname as validator_firstname,";
296$sql .=
" ua.admin as validator_admin,";
297$sql .=
" ua.email as validator_email,";
298$sql .=
" ua.login as validator_login,";
299$sql .=
" ua.statut as validator_status,";
300$sql .=
" ua.photo as validator_photo";
302if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
303 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
304 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
308$parameters = array();
309$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
310$sql .= $hookmanager->resPrint;
311$sql = preg_replace(
'/,\s*$/',
'', $sql);
315$sql .=
" FROM ".MAIN_DB_PREFIX.
"holiday as cp";
316if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
317 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (cp.rowid = ef.fk_object)";
319$sql .=
", ".MAIN_DB_PREFIX.
"user as uu, ".MAIN_DB_PREFIX.
"user as ua";
320$sql .=
" WHERE cp.entity IN (".getEntity(
'holiday').
")";
321$sql .=
" AND cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid ";
323if (!empty($search_all)) {
324 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
327if (!empty($search_ref)) {
331$sql .=
dolSqlDateFilter(
"cp.date_debut", $search_day_start, $search_month_start, $search_year_start);
333$sql .=
dolSqlDateFilter(
"cp.date_fin", $search_day_end, $search_month_end, $search_year_end);
335$sql .=
dolSqlDateFilter(
"cp.date_create", $search_day_create, $search_month_create, $search_year_create);
337if (!empty($search_employee) && $search_employee != -1) {
338 $sql .=
" AND cp.fk_user = '".$db->escape($search_employee).
"'\n";
341if (!empty($search_valideur) && $search_valideur != -1) {
342 $sql .=
" AND cp.fk_validator = '".$db->escape($search_valideur).
"'\n";
345if (!empty($search_type) && $search_type != -1) {
346 $sql .=
' AND cp.fk_type IN ('.$db->sanitize($db->escape($search_type)).
')';
349if (!empty($search_status) && $search_status != -1) {
350 $sql .=
" AND cp.statut = '".$db->escape($search_status).
"'\n";
353if (!$user->hasRight(
'holiday',
'readall')) {
354 $sql .=
' AND cp.fk_user IN ('.$db->sanitize(implode(
',', $childids)).
')';
357 $sql .=
" AND cp.fk_user IN (".$db->sanitize($id).
")";
361include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
363$parameters = array();
364$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
365$sql .= $hookmanager->resPrint;
368$nbtotalofrecords =
'';
371 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
372 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
373 $resql = $db->query($sqlforcount);
375 $objforcount = $db->fetch_object($resql);
376 $nbtotalofrecords = $objforcount->nbtotalofrecords;
381 if (($page * $limit) > $nbtotalofrecords) {
389$sql .= $db->order($sortfield, $sortorder);
391 $sql .= $db->plimit($limit + 1, $offset);
395$resql = $db->query($sql);
401$num = $db->num_rows($resql);
403$arrayofselected = is_array($toselect) ? $toselect : array();
407 $param .=
'&mode='.urlencode($mode);
409if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
410 $param .=
'&contextpage='.urlencode($contextpage);
412if ($limit > 0 && $limit != $conf->liste_limit) {
413 $param .=
'&limit='.((int) $limit);
415if ($optioncss !=
'') {
416 $param .=
'&optioncss='.urlencode($optioncss);
419 $param .=
'&search_ref='.urlencode($search_ref);
421if ($search_day_create) {
422 $param .=
'&search_day_create='.urlencode($search_day_create);
424if ($search_month_create) {
425 $param .=
'&search_month_create='.urlencode($search_month_create);
427if ($search_year_create) {
428 $param .=
'&search_year_create='.urlencode($search_year_create);
430if ($search_day_start) {
431 $param .=
'&search_day_start='.urlencode($search_day_start);
433if ($search_month_start) {
434 $param .=
'&search_month_start='.urlencode($search_month_start);
436if ($search_year_start) {
437 $param .=
'&search_year_start='.urlencode($search_year_start);
439if ($search_day_end) {
440 $param .=
'&search_day_end='.urlencode($search_day_end);
442if ($search_month_end) {
443 $param .=
'&search_month_end='.urlencode($search_month_end);
445if ($search_year_end) {
446 $param .=
'&search_year_end='.urlencode($search_year_end);
448if ($search_employee > 0) {
449 $param .=
'&search_employee='.urlencode($search_employee);
451if ($search_valideur > 0) {
452 $param .=
'&search_valideur='.urlencode((
string) ($search_valideur));
454if ($search_type > 0) {
455 $param .=
'&search_type='.urlencode((
string) ($search_type));
457if ($search_status > 0) {
458 $param .=
'&search_status='.urlencode($search_status);
461include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
464$arrayofmassactions = array(
469if (!empty($permissiontodelete)) {
470 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
472if (!empty($permissiontoapprove)) {
473 $arrayofmassactions[
'preapproveleave'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Approve");
475if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
476 $arrayofmassactions = array();
478$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
480print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
481if ($optioncss !=
'') {
482 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
484print
'<input type="hidden" name="token" value="'.newToken().
'">';
485print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
486print
'<input type="hidden" name="action" value="'.($action ==
'edit' ?
'update' :
'list').
'">';
487print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
488print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
489print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
490print
'<input type="hidden" name="page" value="'.$page.
'">';
491print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
492print
'<input type="hidden" name="page_y" value="">';
493print
'<input type="hidden" name="mode" value="'.$mode.
'">';
495 print
'<input type="hidden" name="id" value="'.$id.
'">';
499 $title = $langs->trans(
"User");
500 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
505 dol_banner_tab($fuser,
'id', $linkback, $user->hasRight(
'user',
'user',
'lire') || $user->admin);
508 print
'<div class="underbanner clearboth"></div>';
519 print
'<div class="tabsAction">';
522 if ($user->hasRight(
'holiday',
'writeall')) {
525 if ($user->hasRight(
'holiday',
'write') && in_array($user_id, $childids)) {
530 print
'<a href="'.DOL_URL_ROOT.
'/holiday/card.php?action=create&fuserid='.$user_id.
'" class="butAction">'.$langs->trans(
"AddCP").
'</a>';
535 $title = $langs->trans(
"ListeCP");
539 $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'));
540 $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'));
542 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'MenuAddCP'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/holiday/card.php?action=create',
'', $user->hasRight(
'holiday',
'write'));
544 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'title_hrm', 0, $newcardbutton,
'', $limit, 0, 0, 1);
547$topicmail =
"Information";
548$modelmail =
"leaverequest";
550$trackid =
'leav'.$object->id;
551include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
555 foreach ($fieldstosearchall as $key => $val) {
556 $fieldstosearchall[$key] = $langs->trans($val);
557 $setupstring .= $key.
"=".$val.
";";
559 print
'<!-- Search done like if HOLIDAY_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
560 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
565$parameters = array();
566$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
567if (empty($reshook)) {
568 $moreforfilter .= $hookmanager->resPrint;
570 $moreforfilter = $hookmanager->resPrint;
573if (!empty($moreforfilter)) {
574 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
575 print $moreforfilter;
579$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
580$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
581$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
582$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
585if (!$user->hasRight(
'holiday',
'readall')) {
586 $include =
'hierarchyme';
589print
'<div class="div-table-responsive">';
590print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
594print
'<tr class="liste_titre_filter">';
597 print
'<td class="liste_titre center maxwidthsearch">';
598 $searchpicto = $form->showFilterButtons(
'left');
602if (!empty($arrayfields[
'cp.ref'][
'checked'])) {
603 print
'<td class="liste_titre">';
604 print
'<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
608if (!empty($arrayfields[
'cp.fk_user'][
'checked'])) {
611 $morefilter =
'AND employee = 1';
617 if ($id && !GETPOSTISSET(
'search_employee')) {
618 $search_employee = $id;
622 print
'<td class="liste_titre maxwidthonsmartphone left">';
623 print $form->select_dolusers($search_employee,
"search_employee", 1,
"", $disabled, $include,
'', 0, 0, 0, $morefilter, 0,
'',
'maxwidth125');
628if (!empty($arrayfields[
'cp.fk_validator'][
'checked'])) {
629 if ($user->hasRight(
'holiday',
'readall')) {
630 print
'<td class="liste_titre maxwidthonsmartphone left">';
632 $excludefilter = $user->admin ?
'' :
'u.rowid <> '.((int) $user->id);
633 $valideurobjects = $validator->listUsersForGroup($excludefilter, 1);
634 $valideurarray = array();
635 foreach ($valideurobjects as $val) {
636 $valideurarray[$val] = $val;
638 print $form->select_dolusers($search_valideur,
"search_valideur", 1,
"", 0, $valideurarray,
'', 0, 0, 0, $morefilter, 0,
'',
'maxwidth125');
641 print
'<td class="liste_titre"> </td>';
646if (!empty($arrayfields[
'cp.fk_type'][
'checked'])) {
647 print
'<td class="liste_titre">';
648 if (empty($mysoc->country_id)) {
649 setEventMessages(
null, array($langs->trans(
"ErrorSetACountryFirst"), $langs->trans(
"CompanyFoundation")),
'errors');
651 $typeleaves = $holidaystatic->getTypes(1, -1);
652 $arraytypeleaves = array();
653 foreach ($typeleaves as $key => $val) {
654 $labeltoshow = ($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']);
656 $arraytypeleaves[$val[
'rowid']] = $labeltoshow;
658 print $form->selectarray(
'search_type', $arraytypeleaves, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100', 1);
664if (!empty($arrayfields[
'duration'][
'checked'])) {
665 print
'<td class="liste_titre"> </td>';
669if (!empty($arrayfields[
'cp.date_debut'][
'checked'])) {
670 print
'<td class="liste_titre center nowraponall">';
671 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_start" value="'.dol_escape_htmltag($search_month_start).
'">';
672 print $formother->selectyear($search_year_start,
'search_year_start', 1, $min_year, $max_year);
677if (!empty($arrayfields[
'cp.date_fin'][
'checked'])) {
678 print
'<td class="liste_titre center nowraponall">';
679 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_end" value="'.dol_escape_htmltag($search_month_end).
'">';
680 print $formother->selectyear($search_year_end,
'search_year_end', 1, $min_year, $max_year);
685if (!empty($arrayfields[
'cp.date_valid'][
'checked'])) {
686 print
'<td class="liste_titre center nowraponall">';
691if (!empty($arrayfields[
'cp.date_approval'][
'checked'])) {
692 print
'<td class="liste_titre center nowraponall">';
697include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
700$parameters = array(
'arrayfields' => $arrayfields);
701$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
702print $hookmanager->resPrint;
705if (!empty($arrayfields[
'cp.date_create'][
'checked'])) {
706 print
'<td class="liste_titre center width200">';
707 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_create" value="'.dol_escape_htmltag($search_month_create).
'">';
708 print $formother->selectyear($search_year_create,
'search_year_create', 1, $min_year, 0);
713if (!empty($arrayfields[
'cp.tms'][
'checked'])) {
714 print
'<td class="liste_titre center width200">';
715 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_update" value="'.dol_escape_htmltag($search_month_update).
'">';
716 print $formother->selectyear($search_year_update,
'search_year_update', 1, $min_year, 0);
721if (!empty($arrayfields[
'cp.statut'][
'checked'])) {
722 print
'<td class="liste_titre center parentonrightofpage">';
723 print
$object->selectStatutCP($search_status,
'search_status',
'search_status width100 onrightofpage');
729 print
'<td class="liste_titre center maxwidthsearch">';
730 $searchpicto = $form->showFilterButtons();
737$totalarray = array();
738$totalarray[
'nbfield'] = 0;
742print
'<tr class="liste_titre">';
744 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
745 $totalarray[
'nbfield']++;
747if (!empty($arrayfields[
'cp.ref'][
'checked'])) {
748 print_liste_field_titre($arrayfields[
'cp.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.ref",
"", $param,
'', $sortfield, $sortorder);
749 $totalarray[
'nbfield']++;
751if (!empty($arrayfields[
'cp.fk_user'][
'checked'])) {
752 print_liste_field_titre($arrayfields[
'cp.fk_user'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.fk_user",
"", $param,
'', $sortfield, $sortorder);
753 $totalarray[
'nbfield']++;
755if (!empty($arrayfields[
'cp.fk_validator'][
'checked'])) {
756 print_liste_field_titre($arrayfields[
'cp.fk_validator'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.fk_validator",
"", $param,
'', $sortfield, $sortorder);
757 $totalarray[
'nbfield']++;
759if (!empty($arrayfields[
'cp.fk_type'][
'checked'])) {
760 print_liste_field_titre($arrayfields[
'cp.fk_type'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder);
761 $totalarray[
'nbfield']++;
763if (!empty($arrayfields[
'duration'][
'checked'])) {
764 print_liste_field_titre($arrayfields[
'duration'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right maxwidth100');
765 $totalarray[
'nbfield']++;
767if (!empty($arrayfields[
'cp.date_debut'][
'checked'])) {
768 print_liste_field_titre($arrayfields[
'cp.date_debut'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.date_debut",
"", $param,
'', $sortfield, $sortorder,
'center ');
769 $totalarray[
'nbfield']++;
771if (!empty($arrayfields[
'cp.date_fin'][
'checked'])) {
772 print_liste_field_titre($arrayfields[
'cp.date_fin'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.date_fin",
"", $param,
'', $sortfield, $sortorder,
'center ');
773 $totalarray[
'nbfield']++;
775if (!empty($arrayfields[
'cp.date_valid'][
'checked'])) {
776 print_liste_field_titre($arrayfields[
'cp.date_valid'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.date_valid",
"", $param,
'', $sortfield, $sortorder,
'center ');
777 $totalarray[
'nbfield']++;
779if (!empty($arrayfields[
'cp.date_approval'][
'checked'])) {
780 print_liste_field_titre($arrayfields[
'cp.date_approval'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.date_approval",
"", $param,
'', $sortfield, $sortorder,
'center ');
781 $totalarray[
'nbfield']++;
784include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
786$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
787$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
788print $hookmanager->resPrint;
789if (!empty($arrayfields[
'cp.date_create'][
'checked'])) {
790 print_liste_field_titre($arrayfields[
'cp.date_create'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.date_create",
"", $param,
'', $sortfield, $sortorder,
'center ');
791 $totalarray[
'nbfield']++;
793if (!empty($arrayfields[
'cp.tms'][
'checked'])) {
794 print_liste_field_titre($arrayfields[
'cp.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.tms",
"", $param,
'', $sortfield, $sortorder,
'center ');
795 $totalarray[
'nbfield']++;
797if (!empty($arrayfields[
'cp.statut'][
'checked'])) {
798 print_liste_field_titre(
"Status", $_SERVER[
"PHP_SELF"],
"cp.statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
799 $totalarray[
'nbfield']++;
803 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
804 $totalarray[
'nbfield']++;
808$listhalfday = array(
'morning' => $langs->trans(
"Morning"),
"afternoon" => $langs->trans(
"Afternoon"));
815if ($id && !$user->hasRight(
'holiday',
'readall') && !in_array($id, $childids)) {
816 $langs->load(
"errors");
817 print
'<tr class="oddeven opacitymediuem"><td colspan="10">'.$langs->trans(
"NotEnoughPermissions").
'</td></tr>';
819} elseif ($num > 0 && !empty($mysoc->country_id)) {
821 $userstatic =
new User($db);
822 $approbatorstatic =
new User($db);
824 $typeleaves =
$object->getTypes(1, -1);
827 $savnbfield = $totalarray[
'nbfield'];
828 $totalarray = array();
829 $totalarray[
'nbfield'] = 0;
831 $imaxinloop = ($limit ? min($num, $limit) : $num);
832 while ($i < $imaxinloop) {
833 $obj = $db->fetch_object($resql);
839 $holidaystatic->id = $obj->rowid;
840 $holidaystatic->ref = ($obj->ref ? $obj->ref : $obj->rowid);
841 $holidaystatic->status = $obj->status;
842 $holidaystatic->date_debut = $db->jdate($obj->date_debut);
843 $holidaystatic->date_fin = $db->jdate($obj->date_fin);
846 $userstatic->id = $obj->fk_user;
847 $userstatic->lastname = $obj->user_lastname;
848 $userstatic->firstname = $obj->user_firstname;
849 $userstatic->admin = $obj->user_admin;
850 $userstatic->email = $obj->user_email;
851 $userstatic->login = $obj->user_login;
852 $userstatic->status = $obj->user_status;
853 $userstatic->photo = $obj->user_photo;
856 $approbatorstatic->id = $obj->fk_validator;
857 $approbatorstatic->lastname = $obj->validator_lastname;
858 $approbatorstatic->firstname = $obj->validator_firstname;
859 $approbatorstatic->admin = $obj->validator_admin;
860 $approbatorstatic->email = $obj->validator_email;
861 $approbatorstatic->login = $obj->validator_login;
862 $approbatorstatic->status = $obj->validator_status;
863 $approbatorstatic->photo = $obj->validator_photo;
865 $date = $obj->date_create;
866 $date_modif = $obj->date_modification;
868 $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ?
'afternoon' :
'morning';
869 $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ?
'morning' :
'afternoon';
871 $nbopenedday =
num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday);
872 $totalduration += $nbopenedday;
874 if ($mode ==
'kanban') {
876 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
877 print
'<div class="box-flex-container kanban">';
880 $holidaystatic->fk_type = empty($typeleaves[$obj->fk_type][
'rowid']) ? 0 : $typeleaves[$obj->fk_type][
'rowid'];
883 if ($massactionbutton || $massaction) {
885 if (in_array(
$object->id, $arrayofselected)) {
888 if (empty($typeleaves[$obj->fk_type])) {
889 $labeltypeleavetoshow = $langs->trans(
"TypeWasDisabledOrRemoved", $obj->fk_type);
891 $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']);
894 $arraydata = array(
'user' => $userstatic,
'labeltype' => $labeltypeleavetoshow,
'selected' => $selected,
'nbopenedday' => $nbopenedday);
896 print $holidaystatic->getKanbanView(
'', $arraydata);
897 if ($i == ($imaxinloop - 1)) {
904 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
907 print
'<td class="nowrap center">';
908 if ($massactionbutton || $massaction) {
910 if (in_array($obj->rowid, $arrayofselected)) {
913 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
917 $totalarray[
'nbfield']++;
920 if (!empty($arrayfields[
'cp.ref'][
'checked'])) {
921 print
'<td class="nowraponall">';
922 print $holidaystatic->getNomUrl(1, 1);
925 $totalarray[
'nbfield']++;
928 if (!empty($arrayfields[
'cp.fk_user'][
'checked'])) {
929 print
'<td class="tdoverflowmax125">'.$userstatic->getNomUrl(-1,
'leave').
'</td>';
931 $totalarray[
'nbfield']++;
934 if (!empty($arrayfields[
'cp.fk_validator'][
'checked'])) {
935 print
'<td class="tdoverflowmax125">'.$approbatorstatic->getNomUrl(-1).
'</td>';
937 $totalarray[
'nbfield']++;
940 if (!empty($arrayfields[
'cp.fk_type'][
'checked'])) {
941 if (empty($typeleaves[$obj->fk_type])) {
942 $labeltypeleavetoshow = $langs->trans(
"TypeWasDisabledOrRemoved", $obj->fk_type);
944 $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']);
947 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($labeltypeleavetoshow).
'">';
948 print $labeltypeleavetoshow;
951 $totalarray[
'nbfield']++;
954 if (!empty($arrayfields[
'duration'][
'checked'])) {
955 print
'<td class="right">';
960 $totalarray[
'nbfield']++;
963 if (!empty($arrayfields[
'cp.date_debut'][
'checked'])) {
964 print
'<td class="center">';
966 print
' <span class="opacitymedium nowraponall">('.$langs->trans($listhalfday[$starthalfday]).
')</span>';
969 $totalarray[
'nbfield']++;
972 if (!empty($arrayfields[
'cp.date_fin'][
'checked'])) {
973 print
'<td class="center">';
975 print
' <span class="opacitymedium nowraponall">('.$langs->trans($listhalfday[$endhalfday]).
')</span>';
978 $totalarray[
'nbfield']++;
982 if (!empty($arrayfields[
'cp.date_valid'][
'checked'])) {
983 print
'<td class="center" title="'.dol_print_date($db->jdate($obj->date_valid),
'dayhour').
'">';
987 $totalarray[
'nbfield']++;
991 if (!empty($arrayfields[
'cp.date_approval'][
'checked'])) {
992 print
'<td class="center" title="'.dol_print_date($db->jdate($obj->date_approval),
'dayhour').
'">';
996 $totalarray[
'nbfield']++;
1001 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1003 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1004 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
1005 print $hookmanager->resPrint;
1008 if (!empty($arrayfields[
'cp.date_create'][
'checked'])) {
1009 print
'<td style="text-align: center;">'.dol_print_date($date,
'dayhour').
'</td>';
1011 $totalarray[
'nbfield']++;
1014 if (!empty($arrayfields[
'cp.tms'][
'checked'])) {
1015 print
'<td style="text-align: center;">'.dol_print_date($date_modif,
'dayhour').
'</td>';
1017 $totalarray[
'nbfield']++;
1021 if (!empty($arrayfields[
'cp.statut'][
'checked'])) {
1022 print
'<td class="center nowrap">'.$holidaystatic->getLibStatut(5).
'</td>';
1024 $totalarray[
'nbfield']++;
1030 print
'<td class="nowrap center">';
1031 if ($massactionbutton || $massaction) {
1033 if (in_array($obj->rowid, $arrayofselected)) {
1036 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1040 $totalarray[
'nbfield']++;
1050 if ($mode !=
'kanban' && !empty($arrayfields[
'duration'][
'checked'])) {
1051 print
'<tr class="total">';
1055 foreach ($arrayfields as $key => $val) {
1056 if (!empty($val[
'checked'])) {
1057 if ($key ==
'duration') {
1058 print
'<td class="right">'.$totalduration.
' '.$langs->trans(
'DurationDays').
'</td>';
1075 foreach ($arrayfields as $key => $val) {
1076 if (!empty($val[
'checked'])) {
1080 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1085$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1086$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1087print $hookmanager->resPrint;
1089print
'</table>'.
"\n";
1092print
'</form>'.
"\n";
1117 $typeleaves = $holiday->getTypes(1, 1);
1118 foreach ($typeleaves as $key => $val) {
1119 $nb_type = $holiday->getCPforUser($user_id, $val[
'rowid']);
1120 $nb_holiday += $nb_type;
1121 $out .=
' - '.$val[
'label'].
': <strong>'.($nb_type ?
price2num($nb_type) : 0).
'</strong><br>';
1123 $out = $langs->trans(
'SoldeCPUser', round($nb_holiday, 5)).
'<br>'.$out;
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class 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, $country_code='')
Function to return number of working days (and text of units) between two dates (working days)
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
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)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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.