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 if ($user->socid) $socid = $user->socid;
52 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
53 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
54 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
56 if (empty($page) || $page == -1) { $page = 0; }
57 $offset = $limit * $page;
58 $pageprev = $page - 1;
59 $pagenext = $page + 1;
60 if (!$sortorder) $sortorder =
"ASC";
61 if (!$sortfield) $sortfield =
"position_name";
65 $object->fetch($id, $ref);
67 $upload_dir = $conf->holiday->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object,
'');
68 $modulepart =
'holiday';
75 include_once DOL_DOCUMENT_ROOT.
'/core/actions_linkedfiles.inc.php';
82 $form =
new Form($db);
84 $listhalfday = array(
'morning'=>$langs->trans(
"Morning"),
"afternoon"=>$langs->trans(
"Afternoon"));
86 llxHeader(
"",
"", $langs->trans(
"InterventionCard"));
91 $valideur =
new User($db);
92 $valideur->fetch($object->fk_validator);
94 $userRequest =
new User($db);
95 $userRequest->fetch($object->fk_user);
103 $filearray =
dol_dir_list($upload_dir,
"files", 0,
'',
'(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) ==
'desc' ?SORT_DESC:SORT_ASC), 1);
105 foreach ($filearray as $key => $file)
107 $totalsize += $file[
'size'];
111 $linkback =
'<a href="'.DOL_URL_ROOT.
'/holiday/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
116 print '<div class="fichecenter">';
118 print '<div class="underbanner clearboth"></div>';
120 print '<table class="border tableforfield centpercent">';
123 print '<td class="titlefield">'.$langs->trans(
"User").
'</td>';
125 print $userRequest->getNomUrl(-1,
'leave');
130 print '<td>'.$langs->trans(
"Type").
'</td>';
132 $typeleaves = $object->getTypes(1, -1);
133 $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']);
134 print empty($labeltoshow) ? $langs->trans(
"TypeWasDisabledOrRemoved", $object->fk_type) : $labeltoshow;
138 $starthalfday = ($object->halfday == -1 || $object->halfday == 2) ?
'afternoon' :
'morning';
139 $endhalfday = ($object->halfday == 1 || $object->halfday == 2) ?
'morning' :
'afternoon';
145 print $form->textwithpicto($langs->trans(
'DateDebCP'), $langs->trans(
"FirstDayOfHoliday"));
147 print '<td>'.dol_print_date($object->date_debut,
'day');
148 print ' ';
149 print '<span class="opacitymedium">'.$langs->trans($listhalfday[$starthalfday]).
'</span>';
155 print $form->textwithpicto($langs->trans(
'DateDebCP'), $langs->trans(
"FirstDayOfHoliday"));
158 print $form->selectDate($object->date_debut,
'date_debut_');
159 print ' ';
160 print $form->selectarray(
'starthalfday', $listhalfday, (
GETPOST(
'starthalfday') ?
GETPOST(
'starthalfday') : $starthalfday));
169 print $form->textwithpicto($langs->trans(
'DateFinCP'), $langs->trans(
"LastDayOfHoliday"));
171 print '<td>'.dol_print_date($object->date_fin,
'day');
172 print ' ';
173 print '<span class="opacitymedium">'.$langs->trans($listhalfday[$endhalfday]).
'</span>';
179 print $form->textwithpicto($langs->trans(
'DateFinCP'), $langs->trans(
"LastDayOfHoliday"));
182 print $form->selectDate($object->date_fin,
'date_fin_');
183 print ' ';
184 print $form->selectarray(
'endhalfday', $listhalfday, (
GETPOST(
'endhalfday') ?
GETPOST(
'endhalfday') : $endhalfday));
192 $htmlhelp = $langs->trans(
'NbUseDaysCPHelp');
193 $includesaturday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY : 1);
194 $includesunday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY : 1);
195 if ($includesaturday) $htmlhelp .=
'<br>'.$langs->trans(
"DayIsANonWorkingDay", $langs->trans(
"Saturday"));
196 if ($includesunday) $htmlhelp .=
'<br>'.$langs->trans(
"DayIsANonWorkingDay", $langs->trans(
"Sunday"));
197 print $form->textwithpicto($langs->trans(
'NbUseDaysCP'), $htmlhelp);
199 print '<td>'.num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday).
'</td>';
202 if ($object->statut == 5)
205 print '<td>'.$langs->trans(
'DetailRefusCP').
'</td>';
206 print '<td>'.$object->detail_refuse.
'</td>';
214 print '<td>'.$langs->trans(
'DescCP').
'</td>';
215 print '<td>'.nl2br($object->description).
'</td>';
219 print '<td>'.$langs->trans(
'DescCP').
'</td>';
220 print '<td><textarea name="description" class="flat" rows="'.ROWS_3.
'" cols="70">'.$object->description.
'</textarea></td>';
224 print '<tr><td>'.$langs->trans(
"NbOfAttachedFiles").
'</td><td colspan="3">'.count($filearray).
'</td></tr>';
225 print '<tr><td>'.$langs->trans(
"TotalSizeOfAttachedFiles").
'</td><td colspan="3">'.
dol_print_size($totalsize, 1, 1).
'</td></tr>';
228 print '</table>'.
"\n";
293 print '<div class="clearboth"></div>';
299 $modulepart =
'holiday';
300 $permission = $user->rights->holiday->write;
301 $permtoedit = $user->rights->holiday->write;
302 $param =
'&id='.$object->id;
303 include_once DOL_DOCUMENT_ROOT.
'/core/tpl/document_actions_post_headers.tpl.php';
305 print $langs->trans(
"ErrorUnknown");
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.
holiday_prepare_head($object)
Return array head with list of tabs to view object informations.
Class to manage Dolibarr users.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart= '')
Return a path to have a the directory according to object where files are stored. ...
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.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0)
Scan a directory and return a list of files/directories.
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_size($size, $shortvalue=0, $shortunit=0)
Return string with formated size.
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.