32require
'../main.inc.php';
33require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/holiday.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
41$langs->loadLangs(array(
'other',
'holiday',
'companies'));
45$action =
GETPOST(
'action',
'aZ09');
46$confirm =
GETPOST(
'confirm',
'alpha');
49$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
50$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
51$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
52$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
53if (empty($page) || $page == -1) {
56$offset = $limit * $page;
63 $sortfield =
"position_name";
67$childids = $user->getAllChildIds(1);
70if (!empty($conf->global->HOLIDAY_HIDE_FOR_NON_SALARIES)) {
71 $morefilter =
'AND employee = 1';
79$extrafields->fetch_name_optionals_label($object->table_element);
81if (($id > 0) || $ref) {
82 $object->fetch($id, $ref);
86 if (!empty($user->rights->holiday->readall)) {
89 if (!empty($user->rights->holiday->read) && in_array($object->fk_user, $childids)) {
98$upload_dir = $conf->holiday->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object,
'');
99$modulepart =
'holiday';
103 $socid = $user->socid;
105$result =
restrictedArea($user,
'holiday', $object->id,
'holiday');
107$permissiontoadd = $user->rights->holiday->write;
114include DOL_DOCUMENT_ROOT.
'/core/actions_linkedfiles.inc.php';
121$form =
new Form($db);
123$listhalfday = array(
'morning'=>$langs->trans(
"Morning"),
"afternoon"=>$langs->trans(
"Afternoon"));
124$title = $langs->trans(
"Leave").
' - '.$langs->trans(
"Files");
129 $valideur =
new User($db);
130 $valideur->fetch($object->fk_validator);
132 $userRequest =
new User($db);
133 $userRequest->fetch($object->fk_user);
137 print
dol_get_fiche_head($head,
'documents', $langs->trans(
"CPTitreMenu"), -1,
'holiday');
141 $filearray =
dol_dir_list($upload_dir,
"files", 0,
'',
'(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) ==
'desc' ?SORT_DESC:SORT_ASC), 1);
143 foreach ($filearray as $key => $file) {
144 $totalsize += $file[
'size'];
148 $linkback =
'<a href="'.DOL_URL_ROOT.
'/holiday/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
153 print
'<div class="fichecenter">';
155 print
'<div class="underbanner clearboth"></div>';
157 print
'<table class="border tableforfield centpercent">';
160 print
'<td class="titlefield">'.$langs->trans(
"User").
'</td>';
162 print $userRequest->getNomUrl(-1,
'leave');
167 print
'<td>'.$langs->trans(
"Type").
'</td>';
169 $typeleaves = $object->getTypes(1, -1);
170 $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']);
171 print empty($labeltoshow) ? $langs->trans(
"TypeWasDisabledOrRemoved", $object->fk_type) : $labeltoshow;
175 $starthalfday = ($object->halfday == -1 || $object->halfday == 2) ?
'afternoon' :
'morning';
176 $endhalfday = ($object->halfday == 1 || $object->halfday == 2) ?
'morning' :
'afternoon';
180 print $form->textwithpicto($langs->trans(
'DateDebCP'), $langs->trans(
"FirstDayOfHoliday"));
182 print
'<td>'.dol_print_date($object->date_debut,
'day');
183 print
' ';
184 print
'<span class="opacitymedium">'.$langs->trans($listhalfday[$starthalfday]).
'</span>';
190 print $form->textwithpicto($langs->trans(
'DateFinCP'), $langs->trans(
"LastDayOfHoliday"));
192 print
'<td>'.dol_print_date($object->date_fin,
'day');
193 print
' ';
194 print
'<span class="opacitymedium">'.$langs->trans($listhalfday[$endhalfday]).
'</span>';
201 $htmlhelp = $langs->trans(
'NbUseDaysCPHelp');
202 $includesaturday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY : 1);
203 $includesunday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY : 1);
204 if ($includesaturday) {
205 $htmlhelp .=
'<br>'.$langs->trans(
"DayIsANonWorkingDay", $langs->trans(
"Saturday"));
207 if ($includesunday) {
208 $htmlhelp .=
'<br>'.$langs->trans(
"DayIsANonWorkingDay", $langs->trans(
"Sunday"));
210 print $form->textwithpicto($langs->trans(
'NbUseDaysCP'), $htmlhelp);
212 print
'<td>'.num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday).
'</td>';
215 if ($object->statut == 5) {
217 print
'<td>'.$langs->trans(
'DetailRefusCP').
'</td>';
218 print
'<td>'.$object->detail_refuse.
'</td>';
224 print
'<td>'.$langs->trans(
'DescCP').
'</td>';
225 print
'<td>'.nl2br($object->description).
'</td>';
228 print
'<tr><td>'.$langs->trans(
"NbOfAttachedFiles").
'</td><td colspan="3">'.count($filearray).
'</td></tr>';
229 print
'<tr><td>'.$langs->trans(
"TotalSizeOfAttachedFiles").
'</td><td colspan="3">'.
dol_print_size($totalsize, 1, 1).
'</td></tr>';
232 print
'</table>'.
"\n";
285 print
'<div class="clearboth"></div>';
289 $permissiontoadd = $user->rights->holiday->write;
290 $permtoedit = $user->rights->holiday->write;
291 $param =
'&id='.$object->id;
295 include DOL_DOCUMENT_ROOT.
'/core/tpl/document_actions_post_headers.tpl.php';
297 print $langs->trans(
"ErrorUnknown");
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class of the module paid holiday.
Class to manage Dolibarr users.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
dol_print_size($size, $shortvalue=0, $shortunit=0)
Return string with formated size.
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.
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
holiday_prepare_head($object)
Return array head with list of tabs to view object informations.
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.