33require
'../main.inc.php';
42require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/lib/holiday.lib.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
51$langs->loadLangs(array(
'other',
'holiday',
'companies'));
55$action =
GETPOST(
'action',
'aZ09');
56$confirm =
GETPOST(
'confirm',
'alpha');
60$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
61$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
63if (empty($page) || $page == -1) {
66$offset = $limit * $page;
73 $sortfield =
"position_name";
77$childids = $user->getAllChildIds(1);
81 $morefilter =
'AND employee = 1';
87$extrafields->fetch_name_optionals_label(
$object->table_element);
89$permissiontoapprove = $user->hasRight(
'holiday',
'approve');
91if (($id > 0) || $ref) {
96 if ($user->hasRight(
'holiday',
'readall')) {
99 if ($user->hasRight(
'holiday',
'read') && in_array(
$object->fk_user, $childids)) {
102 if ($permissiontoapprove &&
$object->fk_validator == $user->id && !
getDolGlobalString(
'HOLIDAY_CAN_APPROVE_ONLY_THE_SUBORDINATES')) {
112$modulepart =
'holiday';
116 $socid = $user->socid;
120$permissiontoadd = $user->hasRight(
'holiday',
'write');
127include DOL_DOCUMENT_ROOT.
'/core/actions_linkedfiles.inc.php';
136$listhalfday = array(
'morning'=>$langs->trans(
"Morning"),
"afternoon"=>$langs->trans(
"Afternoon"));
137$title = $langs->trans(
"Leave").
' - '.$langs->trans(
"Files");
138$help_url =
'EN:Module_Holiday';
140llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-holiday page-card_documents');
144 $valideur->fetch(
$object->fk_validator);
147 $userRequest->fetch(
$object->fk_user);
151 print
dol_get_fiche_head($head,
'documents', $langs->trans(
"CPTitreMenu"), -1,
'holiday');
155 $filearray =
dol_dir_list($upload_dir,
"files", 0,
'',
'(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) ==
'desc' ? SORT_DESC : SORT_ASC), 1);
157 foreach ($filearray as $key => $file) {
158 $totalsize += $file[
'size'];
162 $linkback =
'<a href="'.DOL_URL_ROOT.
'/holiday/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
164 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref');
167 print
'<div class="fichecenter">';
169 print
'<div class="underbanner clearboth"></div>';
171 print
'<table class="border tableforfield centpercent">';
174 print
'<td class="titlefield">'.$langs->trans(
"User").
'</td>';
176 print $userRequest->getNomUrl(-1,
'leave');
181 print
'<td>'.$langs->trans(
"Type").
'</td>';
183 $typeleaves =
$object->getTypes(1, -1);
184 if (empty($typeleaves[
$object->fk_type])) {
185 $labeltoshow = $langs->trans(
"TypeWasDisabledOrRemoved",
$object->fk_type);
187 $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']);
193 $starthalfday = (
$object->halfday == -1 ||
$object->halfday == 2) ?
'afternoon' :
'morning';
194 $endhalfday = (
$object->halfday == 1 ||
$object->halfday == 2) ?
'morning' :
'afternoon';
198 print $form->textwithpicto($langs->trans(
'DateDebCP'), $langs->trans(
"FirstDayOfHoliday"));
200 print
'<td>'.dol_print_date(
$object->date_debut,
'day');
201 print
' ';
202 print
'<span class="opacitymedium">'.$langs->trans($listhalfday[$starthalfday]).
'</span>';
208 print $form->textwithpicto($langs->trans(
'DateFinCP'), $langs->trans(
"LastDayOfHoliday"));
210 print
'<td>'.dol_print_date(
$object->date_fin,
'day');
211 print
' ';
212 print
'<span class="opacitymedium">'.$langs->trans($listhalfday[$endhalfday]).
'</span>';
219 $htmlhelp = $langs->trans(
'NbUseDaysCPHelp');
220 $includesaturday =
getDolGlobalInt(
'MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY', 1);
221 $includesunday =
getDolGlobalInt(
'MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY', 1);
222 if ($includesaturday) {
223 $htmlhelp .=
'<br>'.$langs->trans(
"DayIsANonWorkingDay", $langs->trans(
"Saturday"));
225 if ($includesunday) {
226 $htmlhelp .=
'<br>'.$langs->trans(
"DayIsANonWorkingDay", $langs->trans(
"Sunday"));
228 print $form->textwithpicto($langs->trans(
'NbUseDaysCP'), $htmlhelp);
230 print
'<td>'.num_open_day(
$object->date_debut_gmt,
$object->date_fin_gmt, 0, 1,
$object->halfday, $userRequest->country_id,
$object->fk_user).
'</td>';
235 print
'<td>'.$langs->trans(
'DetailRefusCP').
'</td>';
236 print
'<td>'.$object->detail_refuse.
'</td>';
242 print
'<td>'.$langs->trans(
'DescCP').
'</td>';
243 print
'<td>'.nl2br(
$object->description).
'</td>';
246 print
'<tr><td>'.$langs->trans(
"NbOfAttachedFiles").
'</td><td colspan="3">'.count($filearray).
'</td></tr>';
247 print
'<tr><td>'.$langs->trans(
"TotalSizeOfAttachedFiles").
'</td><td colspan="3">'.
dol_print_size($totalsize, 1, 1).
'</td></tr>';
250 print
'</table>'.
"\n";
303 print
'<div class="clearboth"></div>';
307 $permissiontoadd = $user->hasRight(
'holiday',
'write');
308 $permtoedit = $user->hasRight(
'holiday',
'write');
309 $param =
'&id='.$object->id;
310 $relativepathwithnofile =
get_exdir(0, 0, 0, 1, $object,
'').
'/';
313 include DOL_DOCUMENT_ROOT.
'/core/tpl/document_actions_post_headers.tpl.php';
315 print $langs->trans(
"ErrorUnknown");
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
const STATUS_REFUSED
Refused.
Class to manage Dolibarr users.
dol_dir_list($utf8_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 formatted size.
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, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
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 information.
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.