28 require
'../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
40 $langs->loadLangs(array(
'users',
'other',
'holiday',
'hrm'));
45 $action =
GETPOST(
'action',
'aZ09');
46 $massaction =
GETPOST(
'massaction',
'alpha');
47 $show_files =
GETPOST(
'show_files',
'int');
48 $confirm =
GETPOST(
'confirm',
'alpha');
49 $cancel =
GETPOST(
'cancel',
'alpha');
50 $toselect =
GETPOST(
'toselect',
'array');
51 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'holidaylist';
53 $backtopage =
GETPOST(
'backtopage',
'alpha');
54 $optioncss =
GETPOST(
'optioncss',
'aZ');
58 $childids = $user->getAllChildIds(1);
72 if ($id == $user->id) $canread = 1;
73 if (!empty($user->rights->holiday->readall)) $canread = 1;
74 if (!empty($user->rights->holiday->read) && in_array($id, $childids)) $canread = 1;
81 $diroutputmassaction = $conf->holiday->dir_output.
'/temp/massgeneration/'.$user->id;
85 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
86 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
87 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
89 if (empty($page) || $page == -1) { $page = 0; }
90 $offset = $limit * $page;
91 $pageprev = $page - 1;
92 $pagenext = $page + 1;
93 if (!$sortorder) $sortorder =
"DESC";
94 if (!$sortfield) $sortfield =
"cp.rowid";
96 $sall = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'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',
'int');
108 $search_valideur =
GETPOST(
'search_valideur',
'int');
109 $search_status =
GETPOST(
'search_statut',
'int');
110 $search_type =
GETPOST(
'search_type',
'int');
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',
131 $arrayfields = array(
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_approve'=>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),
146 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
148 if (empty($conf->holiday->enabled))
150 llxHeader(
'', $langs->trans(
'CPTitreMenu'));
151 print '<div class="tabBar">';
152 print
'<span style="color: #FF0000;">'.$langs->trans(
'NotActiveModCP').
'</span>';
163 if (
GETPOST(
'cancel',
'alpha')) { $action =
'list'; $massaction =
''; }
164 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') { $massaction =
''; }
166 $parameters = array(
'socid'=>$socid);
167 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
168 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
173 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
176 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha'))
179 $search_month_create =
"";
180 $search_year_create =
"";
181 $search_month_start =
"";
182 $search_year_start =
"";
183 $search_month_end =
"";
184 $search_year_end =
"";
185 $search_employee =
"";
186 $search_valideur =
"";
190 $search_array_options = array();
192 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
193 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha'))
199 $objectclass =
'Holiday';
200 $objectlabel =
'Holiday';
201 $permissiontoread = $user->rights->holiday->read;
202 $permissiontodelete = $user->rights->holiday->delete;
203 $uploaddir = $conf->holiday->dir_output;
204 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
214 $form =
new Form($db);
218 $fuser =
new User($db);
219 $holidaystatic =
new Holiday($db);
222 $result = $object->updateBalance();
224 $title = $langs->trans(
'CPTitreMenu');
231 $user_id = $user->id;
236 $fuser->fetch($id,
'',
'', 1);
238 $user_id = $fuser->id;
240 $search_employee = $user_id;
247 $sql .=
" cp.rowid,";
250 $sql .=
" cp.fk_user,";
251 $sql .=
" cp.fk_type,";
252 $sql .=
" cp.date_create,";
253 $sql .=
" cp.tms as date_update,";
254 $sql .=
" cp.description,";
255 $sql .=
" cp.date_debut,";
256 $sql .=
" cp.date_fin,";
257 $sql .=
" cp.halfday,";
258 $sql .=
" cp.statut as status,";
259 $sql .=
" cp.fk_validator,";
260 $sql .=
" cp.date_valid,";
261 $sql .=
" cp.fk_user_valid,";
262 $sql .=
" cp.date_refuse,";
263 $sql .=
" cp.fk_user_refuse,";
264 $sql .=
" cp.date_cancel,";
265 $sql .=
" cp.fk_user_cancel,";
266 $sql .=
" cp.detail_refuse,";
268 $sql .=
" uu.lastname as user_lastname,";
269 $sql .=
" uu.firstname as user_firstname,";
270 $sql .=
" uu.admin as user_admin,";
271 $sql .=
" uu.email as user_email,";
272 $sql .=
" uu.login as user_login,";
273 $sql .=
" uu.statut as user_status,";
274 $sql .=
" uu.photo as user_photo,";
276 $sql .=
" ua.lastname as validator_lastname,";
277 $sql .=
" ua.firstname as validator_firstname,";
278 $sql .=
" ua.admin as validator_admin,";
279 $sql .=
" ua.email as validator_email,";
280 $sql .=
" ua.login as validator_login,";
281 $sql .=
" ua.statut as validator_status,";
282 $sql .=
" ua.photo as validator_photo";
284 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
285 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
' as options_'.$key :
'');
288 $parameters = array();
289 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
290 $sql .= $hookmanager->resPrint;
291 $sql .=
" FROM ".MAIN_DB_PREFIX.
"holiday as cp";
292 if (is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (cp.rowid = ef.fk_object)";
293 $sql .=
", ".MAIN_DB_PREFIX.
"user as uu, ".MAIN_DB_PREFIX.
"user as ua";
294 $sql .=
" WHERE cp.entity IN (".getEntity(
'holiday').
")";
295 $sql .=
" AND cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid ";
297 if (!empty($sall)) $sql .=
natural_search(array_keys($fieldstosearchall), $sall);
299 if (!empty($search_ref)) $sql .=
natural_search(
"cp.ref", $search_ref);
301 $sql .=
dolSqlDateFilter(
"cp.date_debut", $search_day_start, $search_month_start, $search_year_start);
303 $sql .=
dolSqlDateFilter(
"cp.date_fin", $search_day_end, $search_month_end, $search_year_end);
305 $sql .=
dolSqlDateFilter(
"cp.date_create", $search_day_create, $search_month_create, $search_year_create);
307 if (!empty($search_employee) && $search_employee != -1) {
308 $sql .=
" AND cp.fk_user = '".$db->escape($search_employee).
"'\n";
311 if (!empty($search_valideur) && $search_valideur != -1) {
312 $sql .=
" AND cp.fk_validator = '".$db->escape($search_valideur).
"'\n";
315 if (!empty($search_type) && $search_type != -1) {
316 $sql .=
' AND cp.fk_type IN ('.$db->sanitize($db->escape($search_type)).
')';
319 if (!empty($search_status) && $search_status != -1) {
320 $sql .=
" AND cp.statut = '".$db->escape($search_status).
"'\n";
323 if (empty($user->rights->holiday->readall)) $sql .=
' AND cp.fk_user IN ('.join(
',', $childids).
')';
324 if ($id > 0) $sql .=
" AND cp.fk_user IN (".$id.
")";
327 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
329 $parameters = array();
330 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
331 $sql .= $hookmanager->resPrint;
333 $sql .= $db->order($sortfield, $sortorder);
336 $nbtotalofrecords =
'';
337 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
339 $result = $db->query($sql);
340 $nbtotalofrecords = $db->num_rows($result);
341 if (($page * $limit) > $nbtotalofrecords)
348 $sql .= $db->plimit($limit + 1, $offset);
352 $resql = $db->query($sql);
355 $num = $db->num_rows(
$resql);
357 $arrayofselected = is_array($toselect) ? $toselect : array();
360 if (!empty($contextpage) && $contextpage !=
$_SERVER[
"PHP_SELF"]) $param .=
'&contextpage='.urlencode($contextpage);
361 if ($limit > 0 && $limit != $conf->liste_limit) $param .=
'&limit='.urlencode($limit);
362 if ($optioncss !=
'') $param .=
'&optioncss='.urlencode($optioncss);
363 if ($search_ref) $param .=
'&search_ref='.urlencode($search_ref);
364 if ($search_day_create) $param .=
'&search_day_create='.urlencode($search_day_create);
365 if ($search_month_create) $param .=
'&search_month_create='.urlencode($search_month_create);
366 if ($search_year_create) $param .=
'&search_year_create='.urlencode($search_year_create);
367 if ($search_day_start) $param .=
'&search_day_start='.urlencode($search_day_start);
368 if ($search_month_start) $param .=
'&search_month_start='.urlencode($search_month_start);
369 if ($search_year_start) $param .=
'&search_year_start='.urlencode($search_year_start);
370 if ($search_day_end) $param .=
'&search_day_end='.urlencode($search_day_end);
371 if ($search_month_end) $param .=
'&search_month_end='.urlencode($search_month_end);
372 if ($search_year_end) $param .=
'&search_year_end='.urlencode($search_year_end);
373 if ($search_employee > 0) $param .=
'&search_employee='.urlencode($search_employee);
374 if ($search_valideur > 0) $param .=
'&search_valideur='.urlencode($search_valideur);
375 if ($search_type > 0) $param .=
'&search_type='.urlencode($search_type);
376 if ($search_status > 0) $param .=
'&search_status='.urlencode($search_status);
378 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
381 $arrayofmassactions = array(
386 if ($user->rights->holiday->supprimer) $arrayofmassactions[
'predelete'] =
'<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans(
"Delete");
387 if (in_array($massaction, array(
'presend',
'predelete'))) $arrayofmassactions = array();
388 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
391 print
'<form id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">'.
"\n";
392 if ($optioncss !=
'') print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
393 print
'<input type="hidden" name="token" value="'.newToken().
'">';
394 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
395 print
'<input type="hidden" name="action" value="'.($action ==
'edit' ?
'update' :
'list').
'">';
396 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
397 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
398 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
399 if ($id > 0) print
'<input type="hidden" name="id" value="'.$id.
'">';
403 $title = $langs->trans(
"User");
404 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
409 dol_banner_tab($fuser,
'id', $linkback, $user->rights->user->user->lire || $user->admin);
411 if (empty($conf->global->HOLIDAY_HIDE_BALANCE))
413 print
'<div class="underbanner clearboth"></div>';
424 print
'<div class="tabsAction">';
426 $canedit = (($user->id == $user_id && $user->rights->holiday->write) || ($user->id != $user_id && (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->holiday->writeall_advance))));
430 print
'<a href="'.DOL_URL_ROOT.
'/holiday/card.php?action=create&fuserid='.$user_id.
'" class="butAction">'.$langs->trans(
"AddCP").
'</a>';
435 $title = $langs->trans(
"ListeCP");
437 $newcardbutton =
dolGetButtonTitle($langs->trans(
'MenuAddCP'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/holiday/card.php?action=create',
'', $user->rights->holiday->write);
439 print_barre_liste($title, $page,
$_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'title_hrm', 0, $newcardbutton,
'', $limit, 0, 0, 1);
442 $topicmail =
"Information";
443 $modelmail =
"leaverequest";
445 $trackid =
'leav'.$object->id;
446 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
450 foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
451 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
456 $parameters = array();
457 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
458 if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
459 else $moreforfilter = $hookmanager->resPrint;
461 if (!empty($moreforfilter))
463 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
464 print $moreforfilter;
468 $varpage = empty($contextpage) ?
$_SERVER[
"PHP_SELF"] : $contextpage;
469 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
470 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
474 if (empty($user->rights->holiday->readall)) $include =
'hierarchyme';
476 print
'<div class="div-table-responsive">';
477 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
481 print
'<tr class="liste_titre_filter">';
483 if (!empty($arrayfields[
'cp.ref'][
'checked']))
485 print
'<td class="liste_titre">';
486 print
'<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
490 if (!empty($arrayfields[
'cp.fk_user'][
'checked']))
493 if (!empty($conf->global->HOLIDAY_HIDE_FOR_NON_SALARIES)) $morefilter =
'AND employee = 1';
500 $search_employee = $id;
504 print
'<td class="liste_titre maxwidthonsmartphone left">';
505 print $form->select_dolusers($search_employee,
"search_employee", 1,
"", $disabled, $include,
'', 0, 0, 0, $morefilter, 0,
'',
'maxwidth150');
510 if (!empty($arrayfields[
'cp.fk_validator'][
'checked']))
512 if ($user->rights->holiday->readall)
514 print
'<td class="liste_titre maxwidthonsmartphone left">';
516 $excludefilter = $user->admin ?
'' :
'u.rowid <> '.$user->id;
517 $valideurobjects = $validator->listUsersForGroup($excludefilter);
518 $valideurarray = array();
519 foreach ($valideurobjects as $val) $valideurarray[$val->id] = $val->id;
520 print $form->select_dolusers($search_valideur,
"search_valideur", 1,
"", 0, $valideurarray,
'', 0, 0, 0, $morefilter, 0,
'',
'maxwidth150');
523 print
'<td class="liste_titre"> </td>';
528 if (!empty($arrayfields[
'cp.fk_type'][
'checked']))
530 print
'<td class="liste_titre">';
531 if (empty($mysoc->country_id)) {
532 setEventMessages(null, array($langs->trans(
"ErrorSetACountryFirst"), $langs->trans(
"CompanyFoundation")),
'errors');
534 $typeleaves = $holidaystatic->getTypes(1, -1);
535 $arraytypeleaves = array();
536 foreach ($typeleaves as $key => $val)
538 $labeltoshow = ($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']);
540 $arraytypeleaves[$val[
'rowid']] = $labeltoshow;
542 print $form->selectarray(
'search_type', $arraytypeleaves, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'', 1);
548 if (!empty($arrayfields[
'duration'][
'checked']))
550 print
'<td class="liste_titre"> </td>';
554 if (!empty($arrayfields[
'cp.date_debut'][
'checked']))
556 print
'<td class="liste_titre center nowraponall">';
557 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_start" value="'.dol_escape_htmltag($search_month_start).
'">';
558 $formother->select_year($search_year_start,
'search_year_start', 1, $min_year, $max_year);
563 if (!empty($arrayfields[
'cp.date_fin'][
'checked']))
565 print
'<td class="liste_titre center nowraponall">';
566 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_end" value="'.dol_escape_htmltag($search_month_end).
'">';
567 $formother->select_year($search_year_end,
'search_year_end', 1, $min_year, $max_year);
572 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
574 $parameters = array(
'arrayfields'=>$arrayfields);
575 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
576 print $hookmanager->resPrint;
579 if (!empty($arrayfields[
'cp.date_create'][
'checked']))
581 print
'<td class="liste_titre center nowraponall">';
582 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_create" value="'.dol_escape_htmltag($search_month_create).
'">';
583 $formother->select_year($search_year_create,
'search_year_create', 1, $min_year, 0);
588 if (!empty($arrayfields[
'cp.tms'][
'checked']))
590 print
'<td class="liste_titre center nowraponall">';
591 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_update" value="'.dol_escape_htmltag($search_month_update).
'">';
592 $formother->select_year($search_year_update,
'search_year_update', 1, $min_year, 0);
597 if (!empty($arrayfields[
'cp.statut'][
'checked']))
599 print
'<td class="liste_titre maxwidthonsmartphone maxwidth200 right">';
600 $object->selectStatutCP($search_status,
'search_status');
605 print
'<td class="liste_titre maxwidthsearch">';
606 $searchpicto = $form->showFilterButtons();
612 print
'<tr class="liste_titre">';
613 if (!empty($arrayfields[
'cp.ref'][
'checked']))
print_liste_field_titre($arrayfields[
'cp.ref'][
'label'],
$_SERVER[
"PHP_SELF"],
"cp.ref",
"", $param,
'', $sortfield, $sortorder);
614 if (!empty($arrayfields[
'cp.fk_user'][
'checked']))
print_liste_field_titre($arrayfields[
'cp.fk_user'][
'label'],
$_SERVER[
"PHP_SELF"],
"cp.fk_user",
"", $param,
'', $sortfield, $sortorder);
615 if (!empty($arrayfields[
'cp.fk_validator'][
'checked']))
print_liste_field_titre($arrayfields[
'cp.fk_validator'][
'label'],
$_SERVER[
"PHP_SELF"],
"cp.fk_validator",
"", $param,
'', $sortfield, $sortorder);
616 if (!empty($arrayfields[
'cp.fk_type'][
'checked']))
print_liste_field_titre($arrayfields[
'cp.fk_type'][
'label'],
$_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder);
617 if (!empty($arrayfields[
'duration'][
'checked']))
print_liste_field_titre($arrayfields[
'duration'][
'label'],
$_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right maxwidth100');
618 if (!empty($arrayfields[
'cp.date_debut'][
'checked']))
print_liste_field_titre($arrayfields[
'cp.date_debut'][
'label'],
$_SERVER[
"PHP_SELF"],
"cp.date_debut",
"", $param,
'', $sortfield, $sortorder,
'center ');
619 if (!empty($arrayfields[
'cp.date_fin'][
'checked']))
print_liste_field_titre($arrayfields[
'cp.date_fin'][
'label'],
$_SERVER[
"PHP_SELF"],
"cp.date_fin",
"", $param,
'', $sortfield, $sortorder,
'center ');
621 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
623 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
624 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
625 print $hookmanager->resPrint;
626 if (!empty($arrayfields[
'cp.date_create'][
'checked']))
print_liste_field_titre($arrayfields[
'cp.date_create'][
'label'],
$_SERVER[
"PHP_SELF"],
"cp.date_create",
"", $param,
'', $sortfield, $sortorder,
'center ');
627 if (!empty($arrayfields[
'cp.tms'][
'checked']))
print_liste_field_titre($arrayfields[
'cp.tms'][
'label'],
$_SERVER[
"PHP_SELF"],
"cp.tms",
"", $param,
'', $sortfield, $sortorder,
'center ');
628 if (!empty($arrayfields[
'cp.statut'][
'checked']))
print_liste_field_titre(
"Status",
$_SERVER[
"PHP_SELF"],
"cp.statut",
"", $param,
'', $sortfield, $sortorder,
'right ');
632 $listhalfday = array(
'morning'=>$langs->trans(
"Morning"),
"afternoon"=>$langs->trans(
"Afternoon"));
636 if ($id && empty($user->rights->holiday->readall) && !in_array($id, $childids)) {
637 $langs->load(
"errors");
638 print
'<tr class="oddeven opacitymediuem"><td colspan="10">'.$langs->trans(
"NotEnoughPermissions").
'</td></tr>';
640 } elseif ($num > 0 && !empty($mysoc->country_id))
643 $userstatic =
new User($db);
644 $approbatorstatic =
new User($db);
646 $typeleaves = $object->getTypes(1, -1);
649 $totalarray = array();
650 while ($i < min($num, $limit))
652 $obj = $db->fetch_object(
$resql);
655 $holidaystatic->id = $obj->rowid;
656 $holidaystatic->ref = ($obj->ref ? $obj->ref : $obj->rowid);
657 $holidaystatic->statut = $obj->status;
660 $userstatic->id = $obj->fk_user;
661 $userstatic->lastname = $obj->user_lastname;
662 $userstatic->firstname = $obj->user_firstname;
663 $userstatic->admin = $obj->user_admin;
664 $userstatic->email = $obj->user_email;
665 $userstatic->login = $obj->user_login;
666 $userstatic->statut = $obj->user_status;
667 $userstatic->photo = $obj->user_photo;
670 $approbatorstatic->id = $obj->fk_validator;
671 $approbatorstatic->lastname = $obj->validator_lastname;
672 $approbatorstatic->firstname = $obj->validator_firstname;
673 $approbatorstatic->admin = $obj->validator_admin;
674 $approbatorstatic->email = $obj->validator_email;
675 $approbatorstatic->login = $obj->validator_login;
676 $approbatorstatic->statut = $obj->validator_status;
677 $approbatorstatic->photo = $obj->validator_photo;
679 $date = $obj->date_create;
680 $date_modif = $obj->date_update;
682 $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ?
'afternoon' :
'morning';
683 $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ?
'morning' :
'afternoon';
685 print
'<tr class="oddeven">';
687 if (!empty($arrayfields[
'cp.ref'][
'checked']))
689 print
'<td class="nowraponall">';
690 print $holidaystatic->getNomUrl(1, 1);
692 if (!$i) $totalarray[
'nbfield']++;
694 if (!empty($arrayfields[
'cp.fk_user'][
'checked']))
696 print
'<td class="tdoverflowmax150">'.$userstatic->getNomUrl(-1,
'leave').
'</td>';
697 if (!$i) $totalarray[
'nbfield']++;
699 if (!empty($arrayfields[
'cp.fk_validator'][
'checked']))
701 print
'<td class="tdoverflowmax150">'.$approbatorstatic->getNomUrl(-1).
'</td>';
702 if (!$i) $totalarray[
'nbfield']++;
704 if (!empty($arrayfields[
'cp.fk_type'][
'checked']))
707 $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']);
708 print empty($typeleaves[$obj->fk_type][
'label']) ? $langs->trans(
"TypeWasDisabledOrRemoved", $obj->fk_type) : $labeltypeleavetoshow;
710 if (!$i) $totalarray[
'nbfield']++;
712 if (!empty($arrayfields[
'duration'][
'checked']))
714 print
'<td class="right">';
715 $nbopenedday =
num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday);
716 print $nbopenedday.
' '.$langs->trans(
'DurationDays');
718 if (!$i) $totalarray[
'nbfield']++;
720 if (!empty($arrayfields[
'cp.date_debut'][
'checked']))
722 print
'<td class="center">';
724 print
' <span class="opacitymedium nowraponall">('.$langs->trans($listhalfday[$starthalfday]).
')</span>';
726 if (!$i) $totalarray[
'nbfield']++;
728 if (!empty($arrayfields[
'cp.date_fin'][
'checked']))
730 print
'<td class="center">';
732 print
' <span class="opacitymedium nowraponall">('.$langs->trans($listhalfday[$endhalfday]).
')</span>';
734 if (!$i) $totalarray[
'nbfield']++;
738 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
740 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
741 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
742 print $hookmanager->resPrint;
745 if (!empty($arrayfields[
'cp.date_create'][
'checked']))
747 print
'<td style="text-align: center;">'.dol_print_date($date,
'dayhour').
'</td>';
748 if (!$i) $totalarray[
'nbfield']++;
750 if (!empty($arrayfields[
'cp.tms'][
'checked']))
752 print
'<td style="text-align: center;">'.dol_print_date($date_modif,
'dayhour').
'</td>';
753 if (!$i) $totalarray[
'nbfield']++;
755 if (!empty($arrayfields[
'cp.statut'][
'checked']))
757 print
'<td class="right nowrap">'.$holidaystatic->getLibStatut(5).
'</td>';
758 if (!$i) $totalarray[
'nbfield']++;
762 print
'<td class="nowrap center">';
763 if ($massactionbutton || $massaction)
766 if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
767 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
770 if (!$i) $totalarray[
'nbfield']++;
782 foreach ($arrayfields as $key => $val) {
if (!empty($val[
'checked'])) $colspan++; }
783 print
'<tr><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</td></tr>';
811 global $conf, $langs;
813 $alltypeleaves = $holiday->getTypes(1, -1);
817 $typeleaves = $holiday->getTypes(1, 1);
818 foreach ($typeleaves as $key => $val)
820 $nb_type = $holiday->getCPforUser($user_id, $val[
'rowid']);
821 $nb_holiday += $nb_type;
822 $out .=
' - '.$val[
'label'].
': <strong>'.($nb_type ?
price2num($nb_type) : 0).
'</strong><br>';
824 print $langs->trans(
'SoldeCPUser', round($nb_holiday, 5)).
'<br>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class of the module paid holiday.
user_prepare_head($object)
Prepare array with list of tabs.
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.
Class to manage Dolibarr users.
Class to manage user groups.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
print_barre_liste($titre, $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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is '...
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) ...
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=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 Calling this function terminate execution ...
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...
dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $excludefirstand=0)
Generate a SQL string to make a filter into a range (for second of date until last second of date) ...
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
showMyBalance($holiday, $user_id)
Show balance of user.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_banner_tab($object, $paramid, $morehtml= '', $shownav=1, $fieldid= 'rowid', $fieldref= 'ref', $morehtmlref= '', $moreparam= '', $nodbprefix=0, $morehtmlleft= '', $morehtmlstatus= '', $onlybanner=0, $morehtmlright= '')
Show tab footer of a card.