28 require
'../main.inc.php';
31 if (empty($user->rights->holiday->define_holiday) || $user->socid > 0) {
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
40 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
41 $massaction =
GETPOST(
'massaction',
'alpha');
42 $show_files =
GETPOST(
'show_files',
'int');
43 $confirm =
GETPOST(
'confirm',
'alpha');
44 $cancel =
GETPOST(
'cancel',
'alpha');
45 $toselect =
GETPOST(
'toselect',
'array');
46 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'myobjectlist';
47 $backtopage =
GETPOST(
'backtopage',
'alpha');
48 $optioncss =
GETPOST(
'optioncss',
'aZ');
50 $search_id =
GETPOST(
'search_id',
'alphanohtml');
51 $search_month =
GETPOST(
'search_month',
'int');
52 $search_year =
GETPOST(
'search_year',
'int');
53 $search_employee =
GETPOST(
'search_employee',
'int');
54 $search_validator =
GETPOST(
'search_validator',
'int');
55 $search_description =
GETPOST(
'search_description',
'alphanohtml');
56 $search_type =
GETPOST(
'search_type',
'int');
57 $search_prev_solde =
GETPOST(
'search_prev_solde',
'alphanohtml');
58 $search_new_solde =
GETPOST(
'search_new_solde',
'alphanohtml');
61 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
62 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
63 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
65 if (empty($page) || $page == -1 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') || (empty($toselect) && $massaction ===
'0')) {
68 $offset = $limit * $page;
69 $pageprev = $page - 1;
70 $pagenext = $page + 1;
72 $sortfield =
"cpl.rowid";
79 $langs->loadLangs(array(
'users',
'other',
'holiday'));
85 $hookmanager->initHooks(array(
'leavemovementlist'));
87 $arrayfields = array();
88 $arrayofmassactions = array();
90 if (empty($conf->holiday->enabled)) {
95 if (!$user->rights->holiday->readall) {
104 if (
GETPOST(
'cancel',
'alpha')) {
105 $action =
'list'; $massaction =
'';
107 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
111 $parameters = array();
112 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
117 if (empty($reshook)) {
119 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
122 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
126 $search_employee =
'';
127 $search_validator =
'';
128 $search_description =
'';
130 $search_prev_solde =
'';
131 $search_new_solde =
'';
133 $search_array_options = array();
136 if (
GETPOST(
'button_removefilter_x',
'alpha')
137 ||
GETPOST(
'button_removefilter.x',
'alpha')
138 ||
GETPOST(
'button_removefilter',
'alpha')
139 ||
GETPOST(
'button_search_x',
'alpha')
140 ||
GETPOST(
'button_search.x',
'alpha')
141 ||
GETPOST(
'button_search',
'alpha')) {
157 $arrayfields = array(
158 'cpl.rowid'=>array(
'label'=>
"ID",
'checked'=>1),
159 'cpl.date_action'=>array(
'label'=>
"Date",
'checked'=>1),
160 'cpl.fk_user_action'=>array(
'label'=>
"ActionByCP",
'checked'=>1),
161 'cpl.fk_user_update'=>array(
'label'=>
"UserUpdateCP",
'checked'=>1),
162 'cpl.type_action'=>array(
'label'=>
"Description",
'checked'=>1),
163 'cpl.fk_type'=>array(
'label'=>
"Type",
'checked'=>1),
164 'cpl.prev_solde'=>array(
'label'=>
"PrevSoldeCP",
'checked'=>1),
165 'variation'=>array(
'label'=>
"Variation",
'checked'=>1),
166 'cpl.new_solde'=>array(
'label'=>
"NewSoldeCP",
'checked'=>1),
176 $holidaylogstatic =
new stdClass();
177 $alltypeleaves = $object->getTypes(1, -1);
179 $title = $langs->trans(
'CPTitreMenu');
184 if (!empty($search_year) && $search_year > 0) {
185 if (!empty($search_month) && $search_month > 0) {
193 $sqlwhere .=
"AND date_action BETWEEN '".$db->idate($from_date).
"' AND '".$db->idate($to_date).
"'";
196 if (!empty($search_id) && $search_id > 0) {
199 if (!empty($search_validator) && $search_validator > 0) {
200 $sqlwhere .=
natural_search(
'fk_user_action', $search_validator, 1);
202 if (!empty($search_employee) && $search_employee > 0) {
203 $sqlwhere .=
natural_search(
'fk_user_update', $search_employee, 1);
205 if (!empty($search_description)) {
208 if (!empty($search_type) && $search_type > 0) {
211 if (!empty($search_prev_solde)) {
214 if (!empty($search_new_solde)) {
218 $sqlorder = $db->order($sortfield, $sortorder);
221 $log_holiday = $object->fetchLog($sqlorder, $sqlwhere);
225 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
237 $num = is_array($object->logs) ? count($object->logs) : 0;
240 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
241 $param .=
'&contextpage='.urlencode($contextpage);
243 if ($limit > 0 && $limit != $conf->liste_limit) {
244 $param .=
'&limit='.urlencode($limit);
246 if (!empty($search_id)) {
247 $param .=
'&search_statut='.urlencode($search_statut);
249 if (!empty($search_month) && $search_month > 0) {
250 $param .=
'&search_month='.urlencode($search_month);
252 if (!empty($search_year) && $search_year > 0) {
253 $param .=
'&search_year='.urlencode($search_year);
255 if (!empty($search_validator) && $search_validator > 0) {
256 $param .=
'&search_validator='.urlencode($search_validator);
258 if (!empty($search_employee) && $search_employee > 0) {
259 $param .=
'&search_employee='.urlencode($search_employee);
261 if (!empty($search_description)) {
262 $param .=
'&search_description='.urlencode($search_description);
264 if (!empty($search_type) && $search_type > 0) {
265 $param .=
'&search_type='.urlencode($search_type);
267 if (!empty($search_prev_solde)) {
268 $param .=
'&search_prev_solde='.urlencode($search_prev_solde);
270 if (!empty($search_new_solde)) {
271 $param .=
'&search_new_solde='.urlencode($search_new_solde);
274 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
275 if ($optioncss !=
'') {
276 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
278 print
'<input type="hidden" name="token" value="'.newToken().
'">';
279 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
280 print
'<input type="hidden" name="action" value="list">';
281 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
282 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
283 print
'<input type="hidden" name="page" value="'.$page.
'">';
284 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
286 $newcardbutton =
dolGetButtonTitle($langs->trans(
'MenuAddCP'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/holiday/card.php?action=create',
'', $user->rights->holiday->write);
287 print_barre_liste($langs->trans(
'LogCP'), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num,
$nbtotalofrecords,
'title_hrm', 0, $newcardbutton,
'', $limit, 0, 0, 1);
289 print
'<div class="info">'.$langs->trans(
'LastUpdateCP').
': ';
291 $lastUpdate = $object->getConfCP(
'lastUpdate');
293 $monthLastUpdate = $lastUpdate[4].$lastUpdate[5];
294 $yearLastUpdate = $lastUpdate[0].$lastUpdate[1].$lastUpdate[2].$lastUpdate[3];
295 print
'<strong>'.dol_print_date($db->jdate($object->getConfCP(
'lastUpdate')),
'dayhour',
'tzuser').
'</strong>';
297 print $langs->trans(
"MonthOfLastMonthlyUpdate").
': <strong>'.$yearLastUpdate.
'-'.$monthLastUpdate.
'</strong>';
299 print $langs->trans(
'None');
309 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
310 $selectedfields =
'';
311 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
312 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
314 print
'<div class="div-table-responsive">';
315 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'" id="tablelines3">';
317 print
'<tr class="liste_titre_filter">';
320 if (!empty($arrayfields[
'cpl.rowid'][
'checked'])) {
321 print
'<td class="liste_titre"><input type="text" class="maxwidth50" name="search_id" value="'.$search_id.
'"></td>';
325 if (!empty($arrayfields[
'cpl.date_action'][
'checked'])) {
326 print
'<td class="liste_titre center">';
327 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.dol_escape_htmltag($search_month).
'">';
328 print $formother->selectyear($search_year,
'search_year', 1, 10, 5, 0, 0,
'',
'valignmiddle width75',
true);
333 if (!empty($arrayfields[
'cpl.fk_user_action'][
'checked'])) {
335 $excludefilter = $user->admin ?
'' :
'u.rowid <> '.$user->id;
336 $valideurobjects = $validator->listUsersForGroup($excludefilter);
337 $valideurarray = array();
339 foreach ($valideurobjects as $val) {
340 $valideurarray[$val->id] = $val->id;
343 print
'<td class="liste_titre">';
344 print
$form->select_dolusers($search_validator,
"search_validator", 1,
"", 0, $valideurarray,
'', 0, 0, 0, $morefilter, 0,
'',
'maxwidth200');
349 if (!empty($arrayfields[
'cpl.fk_user_update'][
'checked'])) {
350 print
'<td class="liste_titre">';
351 print
$form->select_dolusers($search_employee,
"search_employee", 1,
"", $disabled, $include,
'', 0, 0, 0, $morefilter, 0,
'',
'maxwidth200');
356 if (!empty($arrayfields[
'cpl.type_action'][
'checked'])) {
357 print
'<td class="liste_titre">';
358 print
'<input type="text" class="maxwidth50" name="search_description" value="'.$search_description.
'">';
363 if (!empty($arrayfields[
'cpl.fk_type'][
'checked'])) {
364 foreach ($alltypeleaves as $key => $val) {
365 $labeltoshow = ($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']);
366 $arraytypeleaves[$val[
'rowid']] = $labeltoshow;
369 print
'<td class="liste_titre">';
370 print
$form->selectarray(
'search_type', $arraytypeleaves, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'', 1);
375 if (!empty($arrayfields[
'cpl.prev_solde'][
'checked'])) {
376 print
'<td class="liste_titre right">';
377 print
'<input type="text" class="maxwidth50" name="search_prev_solde" value="'.$search_prev_solde.
'">';
382 if (!empty($arrayfields[
'variation'][
'checked'])) {
383 print
'<td class="liste_titre"></td>';
387 if (!empty($arrayfields[
'cpl.new_solde'][
'checked'])) {
388 print
'<td class="liste_titre right">';
389 print
'<input type="text" class="maxwidth50" name="search_new_solde" value="'.$search_new_solde.
'">';
394 print
'<td class="liste_titre maxwidthsearch">';
395 $searchpicto =
$form->showFilterButtons();
400 print
'<tr class="liste_titre">';
401 if (!empty($arrayfields[
'cpl.rowid'][
'checked'])) {
402 print_liste_field_titre($arrayfields[
'cpl.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'cpl.rowid',
'',
'',
'', $sortfield, $sortorder);
404 if (!empty($arrayfields[
'cpl.date_action'][
'checked'])) {
405 print_liste_field_titre($arrayfields[
'cpl.date_action'][
'label'], $_SERVER[
"PHP_SELF"],
'date_action',
'',
'',
'', $sortfield, $sortorder,
'center ');
407 if (!empty($arrayfields[
'cpl.fk_user_action'][
'checked'])) {
408 print_liste_field_titre($arrayfields[
'cpl.fk_user_action'][
'label'], $_SERVER[
"PHP_SELF"],
'fk_user_action',
'',
'',
'', $sortfield, $sortorder);
410 if (!empty($arrayfields[
'cpl.fk_user_update'][
'checked'])) {
411 print_liste_field_titre($arrayfields[
'cpl.fk_user_update'][
'label'], $_SERVER[
"PHP_SELF"],
'fk_user_update',
'',
'',
'', $sortfield, $sortorder);
413 if (!empty($arrayfields[
'cpl.type_action'][
'checked'])) {
414 print_liste_field_titre($arrayfields[
'cpl.type_action'][
'label'], $_SERVER[
"PHP_SELF"],
'type_action',
'',
'',
'', $sortfield, $sortorder);
416 if (!empty($arrayfields[
'cpl.fk_type'][
'checked'])) {
417 print_liste_field_titre($arrayfields[
'cpl.fk_type'][
'label'], $_SERVER[
"PHP_SELF"],
'fk_type',
'',
'',
'', $sortfield, $sortorder);
419 if (!empty($arrayfields[
'cpl.prev_solde'][
'checked'])) {
420 print_liste_field_titre($arrayfields[
'cpl.prev_solde'][
'label'], $_SERVER[
"PHP_SELF"],
'prev_solde',
'',
'',
'', $sortfield, $sortorder,
'right ');
422 if (!empty($arrayfields[
'variation'][
'checked'])) {
423 print_liste_field_titre($arrayfields[
'variation'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'right ');
425 if (!empty($arrayfields[
'cpl.new_solde'][
'checked'])) {
426 print_liste_field_titre($arrayfields[
'cpl.new_solde'][
'label'], $_SERVER[
"PHP_SELF"],
'new_solde',
'',
'',
'', $sortfield, $sortorder,
'right ');
428 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
433 while ($j < ($page * $limit)) {
434 $obj = next($object->logs);
439 while ($i < min($num, $limit)) {
441 $obj = current($object->logs);
446 $holidaylogstatic->id = $obj[
'rowid'];
447 $holidaylogstatic->date = $obj[
'date_action'];
448 $holidaylogstatic->validator = $obj[
'fk_user_action'];
449 $holidaylogstatic->employee = $obj[
'fk_user_update'];
450 $holidaylogstatic->description = $obj[
'type_action'];
451 $holidaylogstatic->type = $obj[
'fk_type'];
452 $holidaylogstatic->balance_previous = $obj[
'prev_solde'];
453 $holidaylogstatic->balance_new = $obj[
'new_solde'];
455 print
'<tr class="oddeven">';
458 if (!empty($arrayfields[
'cpl.rowid'][
'checked'])) {
459 print
'<td>'.$holidaylogstatic->id.
'</td>';
463 if (!empty($arrayfields[
'cpl.date_action'][
'checked'])) {
464 print
'<td style="text-align: center">'.$holidaylogstatic->date.
'</td>';
468 if (!empty($arrayfields[
'cpl.fk_user_action'][
'checked'])) {
469 $user_action =
new User($db);
470 $user_action->fetch($holidaylogstatic->validator);
471 print
'<td>'.$user_action->getNomUrl(-1).
'</td>';
475 if (!empty($arrayfields[
'cpl.fk_user_update'][
'checked'])) {
476 $user_update =
new User($db);
477 $user_update->fetch($holidaylogstatic->employee);
478 print
'<td>'.$user_update->getNomUrl(-1).
'</td>';
482 if (!empty($arrayfields[
'cpl.type_action'][
'checked'])) {
483 print
'<td class="tdoverflowmax400" title="'.dol_escape_htmltag($holidaylogstatic->description).
'">'.
dol_escape_htmltag($holidaylogstatic->description).
'</td>';
487 if (!empty($arrayfields[
'cpl.fk_type'][
'checked'])) {
489 if (!empty($alltypeleaves[$holidaylogstatic->type])) {
490 if ($alltypeleaves[$holidaylogstatic->type][
'code'] && $langs->trans($alltypeleaves[$holidaylogstatic->type][
'code']) != $alltypeleaves[$holidaylogstatic->type][
'code']) {
491 $label = $langs->trans($alltypeleaves[$holidaylogstatic->type][
'code']);
493 $label = $alltypeleaves[$holidaylogstatic->type][
'label'];
498 print $label ? $label : $holidaylogstatic->type;
503 if (!empty($arrayfields[
'cpl.prev_solde'][
'checked'])) {
504 print
'<td style="text-align: right;">'.price2num($holidaylogstatic->balance_previous, 5).
' '.$langs->trans(
'days').
'</td>';
508 if (!empty($arrayfields[
'variation'][
'checked'])) {
509 $delta =
price2num($holidaylogstatic->balance_new - $holidaylogstatic->balance_previous, 5);
510 print
'<td style="text-align: right;">';
512 print
'<span class="stockmovemententry fontsizeunset">+'.$delta.
'</span>';
514 print
'<span class="stockmovementexit fontsizeunset">'.$delta.
'</span>';
520 if (!empty($arrayfields[
'cpl.new_solde'][
'checked'])) {
521 print
'<td style="text-align: right;">'.price2num($holidaylogstatic->balance_new, 5).
' '.$langs->trans(
'days').
'</td>';
533 if ($log_holiday ==
'2') {
534 print
'<tr class="opacitymedium">';
535 print
'<td colspan="10" class="opacitymedium">'.$langs->trans(
'NoRecordFound').
'</td>';
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 user groups.
Class to manage Dolibarr users.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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 from a POST of a form.
$nbtotalofrecords
Count total nb of records.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.