31 require
'../main.inc.php';
32 require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/lib/holiday.lib.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
40 $langs->loadLangs(array(
'other',
'holiday',
'companies'));
44 $action =
GETPOST(
'action',
'aZ09');
45 $confirm =
GETPOST(
'confirm',
'alpha');
48 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
49 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
50 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
52 if (empty($page) || $page == -1) {
55 $offset = $limit * $page;
56 $pageprev = $page - 1;
57 $pagenext = $page + 1;
62 $sortfield =
"position_name";
66 $childids = $user->getAllChildIds(1);
69 if (!empty($conf->global->HOLIDAY_HIDE_FOR_NON_SALARIES)) {
70 $morefilter =
'AND employee = 1';
78 $extrafields->fetch_name_optionals_label($object->table_element);
80 if (($id > 0) || $ref) {
81 $object->fetch($id, $ref);
85 if (!empty($user->rights->holiday->readall)) {
88 if (!empty($user->rights->holiday->read) && in_array($object->fk_user, $childids)) {
97 $upload_dir = $conf->holiday->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object,
'');
98 $modulepart =
'holiday';
102 $socid = $user->socid;
104 $result =
restrictedArea($user,
'holiday', $object->id,
'holiday');
106 $permissiontoadd = $user->rights->holiday->write;
113 include DOL_DOCUMENT_ROOT.
'/core/actions_linkedfiles.inc.php';
122 $listhalfday = array(
'morning'=>$langs->trans(
"Morning"),
"afternoon"=>$langs->trans(
"Afternoon"));
123 $title = $langs->trans(
"Leave").
' - '.$langs->trans(
"Files");
128 $valideur =
new User($db);
129 $valideur->fetch($object->fk_validator);
131 $userRequest =
new User($db);
132 $userRequest->fetch($object->fk_user);
136 print
dol_get_fiche_head($head,
'documents', $langs->trans(
"CPTitreMenu"), -1,
'holiday');
140 $filearray =
dol_dir_list($upload_dir,
"files", 0,
'',
'(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) ==
'desc' ?SORT_DESC:SORT_ASC), 1);
142 foreach ($filearray as $key => $file) {
143 $totalsize += $file[
'size'];
147 $linkback =
'<a href="'.DOL_URL_ROOT.
'/holiday/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
152 print
'<div class="fichecenter">';
154 print
'<div class="underbanner clearboth"></div>';
156 print
'<table class="border tableforfield centpercent">';
159 print
'<td class="titlefield">'.$langs->trans(
"User").
'</td>';
161 print $userRequest->getNomUrl(-1,
'leave');
166 print
'<td>'.$langs->trans(
"Type").
'</td>';
168 $typeleaves = $object->getTypes(1, -1);
169 $labeltoshow = (($typeleaves[$object->fk_type][
'code'] && $langs->trans($typeleaves[$object->fk_type][
'code']) != $typeleaves[$object->fk_type][
'code']) ? $langs->trans($typeleaves[$object->fk_type][
'code']) : $typeleaves[$object->fk_type][
'label']);
170 print empty($labeltoshow) ? $langs->trans(
"TypeWasDisabledOrRemoved", $object->fk_type) : $labeltoshow;
174 $starthalfday = ($object->halfday == -1 || $object->halfday == 2) ?
'afternoon' :
'morning';
175 $endhalfday = ($object->halfday == 1 || $object->halfday == 2) ?
'morning' :
'afternoon';
179 print
$form->textwithpicto($langs->trans(
'DateDebCP'), $langs->trans(
"FirstDayOfHoliday"));
181 print
'<td>'.dol_print_date($object->date_debut,
'day');
182 print
' ';
183 print
'<span class="opacitymedium">'.$langs->trans($listhalfday[$starthalfday]).
'</span>';
189 print
$form->textwithpicto($langs->trans(
'DateFinCP'), $langs->trans(
"LastDayOfHoliday"));
191 print
'<td>'.dol_print_date($object->date_fin,
'day');
192 print
' ';
193 print
'<span class="opacitymedium">'.$langs->trans($listhalfday[$endhalfday]).
'</span>';
200 $htmlhelp = $langs->trans(
'NbUseDaysCPHelp');
201 $includesaturday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY : 1);
202 $includesunday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY : 1);
203 if ($includesaturday) {
204 $htmlhelp .=
'<br>'.$langs->trans(
"DayIsANonWorkingDay", $langs->trans(
"Saturday"));
206 if ($includesunday) {
207 $htmlhelp .=
'<br>'.$langs->trans(
"DayIsANonWorkingDay", $langs->trans(
"Sunday"));
209 print
$form->textwithpicto($langs->trans(
'NbUseDaysCP'), $htmlhelp);
211 print
'<td>'.num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday).
'</td>';
214 if ($object->statut == 5) {
216 print
'<td>'.$langs->trans(
'DetailRefusCP').
'</td>';
217 print
'<td>'.$object->detail_refuse.
'</td>';
223 print
'<td>'.$langs->trans(
'DescCP').
'</td>';
224 print
'<td>'.nl2br($object->description).
'</td>';
227 print
'<tr><td>'.$langs->trans(
"NbOfAttachedFiles").
'</td><td colspan="3">'.count($filearray).
'</td></tr>';
228 print
'<tr><td>'.$langs->trans(
"TotalSizeOfAttachedFiles").
'</td><td colspan="3">'.
dol_print_size($totalsize, 1, 1).
'</td></tr>';
231 print
'</table>'.
"\n";
284 print
'<div class="clearboth"></div>';
288 $permissiontoadd = $user->rights->holiday->write;
289 $permtoedit = $user->rights->holiday->write;
290 $param =
'&id='.$object->id;
294 include DOL_DOCUMENT_ROOT.
'/core/tpl/document_actions_post_headers.tpl.php';
296 print $langs->trans(
"ErrorUnknown");