32require
'../main.inc.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
37require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
52$langs->loadLangs(array(
'users',
'other',
'holiday',
'hrm'));
55if ($user->socid > 0) {
59$action =
GETPOST(
'action',
'aZ09');
60$massaction =
GETPOST(
'massaction',
'alpha');
62$confirm =
GETPOST(
'confirm',
'alpha');
63$cancel =
GETPOST(
'cancel',
'alpha');
64$toselect =
GETPOST(
'toselect',
'array');
65$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'holidaylist';
66$mode =
GETPOST(
'mode',
'alpha');
67$backtopage =
GETPOST(
'backtopage',
'alpha');
68$optioncss =
GETPOST(
'optioncss',
'aZ');
72$childids = $user->getAllChildIds(1);
75$diroutputmassaction =
$conf->holiday->dir_output.
'/temp/massgeneration/'.$user->id;
80$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
81$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
83if (empty($page) || $page == -1) {
86$offset = $limit * $page;
93 $sortfield =
"cp.ref";
96$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
97$search_ref =
GETPOST(
'search_ref',
'alphanohtml');
98$search_day_create =
GETPOST(
'search_day_create',
'int');
99$search_month_create =
GETPOST(
'search_month_create',
'int');
100$search_year_create =
GETPOST(
'search_year_create',
'int');
101$search_day_start =
GETPOST(
'search_day_start',
'int');
102$search_month_start =
GETPOST(
'search_month_start',
'int');
103$search_year_start =
GETPOST(
'search_year_start',
'int');
104$search_day_end =
GETPOST(
'search_day_end',
'int');
105$search_month_end =
GETPOST(
'search_month_end',
'int');
106$search_year_end =
GETPOST(
'search_year_end',
'int');
107$search_employee =
GETPOST(
'search_employee',
'intcomma');
108$search_valideur =
GETPOST(
'search_valideur',
'intcomma');
109$search_status =
GETPOST(
'search_status',
'intcomma');
110$search_type =
GETPOST(
'search_type',
'intcomma');
115$hookmanager->initHooks(array(
'holidaylist'));
118$extrafields->fetch_name_optionals_label(
$object->table_element);
120$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
123$fieldstosearchall = array(
125 'cp.description' =>
'Description',
126 'uu.lastname' =>
'EmployeeLastname',
127 'uu.firstname' =>
'EmployeeFirstname',
128 'uu.login' =>
'Login'
132 'cp.ref' => array(
'label' => $langs->trans(
"Ref"),
'checked' => 1),
133 'cp.fk_user' => array(
'label' => $langs->trans(
"Employee"),
'checked' => 1,
'position' => 20),
134 'cp.fk_validator' => array(
'label' => $langs->trans(
"ValidatorCP"),
'checked' => 1,
'position' => 30),
135 'cp.fk_type' => array(
'label' => $langs->trans(
"Type"),
'checked' => 1,
'position' => 35),
136 'duration' => array(
'label' => $langs->trans(
"NbUseDaysCPShort"),
'checked' => 1,
'position' => 38),
137 'cp.date_debut' => array(
'label' => $langs->trans(
"DateStart"),
'checked' => 1,
'position' => 40),
138 'cp.date_fin' => array(
'label' => $langs->trans(
"DateEnd"),
'checked' => 1,
'position' => 42),
139 'cp.date_valid' => array(
'label' => $langs->trans(
"DateValidation"),
'checked' => 1,
'position' => 60),
140 'cp.date_approval' => array(
'label' => $langs->trans(
"DateApprove"),
'checked' => 1,
'position' => 70),
141 'cp.date_create' => array(
'label' => $langs->trans(
"DateCreation"),
'checked' => 0,
'position' => 500),
142 'cp.tms' => array(
'label' => $langs->trans(
"DateModificationShort"),
'checked' => 0,
'position' => 501),
143 'cp.statut' => array(
'label' => $langs->trans(
"Status"),
'checked' => 1,
'position' => 1000),
146include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
151if ($user->socid > 0) {
156$permissiontoread = $user->hasRight(
'holiday',
'read');
157$permissiontodelete = $user->hasRight(
'holiday',
'delete');
158$permissiontoapprove = $user->hasRight(
'holiday',
'approve');
160if (!isModEnabled(
'holiday')) {
168 if (
$id == $user->id) {
171 if ($user->hasRight(
'holiday',
'readall')) {
174 if ($user->hasRight(
'holiday',
'read') && in_array(
$id, $childids)) {
188if (
GETPOST(
'cancel',
'alpha')) {
192if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
196$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
197$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
202if (empty($reshook)) {
204 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
207 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
209 $search_month_create =
"";
210 $search_year_create =
"";
211 $search_month_start =
"";
212 $search_year_start =
"";
213 $search_month_end =
"";
214 $search_year_end =
"";
215 $search_employee =
"";
216 $search_valideur =
"";
220 $search_array_options = array();
222 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
223 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
228 $objectclass =
'Holiday';
229 $objectlabel =
'Holiday';
230 $uploaddir =
$conf->holiday->dir_output;
231 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
239$form =
new Form($db);
243$fuser =
new User($db);
244$holidaystatic =
new Holiday($db);
247$result =
$object->updateBalance();
249$title = $langs->trans(
'CPTitreMenu');
250$help_url =
'EN:Module_Holiday';
252llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-holiday page-list');
262 $fuser->fetch(
$id,
'',
'', 1);
263 $fuser->loadRights();
264 $user_id = $fuser->id;
266 $search_employee = $user_id;
276$sql .=
" cp.fk_user,";
277$sql .=
" cp.fk_type,";
278$sql .=
" cp.date_create,";
279$sql .=
" cp.tms as date_modification,";
280$sql .=
" cp.description,";
281$sql .=
" cp.date_debut,";
282$sql .=
" cp.date_fin,";
283$sql .=
" cp.halfday,";
284$sql .=
" cp.statut as status,";
285$sql .=
" cp.fk_validator,";
286$sql .=
" cp.date_valid,";
287$sql .=
" cp.fk_user_valid,";
288$sql .=
" cp.date_approval,";
289$sql .=
" cp.fk_user_approve,";
290$sql .=
" cp.date_refuse,";
291$sql .=
" cp.fk_user_refuse,";
292$sql .=
" cp.date_cancel,";
293$sql .=
" cp.fk_user_cancel,";
294$sql .=
" cp.detail_refuse,";
296$sql .=
" uu.lastname as user_lastname,";
297$sql .=
" uu.firstname as user_firstname,";
298$sql .=
" uu.admin as user_admin,";
299$sql .=
" uu.email as user_email,";
300$sql .=
" uu.login as user_login,";
301$sql .=
" uu.statut as user_status,";
302$sql .=
" uu.photo as user_photo,";
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 IN (".$db->sanitize(
$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) > $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>';
545 $title = $langs->trans(
"ListeCP");
549 $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'));
550 $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'));
552 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'MenuAddCP'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/holiday/card.php?action=create',
'', $user->hasRight(
'holiday',
'write'));
554 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'title_hrm', 0, $newcardbutton,
'', $limit, 0, 0, 1);
557$topicmail =
"Information";
558$modelmail =
"leaverequest";
560$trackid =
'leav'.$object->id;
561include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
565 foreach ($fieldstosearchall as $key => $val) {
566 $fieldstosearchall[$key] = $langs->trans($val);
567 $setupstring .= $key.
"=".$val.
";";
569 print
'<!-- Search done like if HOLIDAY_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
570 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
575$parameters = array();
576$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
577if (empty($reshook)) {
578 $moreforfilter .= $hookmanager->resPrint;
580 $moreforfilter = $hookmanager->resPrint;
583if (!empty($moreforfilter)) {
584 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
585 print $moreforfilter;
589$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
590$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
591$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
592$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
595if (!$user->hasRight(
'holiday',
'readall')) {
596 $include =
'hierarchyme';
599print
'<div class="div-table-responsive">';
600print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
604print
'<tr class="liste_titre_filter">';
607 print
'<td class="liste_titre center maxwidthsearch">';
608 $searchpicto = $form->showFilterButtons(
'left');
612if (!empty($arrayfields[
'cp.ref'][
'checked'])) {
613 print
'<td class="liste_titre">';
614 print
'<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
618if (!empty($arrayfields[
'cp.fk_user'][
'checked'])) {
621 $morefilter =
'AND employee = 1';
627 if (
$id && !GETPOSTISSET(
'search_employee')) {
628 $search_employee =
$id;
632 print
'<td class="liste_titre maxwidthonsmartphone left">';
633 print $form->select_dolusers($search_employee,
"search_employee", 1,
"", $disabled, $include,
'', 0, 0, 0, $morefilter, 0,
'',
'maxwidth125');
638if (!empty($arrayfields[
'cp.fk_validator'][
'checked'])) {
639 if ($user->hasRight(
'holiday',
'readall')) {
640 print
'<td class="liste_titre maxwidthonsmartphone left">';
642 $excludefilter = $user->admin ?
'' :
'u.rowid <> '.((int) $user->id);
643 $valideurobjects = $validator->listUsersForGroup($excludefilter, 1);
644 $valideurarray = array();
645 foreach ($valideurobjects as $val) {
646 $valideurarray[$val] = $val;
648 print $form->select_dolusers($search_valideur,
"search_valideur", 1,
"", 0, $valideurarray,
'', 0, 0, 0, $morefilter, 0,
'',
'maxwidth125');
651 print
'<td class="liste_titre"> </td>';
656if (!empty($arrayfields[
'cp.fk_type'][
'checked'])) {
657 print
'<td class="liste_titre">';
658 if (empty($mysoc->country_id)) {
659 setEventMessages(
null, array($langs->trans(
"ErrorSetACountryFirst"), $langs->trans(
"CompanyFoundation")),
'errors');
661 $typeleaves = $holidaystatic->getTypes(1, -1);
662 $arraytypeleaves = array();
663 foreach ($typeleaves as $key => $val) {
664 $labeltoshow = ($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']);
666 $arraytypeleaves[$val[
'rowid']] = $labeltoshow;
668 print $form->selectarray(
'search_type', $arraytypeleaves, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100', 1);
674if (!empty($arrayfields[
'duration'][
'checked'])) {
675 print
'<td class="liste_titre"> </td>';
679if (!empty($arrayfields[
'cp.date_debut'][
'checked'])) {
680 print
'<td class="liste_titre center nowraponall">';
681 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_start" value="'.dol_escape_htmltag($search_month_start).
'">';
682 print $formother->selectyear($search_year_start,
'search_year_start', 1, $min_year, $max_year);
687if (!empty($arrayfields[
'cp.date_fin'][
'checked'])) {
688 print
'<td class="liste_titre center nowraponall">';
689 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_end" value="'.dol_escape_htmltag($search_month_end).
'">';
690 print $formother->selectyear($search_year_end,
'search_year_end', 1, $min_year, $max_year);
695if (!empty($arrayfields[
'cp.date_valid'][
'checked'])) {
696 print
'<td class="liste_titre center nowraponall">';
701if (!empty($arrayfields[
'cp.date_approval'][
'checked'])) {
702 print
'<td class="liste_titre center nowraponall">';
707include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
710$parameters = array(
'arrayfields' => $arrayfields);
711$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
712print $hookmanager->resPrint;
715if (!empty($arrayfields[
'cp.date_create'][
'checked'])) {
716 print
'<td class="liste_titre center width200">';
717 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_create" value="'.dol_escape_htmltag($search_month_create).
'">';
718 print $formother->selectyear($search_year_create,
'search_year_create', 1, $min_year, 0);
723if (!empty($arrayfields[
'cp.tms'][
'checked'])) {
724 print
'<td class="liste_titre center width200">';
725 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_update" value="'.dol_escape_htmltag($search_month_update).
'">';
726 print $formother->selectyear($search_year_update,
'search_year_update', 1, $min_year, 0);
731if (!empty($arrayfields[
'cp.statut'][
'checked'])) {
732 print
'<td class="liste_titre center parentonrightofpage">';
733 print
$object->selectStatutCP($search_status,
'search_status',
'search_status width100 onrightofpage');
739 print
'<td class="liste_titre center maxwidthsearch">';
740 $searchpicto = $form->showFilterButtons();
747$totalarray = array();
748$totalarray[
'nbfield'] = 0;
752print
'<tr class="liste_titre">';
754 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
755 $totalarray[
'nbfield']++;
757if (!empty($arrayfields[
'cp.ref'][
'checked'])) {
758 print_liste_field_titre($arrayfields[
'cp.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.ref",
"", $param,
'', $sortfield, $sortorder);
759 $totalarray[
'nbfield']++;
761if (!empty($arrayfields[
'cp.fk_user'][
'checked'])) {
762 print_liste_field_titre($arrayfields[
'cp.fk_user'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.fk_user",
"", $param,
'', $sortfield, $sortorder);
763 $totalarray[
'nbfield']++;
765if (!empty($arrayfields[
'cp.fk_validator'][
'checked'])) {
766 print_liste_field_titre($arrayfields[
'cp.fk_validator'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.fk_validator",
"", $param,
'', $sortfield, $sortorder);
767 $totalarray[
'nbfield']++;
769if (!empty($arrayfields[
'cp.fk_type'][
'checked'])) {
770 print_liste_field_titre($arrayfields[
'cp.fk_type'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder);
771 $totalarray[
'nbfield']++;
773if (!empty($arrayfields[
'duration'][
'checked'])) {
774 print_liste_field_titre($arrayfields[
'duration'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right maxwidth100');
775 $totalarray[
'nbfield']++;
777if (!empty($arrayfields[
'cp.date_debut'][
'checked'])) {
778 print_liste_field_titre($arrayfields[
'cp.date_debut'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.date_debut",
"", $param,
'', $sortfield, $sortorder,
'center ');
779 $totalarray[
'nbfield']++;
781if (!empty($arrayfields[
'cp.date_fin'][
'checked'])) {
782 print_liste_field_titre($arrayfields[
'cp.date_fin'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.date_fin",
"", $param,
'', $sortfield, $sortorder,
'center ');
783 $totalarray[
'nbfield']++;
785if (!empty($arrayfields[
'cp.date_valid'][
'checked'])) {
786 print_liste_field_titre($arrayfields[
'cp.date_valid'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.date_valid",
"", $param,
'', $sortfield, $sortorder,
'center ');
787 $totalarray[
'nbfield']++;
789if (!empty($arrayfields[
'cp.date_approval'][
'checked'])) {
790 print_liste_field_titre($arrayfields[
'cp.date_approval'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.date_approval",
"", $param,
'', $sortfield, $sortorder,
'center ');
791 $totalarray[
'nbfield']++;
794include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
796$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
797$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
798print $hookmanager->resPrint;
799if (!empty($arrayfields[
'cp.date_create'][
'checked'])) {
800 print_liste_field_titre($arrayfields[
'cp.date_create'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.date_create",
"", $param,
'', $sortfield, $sortorder,
'center ');
801 $totalarray[
'nbfield']++;
803if (!empty($arrayfields[
'cp.tms'][
'checked'])) {
804 print_liste_field_titre($arrayfields[
'cp.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"cp.tms",
"", $param,
'', $sortfield, $sortorder,
'center ');
805 $totalarray[
'nbfield']++;
807if (!empty($arrayfields[
'cp.statut'][
'checked'])) {
808 print_liste_field_titre(
"Status", $_SERVER[
"PHP_SELF"],
"cp.statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
809 $totalarray[
'nbfield']++;
813 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
814 $totalarray[
'nbfield']++;
818$listhalfday = array(
'morning' => $langs->trans(
"Morning"),
"afternoon" => $langs->trans(
"Afternoon"));
825if (
$id && !$user->hasRight(
'holiday',
'readall') && !in_array(
$id, $childids)) {
826 $langs->load(
"errors");
827 print
'<tr class="oddeven opacitymedium"><td colspan="10">'.$langs->trans(
"NotEnoughPermissions").
'</td></tr>';
829} elseif ($num > 0 && !empty($mysoc->country_id)) {
831 $userstatic =
new User($db);
832 $approbatorstatic =
new User($db);
834 $typeleaves =
$object->getTypes(1, -1);
837 $savnbfield = $totalarray[
'nbfield'];
838 $totalarray = array();
839 $totalarray[
'nbfield'] = 0;
841 $imaxinloop = ($limit ? min($num, $limit) : $num);
842 while ($i < $imaxinloop) {
843 $obj = $db->fetch_object($resql);
849 $holidaystatic->id = $obj->rowid;
850 $holidaystatic->ref = ($obj->ref ? $obj->ref : $obj->rowid);
851 $holidaystatic->status = $obj->status;
852 $holidaystatic->date_debut = $db->jdate($obj->date_debut);
853 $holidaystatic->date_fin = $db->jdate($obj->date_fin);
856 $userstatic->id = $obj->fk_user;
857 $userstatic->lastname = $obj->user_lastname;
858 $userstatic->firstname = $obj->user_firstname;
859 $userstatic->admin = $obj->user_admin;
860 $userstatic->email = $obj->user_email;
861 $userstatic->login = $obj->user_login;
862 $userstatic->status = $obj->user_status;
863 $userstatic->photo = $obj->user_photo;
866 $approbatorstatic->id = $obj->fk_validator;
867 $approbatorstatic->lastname = $obj->validator_lastname;
868 $approbatorstatic->firstname = $obj->validator_firstname;
869 $approbatorstatic->admin = $obj->validator_admin;
870 $approbatorstatic->email = $obj->validator_email;
871 $approbatorstatic->login = $obj->validator_login;
872 $approbatorstatic->status = $obj->validator_status;
873 $approbatorstatic->photo = $obj->validator_photo;
875 $date = $obj->date_create;
876 $date_modif = $obj->date_modification;
878 $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ?
'afternoon' :
'morning';
879 $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ?
'morning' :
'afternoon';
881 $nbopenedday =
num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday);
882 $totalduration += $nbopenedday;
884 if ($mode ==
'kanban') {
886 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
887 print
'<div class="box-flex-container kanban">';
890 $holidaystatic->fk_type = empty($typeleaves[$obj->fk_type][
'rowid']) ? 0 : $typeleaves[$obj->fk_type][
'rowid'];
893 if ($massactionbutton || $massaction) {
895 if (in_array(
$object->id, $arrayofselected)) {
898 if (empty($typeleaves[$obj->fk_type])) {
899 $labeltypeleavetoshow = $langs->trans(
"TypeWasDisabledOrRemoved", $obj->fk_type);
901 $labeltypeleavetoshow = ($langs->trans($typeleaves[$obj->fk_type][
'code']) != $typeleaves[$obj->fk_type][
'code'] ? $langs->trans($typeleaves[$obj->fk_type][
'code']) : $typeleaves[$obj->fk_type][
'label']);
904 $arraydata = array(
'user' => $userstatic,
'labeltype' => $labeltypeleavetoshow,
'selected' => $selected,
'nbopenedday' => $nbopenedday);
906 print $holidaystatic->getKanbanView(
'', $arraydata);
907 if ($i == ($imaxinloop - 1)) {
914 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
917 print
'<td class="nowrap center">';
918 if ($massactionbutton || $massaction) {
920 if (in_array($obj->rowid, $arrayofselected)) {
923 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
927 $totalarray[
'nbfield']++;
930 if (!empty($arrayfields[
'cp.ref'][
'checked'])) {
931 print
'<td class="nowraponall">';
932 print $holidaystatic->getNomUrl(1, 1);
935 $totalarray[
'nbfield']++;
938 if (!empty($arrayfields[
'cp.fk_user'][
'checked'])) {
939 print
'<td class="tdoverflowmax125">'.$userstatic->getNomUrl(-1,
'leave').
'</td>';
941 $totalarray[
'nbfield']++;
944 if (!empty($arrayfields[
'cp.fk_validator'][
'checked'])) {
945 print
'<td class="tdoverflowmax125">'.$approbatorstatic->getNomUrl(-1).
'</td>';
947 $totalarray[
'nbfield']++;
950 if (!empty($arrayfields[
'cp.fk_type'][
'checked'])) {
951 if (empty($typeleaves[$obj->fk_type])) {
952 $labeltypeleavetoshow = $langs->trans(
"TypeWasDisabledOrRemoved", $obj->fk_type);
954 $labeltypeleavetoshow = ($langs->trans($typeleaves[$obj->fk_type][
'code']) != $typeleaves[$obj->fk_type][
'code'] ? $langs->trans($typeleaves[$obj->fk_type][
'code']) : $typeleaves[$obj->fk_type][
'label']);
957 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($labeltypeleavetoshow).
'">';
958 print $labeltypeleavetoshow;
961 $totalarray[
'nbfield']++;
964 if (!empty($arrayfields[
'duration'][
'checked'])) {
965 print
'<td class="right">';
970 $totalarray[
'nbfield']++;
973 if (!empty($arrayfields[
'cp.date_debut'][
'checked'])) {
974 print
'<td class="center">';
976 print
' <span class="opacitymedium nowraponall">('.$langs->trans($listhalfday[$starthalfday]).
')</span>';
979 $totalarray[
'nbfield']++;
982 if (!empty($arrayfields[
'cp.date_fin'][
'checked'])) {
983 print
'<td class="center">';
985 print
' <span class="opacitymedium nowraponall">('.$langs->trans($listhalfday[$endhalfday]).
')</span>';
988 $totalarray[
'nbfield']++;
992 if (!empty($arrayfields[
'cp.date_valid'][
'checked'])) {
993 print
'<td class="center" title="'.dol_print_date($db->jdate($obj->date_valid),
'dayhour').
'">';
997 $totalarray[
'nbfield']++;
1001 if (!empty($arrayfields[
'cp.date_approval'][
'checked'])) {
1002 print
'<td class="center" title="'.dol_print_date($db->jdate($obj->date_approval),
'dayhour').
'">';
1006 $totalarray[
'nbfield']++;
1011 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1013 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1014 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
1015 print $hookmanager->resPrint;
1018 if (!empty($arrayfields[
'cp.date_create'][
'checked'])) {
1019 print
'<td style="text-align: center;">'.dol_print_date($date,
'dayhour').
'</td>';
1021 $totalarray[
'nbfield']++;
1024 if (!empty($arrayfields[
'cp.tms'][
'checked'])) {
1025 print
'<td style="text-align: center;">'.dol_print_date($date_modif,
'dayhour').
'</td>';
1027 $totalarray[
'nbfield']++;
1031 if (!empty($arrayfields[
'cp.statut'][
'checked'])) {
1032 print
'<td class="center nowrap">'.$holidaystatic->getLibStatut(5).
'</td>';
1034 $totalarray[
'nbfield']++;
1040 print
'<td class="nowrap center">';
1041 if ($massactionbutton || $massaction) {
1043 if (in_array($obj->rowid, $arrayofselected)) {
1046 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1050 $totalarray[
'nbfield']++;
1060 if ($mode !=
'kanban' && !empty($arrayfields[
'duration'][
'checked'])) {
1061 print
'<tr class="total">';
1065 foreach ($arrayfields as $key => $val) {
1066 if (!empty($val[
'checked'])) {
1067 if ($key ==
'duration') {
1068 print
'<td class="right">'.$totalduration.
' '.$langs->trans(
'DurationDays').
'</td>';
1085 foreach ($arrayfields as $key => $val) {
1086 if (!empty($val[
'checked'])) {
1090 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1095$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1096$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1097print $hookmanager->resPrint;
1099print
'</table>'.
"\n";
1102print
'</form>'.
"\n";
1127 $typeleaves = $holiday->getTypes(1, 1);
1128 foreach ($typeleaves as $key => $val) {
1129 $nb_type = $holiday->getCPforUser($user_id, $val[
'rowid']);
1130 $nb_holiday += $nb_type;
1131 $out .=
' - '.$val[
'label'].
': <strong>'.($nb_type ?
price2num($nb_type) : 0).
'</strong><br>';
1133 $out = $langs->trans(
'SoldeCPUser', 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.
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)
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.
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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.