31require
'../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
36require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
43$langs->loadLangs(array(
'users',
'other',
'holiday',
'hrm'));
46if ($user->socid > 0) {
50$action =
GETPOST(
'action',
'aZ09');
51$massaction =
GETPOST(
'massaction',
'alpha');
53$confirm =
GETPOST(
'confirm',
'alpha');
54$cancel =
GETPOST(
'cancel',
'alpha');
55$toselect =
GETPOST(
'toselect',
'array');
56$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'holidaylist';
57$mode =
GETPOST(
'mode',
'alpha');
58$backtopage =
GETPOST(
'backtopage',
'alpha');
59$optioncss =
GETPOST(
'optioncss',
'aZ');
63$childids = $user->getAllChildIds(1);
66$diroutputmassaction = $conf->holiday->dir_output.
'/temp/massgeneration/'.$user->id;
71$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
72$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
74if (empty($page) || $page == -1) {
77$offset = $limit * $page;
84 $sortfield =
"cp.ref";
87$search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
88$search_ref =
GETPOST(
'search_ref',
'alphanohtml');
89$search_day_create =
GETPOST(
'search_day_create',
'int');
90$search_month_create =
GETPOST(
'search_month_create',
'int');
91$search_year_create =
GETPOST(
'search_year_create',
'int');
92$search_day_start =
GETPOST(
'search_day_start',
'int');
93$search_month_start =
GETPOST(
'search_month_start',
'int');
94$search_year_start =
GETPOST(
'search_year_start',
'int');
95$search_day_end =
GETPOST(
'search_day_end',
'int');
96$search_month_end =
GETPOST(
'search_month_end',
'int');
97$search_year_end =
GETPOST(
'search_year_end',
'int');
98$search_employee =
GETPOST(
'search_employee',
'intcomma');
99$search_valideur =
GETPOST(
'search_valideur',
'intcomma');
100$search_status =
GETPOST(
'search_status',
'intcomma');
101$search_type =
GETPOST(
'search_type',
'intcomma');
106$hookmanager->initHooks(array(
'holidaylist'));
109$extrafields->fetch_name_optionals_label(
$object->table_element);
111$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
114$fieldstosearchall = array(
116 'cp.description' =>
'Description',
117 'uu.lastname' =>
'EmployeeLastname',
118 'uu.firstname' =>
'EmployeeFirstname',
119 'uu.login' =>
'Login'
123 'cp.ref' => array(
'label' => $langs->trans(
"Ref"),
'checked' => 1),
124 'cp.fk_user' => array(
'label' => $langs->trans(
"Employee"),
'checked' => 1,
'position' => 20),
125 'cp.fk_validator' => array(
'label' => $langs->trans(
"ValidatorCP"),
'checked' => 1,
'position' => 30),
126 'cp.fk_type' => array(
'label' => $langs->trans(
"Type"),
'checked' => 1,
'position' => 35),
127 'duration' => array(
'label' => $langs->trans(
"NbUseDaysCPShort"),
'checked' => 1,
'position' => 38),
128 'cp.date_debut' => array(
'label' => $langs->trans(
"DateStart"),
'checked' => 1,
'position' => 40),
129 'cp.date_fin' => array(
'label' => $langs->trans(
"DateEnd"),
'checked' => 1,
'position' => 42),
130 'cp.date_valid' => array(
'label' => $langs->trans(
"DateValidation"),
'checked' => 1,
'position' => 60),
131 'cp.date_approval' => array(
'label' => $langs->trans(
"DateApprove"),
'checked' => 1,
'position' => 70),
132 'cp.date_create' => array(
'label' => $langs->trans(
"DateCreation"),
'checked' => 0,
'position' => 500),
133 'cp.tms' => array(
'label' => $langs->trans(
"DateModificationShort"),
'checked' => 0,
'position' => 501),
134 'cp.statut' => array(
'label' => $langs->trans(
"Status"),
'checked' => 1,
'position' => 1000),
137include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
142if ($user->socid > 0) {
147$permissiontoread = $user->hasRight(
'holiday',
'read');
148$permissiontodelete = $user->hasRight(
'holiday',
'delete');
149$permissiontoapprove = $user->hasRight(
'holiday',
'approve');
151if (!isModEnabled(
'holiday')) {
159 if (
$id == $user->id) {
162 if ($user->hasRight(
'holiday',
'readall')) {
165 if ($user->hasRight(
'holiday',
'read') && in_array(
$id, $childids)) {
179if (
GETPOST(
'cancel',
'alpha')) {
183if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
187$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
188$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
193if (empty($reshook)) {
195 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
198 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
200 $search_month_create =
"";
201 $search_year_create =
"";
202 $search_month_start =
"";
203 $search_year_start =
"";
204 $search_month_end =
"";
205 $search_year_end =
"";
206 $search_employee =
"";
207 $search_valideur =
"";
211 $search_array_options = array();
213 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
214 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
219 $objectclass =
'Holiday';
220 $objectlabel =
'Holiday';
221 $uploaddir = $conf->holiday->dir_output;
222 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
230$form =
new Form($db);
234$fuser =
new User($db);
235$holidaystatic =
new Holiday($db);
238$result =
$object->updateBalance();
240$title = $langs->trans(
'CPTitreMenu');
241$help_url =
'EN:Module_Holiday';
243llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-holiday page-list');
253 $fuser->fetch(
$id,
'',
'', 1);
254 $fuser->loadRights();
255 $user_id = $fuser->id;
257 $search_employee = $user_id;
267$sql .=
" cp.fk_user,";
268$sql .=
" cp.fk_type,";
269$sql .=
" cp.date_create,";
270$sql .=
" cp.tms as date_modification,";
271$sql .=
" cp.description,";
272$sql .=
" cp.date_debut,";
273$sql .=
" cp.date_fin,";
274$sql .=
" cp.halfday,";
275$sql .=
" cp.statut as status,";
276$sql .=
" cp.fk_validator,";
277$sql .=
" cp.date_valid,";
278$sql .=
" cp.fk_user_valid,";
279$sql .=
" cp.date_approval,";
280$sql .=
" cp.fk_user_approve,";
281$sql .=
" cp.date_refuse,";
282$sql .=
" cp.fk_user_refuse,";
283$sql .=
" cp.date_cancel,";
284$sql .=
" cp.fk_user_cancel,";
285$sql .=
" cp.detail_refuse,";
287$sql .=
" uu.lastname as user_lastname,";
288$sql .=
" uu.firstname as user_firstname,";
289$sql .=
" uu.admin as user_admin,";
290$sql .=
" uu.email as user_email,";
291$sql .=
" uu.login as user_login,";
292$sql .=
" uu.statut as user_status,";
293$sql .=
" uu.photo as user_photo,";
295$sql .=
" ua.lastname as validator_lastname,";
296$sql .=
" ua.firstname as validator_firstname,";
297$sql .=
" ua.admin as validator_admin,";
298$sql .=
" ua.email as validator_email,";
299$sql .=
" ua.login as validator_login,";
300$sql .=
" ua.statut as validator_status,";
301$sql .=
" ua.photo as validator_photo";
303if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
304 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
305 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
309$parameters = array();
310$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
311$sql .= $hookmanager->resPrint;
312$sql = preg_replace(
'/,\s*$/',
'', $sql);
316$sql .=
" FROM ".MAIN_DB_PREFIX.
"holiday as cp";
317if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
318 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (cp.rowid = ef.fk_object)";
320$sql .=
", ".MAIN_DB_PREFIX.
"user as uu, ".MAIN_DB_PREFIX.
"user as ua";
321$sql .=
" WHERE cp.entity IN (".getEntity(
'holiday').
")";
322$sql .=
" AND cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid ";
324if (!empty($search_all)) {
325 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
328if (!empty($search_ref)) {
332$sql .=
dolSqlDateFilter(
"cp.date_debut", $search_day_start, $search_month_start, $search_year_start);
334$sql .=
dolSqlDateFilter(
"cp.date_fin", $search_day_end, $search_month_end, $search_year_end);
336$sql .=
dolSqlDateFilter(
"cp.date_create", $search_day_create, $search_month_create, $search_year_create);
338if (!empty($search_employee) && $search_employee != -1) {
339 $sql .=
" AND cp.fk_user = '".$db->escape($search_employee).
"'\n";
342if (!empty($search_valideur) && $search_valideur != -1) {
343 $sql .=
" AND cp.fk_validator = '".$db->escape($search_valideur).
"'\n";
346if (!empty($search_type) && $search_type != -1) {
347 $sql .=
' AND cp.fk_type IN ('.$db->sanitize($db->escape($search_type)).
')';
350if (!empty($search_status) && $search_status != -1) {
351 $sql .=
" AND cp.statut = '".$db->escape($search_status).
"'\n";
354if (!$user->hasRight(
'holiday',
'readall')) {
355 $sql .=
' AND cp.fk_user IN ('.$db->sanitize(implode(
',', $childids)).
')';
358 $sql .=
" AND cp.fk_user IN (".$db->sanitize(
$id).
")";
362include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
364$parameters = array();
365$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
366$sql .= $hookmanager->resPrint;
369$nbtotalofrecords =
'';
372 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
373 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
374 $resql = $db->query($sqlforcount);
376 $objforcount = $db->fetch_object($resql);
377 $nbtotalofrecords = $objforcount->nbtotalofrecords;
382 if (($page * $limit) > $nbtotalofrecords) {
390$sql .= $db->order($sortfield, $sortorder);
392 $sql .= $db->plimit($limit + 1, $offset);
396$resql = $db->query($sql);
402$num = $db->num_rows($resql);
404$arrayofselected = is_array($toselect) ? $toselect : array();
408 $param .=
'&mode='.urlencode($mode);
410if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
411 $param .=
'&contextpage='.urlencode($contextpage);
413if ($limit > 0 && $limit != $conf->liste_limit) {
414 $param .=
'&limit='.((int) $limit);
416if ($optioncss !=
'') {
417 $param .=
'&optioncss='.urlencode($optioncss);
420 $param .=
'&search_ref='.urlencode($search_ref);
422if ($search_day_create) {
423 $param .=
'&search_day_create='.urlencode($search_day_create);
425if ($search_month_create) {
426 $param .=
'&search_month_create='.urlencode($search_month_create);
428if ($search_year_create) {
429 $param .=
'&search_year_create='.urlencode($search_year_create);
431if ($search_day_start) {
432 $param .=
'&search_day_start='.urlencode($search_day_start);
434if ($search_month_start) {
435 $param .=
'&search_month_start='.urlencode($search_month_start);
437if ($search_year_start) {
438 $param .=
'&search_year_start='.urlencode($search_year_start);
440if ($search_day_end) {
441 $param .=
'&search_day_end='.urlencode($search_day_end);
443if ($search_month_end) {
444 $param .=
'&search_month_end='.urlencode($search_month_end);
446if ($search_year_end) {
447 $param .=
'&search_year_end='.urlencode($search_year_end);
449if ($search_employee > 0) {
450 $param .=
'&search_employee='.urlencode($search_employee);
452if ($search_valideur > 0) {
453 $param .=
'&search_valideur='.urlencode((
string) ($search_valideur));
455if ($search_type > 0) {
456 $param .=
'&search_type='.urlencode((
string) ($search_type));
458if ($search_status > 0) {
459 $param .=
'&search_status='.urlencode($search_status);
462include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
465$arrayofmassactions = array(
470if (!empty($permissiontodelete)) {
471 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
473if (!empty($permissiontoapprove)) {
474 $arrayofmassactions[
'preapproveleave'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Approve");
476if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
477 $arrayofmassactions = array();
479$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
481print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
482if ($optioncss !=
'') {
483 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
485print
'<input type="hidden" name="token" value="'.newToken().
'">';
486print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
487print
'<input type="hidden" name="action" value="'.($action ==
'edit' ?
'update' :
'list').
'">';
488print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
489print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
490print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
491print
'<input type="hidden" name="page" value="'.$page.
'">';
492print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
493print
'<input type="hidden" name="page_y" value="">';
494print
'<input type="hidden" name="mode" value="'.$mode.
'">';
496 print
'<input type="hidden" name="id" value="'.$id.
'">';
500 $title = $langs->trans(
"User");
501 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
506 dol_banner_tab($fuser,
'id', $linkback, $user->hasRight(
'user',
'user',
'lire') || $user->admin);
509 print
'<div class="underbanner clearboth"></div>';
520 print
'<div class="tabsAction">';
523 if ($user->hasRight(
'holiday',
'writeall')) {
526 if ($user->hasRight(
'holiday',
'write') && in_array($user_id, $childids)) {
531 print
'<a href="'.DOL_URL_ROOT.
'/holiday/card.php?action=create&fuserid='.$user_id.
'" class="butAction">'.$langs->trans(
"AddCP").
'</a>';
536 $title = $langs->trans(
"ListeCP");
540 $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'));
541 $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'));
543 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'MenuAddCP'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/holiday/card.php?action=create',
'', $user->hasRight(
'holiday',
'write'));
545 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'title_hrm', 0, $newcardbutton,
'', $limit, 0, 0, 1);
548$topicmail =
"Information";
549$modelmail =
"leaverequest";
551$trackid =
'leav'.$object->id;
552include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
556 foreach ($fieldstosearchall as $key => $val) {
557 $fieldstosearchall[$key] = $langs->trans($val);
558 $setupstring .= $key.
"=".$val.
";";
560 print
'<!-- Search done like if HOLIDAY_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
561 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
566$parameters = array();
567$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
568if (empty($reshook)) {
569 $moreforfilter .= $hookmanager->resPrint;
571 $moreforfilter = $hookmanager->resPrint;
574if (!empty($moreforfilter)) {
575 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
576 print $moreforfilter;
580$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
581$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
582$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
583$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
586if (!$user->hasRight(
'holiday',
'readall')) {
587 $include =
'hierarchyme';
590print
'<div class="div-table-responsive">';
591print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
595print
'<tr class="liste_titre_filter">';
598 print
'<td class="liste_titre center maxwidthsearch">';
599 $searchpicto = $form->showFilterButtons(
'left');
603if (!empty($arrayfields[
'cp.ref'][
'checked'])) {
604 print
'<td class="liste_titre">';
605 print
'<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
609if (!empty($arrayfields[
'cp.fk_user'][
'checked'])) {
612 $morefilter =
'AND employee = 1';
618 if (
$id && !GETPOSTISSET(
'search_employee')) {
619 $search_employee =
$id;
623 print
'<td class="liste_titre maxwidthonsmartphone left">';
624 print $form->select_dolusers($search_employee,
"search_employee", 1,
"", $disabled, $include,
'', 0, 0, 0, $morefilter, 0,
'',
'maxwidth125');
629if (!empty($arrayfields[
'cp.fk_validator'][
'checked'])) {
630 if ($user->hasRight(
'holiday',
'readall')) {
631 print
'<td class="liste_titre maxwidthonsmartphone left">';
633 $excludefilter = $user->admin ?
'' :
'u.rowid <> '.((int) $user->id);
634 $valideurobjects = $validator->listUsersForGroup($excludefilter, 1);
635 $valideurarray = array();
636 foreach ($valideurobjects as $val) {
637 $valideurarray[$val] = $val;
639 print $form->select_dolusers($search_valideur,
"search_valideur", 1,
"", 0, $valideurarray,
'', 0, 0, 0, $morefilter, 0,
'',
'maxwidth125');
642 print
'<td class="liste_titre"> </td>';
647if (!empty($arrayfields[
'cp.fk_type'][
'checked'])) {
648 print
'<td class="liste_titre">';
649 if (empty($mysoc->country_id)) {
650 setEventMessages(
null, array($langs->trans(
"ErrorSetACountryFirst"), $langs->trans(
"CompanyFoundation")),
'errors');
652 $typeleaves = $holidaystatic->getTypes(1, -1);
653 $arraytypeleaves = array();
654 foreach ($typeleaves as $key => $val) {
655 $labeltoshow = ($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']);
657 $arraytypeleaves[$val[
'rowid']] = $labeltoshow;
659 print $form->selectarray(
'search_type', $arraytypeleaves, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100', 1);
665if (!empty($arrayfields[
'duration'][
'checked'])) {
666 print
'<td class="liste_titre"> </td>';
670if (!empty($arrayfields[
'cp.date_debut'][
'checked'])) {
671 print
'<td class="liste_titre center nowraponall">';
672 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_start" value="'.dol_escape_htmltag($search_month_start).
'">';
673 print $formother->selectyear($search_year_start,
'search_year_start', 1, $min_year, $max_year);
678if (!empty($arrayfields[
'cp.date_fin'][
'checked'])) {
679 print
'<td class="liste_titre center nowraponall">';
680 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_end" value="'.dol_escape_htmltag($search_month_end).
'">';
681 print $formother->selectyear($search_year_end,
'search_year_end', 1, $min_year, $max_year);
686if (!empty($arrayfields[
'cp.date_valid'][
'checked'])) {
687 print
'<td class="liste_titre center nowraponall">';
692if (!empty($arrayfields[
'cp.date_approval'][
'checked'])) {
693 print
'<td class="liste_titre center nowraponall">';
698include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
701$parameters = array(
'arrayfields' => $arrayfields);
702$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
703print $hookmanager->resPrint;
706if (!empty($arrayfields[
'cp.date_create'][
'checked'])) {
707 print
'<td class="liste_titre center width200">';
708 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_create" value="'.dol_escape_htmltag($search_month_create).
'">';
709 print $formother->selectyear($search_year_create,
'search_year_create', 1, $min_year, 0);
714if (!empty($arrayfields[
'cp.tms'][
'checked'])) {
715 print
'<td class="liste_titre center width200">';
716 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_update" value="'.dol_escape_htmltag($search_month_update).
'">';
717 print $formother->selectyear($search_year_update,
'search_year_update', 1, $min_year, 0);
722if (!empty($arrayfields[
'cp.statut'][
'checked'])) {
723 print
'<td class="liste_titre center parentonrightofpage">';
724 print
$object->selectStatutCP($search_status,
'search_status',
'search_status width100 onrightofpage');
730 print
'<td class="liste_titre center maxwidthsearch">';
731 $searchpicto = $form->showFilterButtons();
738$totalarray = array();
739$totalarray[
'nbfield'] = 0;
743print
'<tr class="liste_titre">';
745 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
746 $totalarray[
'nbfield']++;
748if (!empty($arrayfields[
'cp.ref'][
'checked'])) {
749 print_liste_field_titre($arrayfields[
'cp.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.ref",
"", $param,
'', $sortfield, $sortorder);
750 $totalarray[
'nbfield']++;
752if (!empty($arrayfields[
'cp.fk_user'][
'checked'])) {
753 print_liste_field_titre($arrayfields[
'cp.fk_user'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.fk_user",
"", $param,
'', $sortfield, $sortorder);
754 $totalarray[
'nbfield']++;
756if (!empty($arrayfields[
'cp.fk_validator'][
'checked'])) {
757 print_liste_field_titre($arrayfields[
'cp.fk_validator'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.fk_validator",
"", $param,
'', $sortfield, $sortorder);
758 $totalarray[
'nbfield']++;
760if (!empty($arrayfields[
'cp.fk_type'][
'checked'])) {
761 print_liste_field_titre($arrayfields[
'cp.fk_type'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder);
762 $totalarray[
'nbfield']++;
764if (!empty($arrayfields[
'duration'][
'checked'])) {
765 print_liste_field_titre($arrayfields[
'duration'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right maxwidth100');
766 $totalarray[
'nbfield']++;
768if (!empty($arrayfields[
'cp.date_debut'][
'checked'])) {
769 print_liste_field_titre($arrayfields[
'cp.date_debut'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.date_debut",
"", $param,
'', $sortfield, $sortorder,
'center ');
770 $totalarray[
'nbfield']++;
772if (!empty($arrayfields[
'cp.date_fin'][
'checked'])) {
773 print_liste_field_titre($arrayfields[
'cp.date_fin'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.date_fin",
"", $param,
'', $sortfield, $sortorder,
'center ');
774 $totalarray[
'nbfield']++;
776if (!empty($arrayfields[
'cp.date_valid'][
'checked'])) {
777 print_liste_field_titre($arrayfields[
'cp.date_valid'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.date_valid",
"", $param,
'', $sortfield, $sortorder,
'center ');
778 $totalarray[
'nbfield']++;
780if (!empty($arrayfields[
'cp.date_approval'][
'checked'])) {
781 print_liste_field_titre($arrayfields[
'cp.date_approval'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.date_approval",
"", $param,
'', $sortfield, $sortorder,
'center ');
782 $totalarray[
'nbfield']++;
785include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
787$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
788$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
789print $hookmanager->resPrint;
790if (!empty($arrayfields[
'cp.date_create'][
'checked'])) {
791 print_liste_field_titre($arrayfields[
'cp.date_create'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.date_create",
"", $param,
'', $sortfield, $sortorder,
'center ');
792 $totalarray[
'nbfield']++;
794if (!empty($arrayfields[
'cp.tms'][
'checked'])) {
795 print_liste_field_titre($arrayfields[
'cp.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.tms",
"", $param,
'', $sortfield, $sortorder,
'center ');
796 $totalarray[
'nbfield']++;
798if (!empty($arrayfields[
'cp.statut'][
'checked'])) {
799 print_liste_field_titre(
"Status", $_SERVER[
"PHP_SELF"],
"cp.statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
800 $totalarray[
'nbfield']++;
804 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
805 $totalarray[
'nbfield']++;
809$listhalfday = array(
'morning' => $langs->trans(
"Morning"),
"afternoon" => $langs->trans(
"Afternoon"));
816if (
$id && !$user->hasRight(
'holiday',
'readall') && !in_array(
$id, $childids)) {
817 $langs->load(
"errors");
818 print
'<tr class="oddeven opacitymediuem"><td colspan="10">'.$langs->trans(
"NotEnoughPermissions").
'</td></tr>';
820} elseif ($num > 0 && !empty($mysoc->country_id)) {
822 $userstatic =
new User($db);
823 $approbatorstatic =
new User($db);
825 $typeleaves =
$object->getTypes(1, -1);
828 $savnbfield = $totalarray[
'nbfield'];
829 $totalarray = array();
830 $totalarray[
'nbfield'] = 0;
832 $imaxinloop = ($limit ? min($num, $limit) : $num);
833 while ($i < $imaxinloop) {
834 $obj = $db->fetch_object($resql);
840 $holidaystatic->id = $obj->rowid;
841 $holidaystatic->ref = ($obj->ref ? $obj->ref : $obj->rowid);
842 $holidaystatic->status = $obj->status;
843 $holidaystatic->date_debut = $db->jdate($obj->date_debut);
844 $holidaystatic->date_fin = $db->jdate($obj->date_fin);
847 $userstatic->id = $obj->fk_user;
848 $userstatic->lastname = $obj->user_lastname;
849 $userstatic->firstname = $obj->user_firstname;
850 $userstatic->admin = $obj->user_admin;
851 $userstatic->email = $obj->user_email;
852 $userstatic->login = $obj->user_login;
853 $userstatic->status = $obj->user_status;
854 $userstatic->photo = $obj->user_photo;
857 $approbatorstatic->id = $obj->fk_validator;
858 $approbatorstatic->lastname = $obj->validator_lastname;
859 $approbatorstatic->firstname = $obj->validator_firstname;
860 $approbatorstatic->admin = $obj->validator_admin;
861 $approbatorstatic->email = $obj->validator_email;
862 $approbatorstatic->login = $obj->validator_login;
863 $approbatorstatic->status = $obj->validator_status;
864 $approbatorstatic->photo = $obj->validator_photo;
866 $date = $obj->date_create;
867 $date_modif = $obj->date_modification;
869 $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ?
'afternoon' :
'morning';
870 $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ?
'morning' :
'afternoon';
872 $nbopenedday =
num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday);
873 $totalduration += $nbopenedday;
875 if ($mode ==
'kanban') {
877 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
878 print
'<div class="box-flex-container kanban">';
881 $holidaystatic->fk_type = empty($typeleaves[$obj->fk_type][
'rowid']) ? 0 : $typeleaves[$obj->fk_type][
'rowid'];
884 if ($massactionbutton || $massaction) {
886 if (in_array(
$object->id, $arrayofselected)) {
889 if (empty($typeleaves[$obj->fk_type])) {
890 $labeltypeleavetoshow = $langs->trans(
"TypeWasDisabledOrRemoved", $obj->fk_type);
892 $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']);
895 $arraydata = array(
'user' => $userstatic,
'labeltype' => $labeltypeleavetoshow,
'selected' => $selected,
'nbopenedday' => $nbopenedday);
897 print $holidaystatic->getKanbanView(
'', $arraydata);
898 if ($i == ($imaxinloop - 1)) {
905 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
908 print
'<td class="nowrap center">';
909 if ($massactionbutton || $massaction) {
911 if (in_array($obj->rowid, $arrayofselected)) {
914 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
918 $totalarray[
'nbfield']++;
921 if (!empty($arrayfields[
'cp.ref'][
'checked'])) {
922 print
'<td class="nowraponall">';
923 print $holidaystatic->getNomUrl(1, 1);
926 $totalarray[
'nbfield']++;
929 if (!empty($arrayfields[
'cp.fk_user'][
'checked'])) {
930 print
'<td class="tdoverflowmax125">'.$userstatic->getNomUrl(-1,
'leave').
'</td>';
932 $totalarray[
'nbfield']++;
935 if (!empty($arrayfields[
'cp.fk_validator'][
'checked'])) {
936 print
'<td class="tdoverflowmax125">'.$approbatorstatic->getNomUrl(-1).
'</td>';
938 $totalarray[
'nbfield']++;
941 if (!empty($arrayfields[
'cp.fk_type'][
'checked'])) {
942 if (empty($typeleaves[$obj->fk_type])) {
943 $labeltypeleavetoshow = $langs->trans(
"TypeWasDisabledOrRemoved", $obj->fk_type);
945 $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']);
948 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($labeltypeleavetoshow).
'">';
949 print $labeltypeleavetoshow;
952 $totalarray[
'nbfield']++;
955 if (!empty($arrayfields[
'duration'][
'checked'])) {
956 print
'<td class="right">';
961 $totalarray[
'nbfield']++;
964 if (!empty($arrayfields[
'cp.date_debut'][
'checked'])) {
965 print
'<td class="center">';
967 print
' <span class="opacitymedium nowraponall">('.$langs->trans($listhalfday[$starthalfday]).
')</span>';
970 $totalarray[
'nbfield']++;
973 if (!empty($arrayfields[
'cp.date_fin'][
'checked'])) {
974 print
'<td class="center">';
976 print
' <span class="opacitymedium nowraponall">('.$langs->trans($listhalfday[$endhalfday]).
')</span>';
979 $totalarray[
'nbfield']++;
983 if (!empty($arrayfields[
'cp.date_valid'][
'checked'])) {
984 print
'<td class="center" title="'.dol_print_date($db->jdate($obj->date_valid),
'dayhour').
'">';
988 $totalarray[
'nbfield']++;
992 if (!empty($arrayfields[
'cp.date_approval'][
'checked'])) {
993 print
'<td class="center" title="'.dol_print_date($db->jdate($obj->date_approval),
'dayhour').
'">';
997 $totalarray[
'nbfield']++;
1002 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1004 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1005 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
1006 print $hookmanager->resPrint;
1009 if (!empty($arrayfields[
'cp.date_create'][
'checked'])) {
1010 print
'<td style="text-align: center;">'.dol_print_date($date,
'dayhour').
'</td>';
1012 $totalarray[
'nbfield']++;
1015 if (!empty($arrayfields[
'cp.tms'][
'checked'])) {
1016 print
'<td style="text-align: center;">'.dol_print_date($date_modif,
'dayhour').
'</td>';
1018 $totalarray[
'nbfield']++;
1022 if (!empty($arrayfields[
'cp.statut'][
'checked'])) {
1023 print
'<td class="center nowrap">'.$holidaystatic->getLibStatut(5).
'</td>';
1025 $totalarray[
'nbfield']++;
1031 print
'<td class="nowrap center">';
1032 if ($massactionbutton || $massaction) {
1034 if (in_array($obj->rowid, $arrayofselected)) {
1037 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1041 $totalarray[
'nbfield']++;
1051 if ($mode !=
'kanban' && !empty($arrayfields[
'duration'][
'checked'])) {
1052 print
'<tr class="total">';
1056 foreach ($arrayfields as $key => $val) {
1057 if (!empty($val[
'checked'])) {
1058 if ($key ==
'duration') {
1059 print
'<td class="right">'.$totalduration.
' '.$langs->trans(
'DurationDays').
'</td>';
1076 foreach ($arrayfields as $key => $val) {
1077 if (!empty($val[
'checked'])) {
1081 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1086$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1087$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1088print $hookmanager->resPrint;
1090print
'</table>'.
"\n";
1093print
'</form>'.
"\n";
1118 $typeleaves = $holiday->getTypes(1, 1);
1119 foreach ($typeleaves as $key => $val) {
1120 $nb_type = $holiday->getCPforUser($user_id, $val[
'rowid']);
1121 $nb_holiday += $nb_type;
1122 $out .=
' - '.$val[
'label'].
': <strong>'.($nb_type ?
price2num($nb_type) : 0).
'</strong><br>';
1124 $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($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, $country_code='')
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.
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.
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.
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.