28require
'../main.inc.php';
31if (empty($user->rights->holiday->define_holiday) || $user->socid > 0) {
35require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
40$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
41$massaction =
GETPOST(
'massaction',
'alpha');
42$mode =
GETPOST(
'mode',
'alpha');
43$show_files =
GETPOST(
'show_files',
'int');
44$confirm =
GETPOST(
'confirm',
'alpha');
45$cancel =
GETPOST(
'cancel',
'alpha');
46$toselect =
GETPOST(
'toselect',
'array');
47$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'myobjectlist';
48$backtopage =
GETPOST(
'backtopage',
'alpha');
49$optioncss =
GETPOST(
'optioncss',
'aZ');
51$search_id =
GETPOST(
'search_id',
'alphanohtml');
52$search_month =
GETPOST(
'search_month',
'int');
53$search_year =
GETPOST(
'search_year',
'int');
54$search_employee =
GETPOST(
'search_employee',
'int');
55$search_validator =
GETPOST(
'search_validator',
'int');
56$search_description =
GETPOST(
'search_description',
'alphanohtml');
57$search_type =
GETPOST(
'search_type',
'int');
58$search_prev_solde =
GETPOST(
'search_prev_solde',
'alphanohtml');
59$search_new_solde =
GETPOST(
'search_new_solde',
'alphanohtml');
62$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
63$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
64$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
65$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
66if (empty($page) || $page == -1 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') || (empty($toselect) && $massaction ===
'0')) {
69$offset = $limit * $page;
73 $sortfield =
"cpl.rowid";
80$langs->loadLangs(array(
'users',
'other',
'holiday'));
86$hookmanager->initHooks(array(
'leavemovementlist'));
88$arrayfields = array();
89$arrayofmassactions = array();
91if (empty($conf->holiday->enabled)) {
96if (!$user->rights->holiday->readall) {
105if (
GETPOST(
'cancel',
'alpha')) {
106 $action =
'list'; $massaction =
'';
108if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
112$parameters = array();
113$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
118if (empty($reshook)) {
120 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
123 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
127 $search_employee =
'';
128 $search_validator =
'';
129 $search_description =
'';
131 $search_prev_solde =
'';
132 $search_new_solde =
'';
134 $search_array_options = array();
137 if (
GETPOST(
'button_removefilter_x',
'alpha')
138 ||
GETPOST(
'button_removefilter.x',
'alpha')
139 ||
GETPOST(
'button_removefilter',
'alpha')
140 ||
GETPOST(
'button_search_x',
'alpha')
141 ||
GETPOST(
'button_search.x',
'alpha')
142 ||
GETPOST(
'button_search',
'alpha')) {
159 'cpl.rowid'=>array(
'label'=>
"ID",
'checked'=>1),
160 'cpl.date_action'=>array(
'label'=>
"Date",
'checked'=>1),
161 'cpl.fk_user_action'=>array(
'label'=>
"ActionByCP",
'checked'=>1),
162 'cpl.fk_user_update'=>array(
'label'=>
"UserUpdateCP",
'checked'=>1),
163 'cpl.type_action'=>array(
'label'=>
"Description",
'checked'=>1),
164 'cpl.fk_type'=>array(
'label'=>
"Type",
'checked'=>1),
165 'cpl.prev_solde'=>array(
'label'=>
"PrevSoldeCP",
'checked'=>1),
166 'variation'=>array(
'label'=>
"Variation",
'checked'=>1),
167 'cpl.new_solde'=>array(
'label'=>
"NewSoldeCP",
'checked'=>1),
175$form =
new Form($db);
177$holidaylogstatic =
new stdClass();
178$alltypeleaves = $object->getTypes(1, -1);
180$title = $langs->trans(
'CPTitreMenu');
185if (!empty($search_year) && $search_year > 0) {
186 if (!empty($search_month) && $search_month > 0) {
194 $sqlwhere .=
"AND date_action BETWEEN '".$db->idate($from_date).
"' AND '".$db->idate($to_date).
"'";
197if (!empty($search_id) && $search_id > 0) {
200if (!empty($search_validator) && $search_validator > 0) {
201 $sqlwhere .=
natural_search(
'fk_user_action', $search_validator, 1);
203if (!empty($search_employee) && $search_employee > 0) {
204 $sqlwhere .=
natural_search(
'fk_user_update', $search_employee, 1);
206if (!empty($search_description)) {
209if (!empty($search_type) && $search_type > 0) {
212if (!empty($search_prev_solde)) {
215if (!empty($search_new_solde)) {
219$sqlorder = $db->order($sortfield, $sortorder);
222$log_holiday = $object->fetchLog($sqlorder, $sqlwhere);
225$nbtotalofrecords =
'';
229 $nbtotalofrecords = is_array($object->logs) ? count($object->logs) : 0;
231 if (($page * $limit) > $nbtotalofrecords) {
238$num = is_array($object->logs) ? count($object->logs) : 0;
241if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
242 $param .=
'&contextpage='.urlencode($contextpage);
244if ($limit > 0 && $limit != $conf->liste_limit) {
245 $param .=
'&limit='.((int) $limit);
247if (!empty($search_id)) {
248 $param .=
'&search_statut='.urlencode($search_statut);
250if (!empty($search_month) && $search_month > 0) {
251 $param .=
'&search_month='.urlencode($search_month);
253if (!empty($search_year) && $search_year > 0) {
254 $param .=
'&search_year='.urlencode($search_year);
256if (!empty($search_validator) && $search_validator > 0) {
257 $param .=
'&search_validator='.urlencode($search_validator);
259if (!empty($search_employee) && $search_employee > 0) {
260 $param .=
'&search_employee='.urlencode($search_employee);
262if (!empty($search_description)) {
263 $param .=
'&search_description='.urlencode($search_description);
265if (!empty($search_type) && $search_type > 0) {
266 $param .=
'&search_type='.urlencode($search_type);
268if (!empty($search_prev_solde)) {
269 $param .=
'&search_prev_solde='.urlencode($search_prev_solde);
271if (!empty($search_new_solde)) {
272 $param .=
'&search_new_solde='.urlencode($search_new_solde);
275print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
276if ($optioncss !=
'') {
277 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
279print
'<input type="hidden" name="token" value="'.newToken().
'">';
280print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
281print
'<input type="hidden" name="action" value="list">';
282print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
283print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
284print
'<input type="hidden" name="page" value="'.$page.
'">';
285print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
287$newcardbutton =
dolGetButtonTitle($langs->trans(
'MenuAddCP'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/holiday/card.php?action=create',
'', $user->rights->holiday->write);
288print_barre_liste($langs->trans(
'LogCP'), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'title_hrm', 0, $newcardbutton,
'', $limit, 0, 0, 1);
290print
'<div class="info">'.$langs->trans(
'LastUpdateCP').
': ';
292$lastUpdate = $object->getConfCP(
'lastUpdate');
294 $monthLastUpdate = $lastUpdate[4].$lastUpdate[5];
295 $yearLastUpdate = $lastUpdate[0].$lastUpdate[1].$lastUpdate[2].$lastUpdate[3];
296 print
'<strong>'.dol_print_date($db->jdate($object->getConfCP(
'lastUpdate')),
'dayhour',
'tzuser').
'</strong>';
298 print $langs->trans(
"MonthOfLastMonthlyUpdate").
': <strong>'.$yearLastUpdate.
'-'.$monthLastUpdate.
'</strong>';
300 print $langs->trans(
'None');
310$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
311$selectedfields = ($mode !=
'kanban' ? $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
'')) :
'');
312$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
314print
'<div class="div-table-responsive">';
315print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'" id="tablelines3">';
317print
'<tr class="liste_titre_filter">';
321 print
'<td class="liste_titre maxwidthsearch">';
322 $searchpicto = $form->showFilterButtons();
328if (!empty($arrayfields[
'cpl.rowid'][
'checked'])) {
329 print
'<td class="liste_titre"><input type="text" class="maxwidth50" name="search_id" value="'.$search_id.
'"></td>';
333if (!empty($arrayfields[
'cpl.date_action'][
'checked'])) {
334 print
'<td class="liste_titre center">';
335 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.dol_escape_htmltag($search_month).
'">';
336 print $formother->selectyear($search_year,
'search_year', 1, 10, 5, 0, 0,
'',
'valignmiddle width75',
true);
341if (!empty($arrayfields[
'cpl.fk_user_action'][
'checked'])) {
343 $excludefilter = $user->admin ?
'' :
'u.rowid <> '.$user->id;
344 $valideurobjects = $validator->listUsersForGroup($excludefilter, 1);
345 $valideurarray = array();
346 foreach ($valideurobjects as $val) {
347 $valideurarray[$val] = $val;
350 print
'<td class="liste_titre">';
351 print $form->select_dolusers($search_validator,
"search_validator", 1,
"", 0, $valideurarray,
'', 0, 0, 0, $morefilter, 0,
'',
'maxwidth200');
356if (!empty($arrayfields[
'cpl.fk_user_update'][
'checked'])) {
357 print
'<td class="liste_titre">';
358 print $form->select_dolusers($search_employee,
"search_employee", 1,
"", $disabled, $include,
'', 0, 0, 0, $morefilter, 0,
'',
'maxwidth200');
363if (!empty($arrayfields[
'cpl.type_action'][
'checked'])) {
364 print
'<td class="liste_titre">';
365 print
'<input type="text" class="maxwidth50" name="search_description" value="'.$search_description.
'">';
370if (!empty($arrayfields[
'cpl.fk_type'][
'checked'])) {
371 foreach ($alltypeleaves as $key => $val) {
372 $labeltoshow = ($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']);
373 $arraytypeleaves[$val[
'rowid']] = $labeltoshow;
376 print
'<td class="liste_titre">';
377 print $form->selectarray(
'search_type', $arraytypeleaves, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'', 1);
382if (!empty($arrayfields[
'cpl.prev_solde'][
'checked'])) {
383 print
'<td class="liste_titre right">';
384 print
'<input type="text" class="maxwidth50" name="search_prev_solde" value="'.$search_prev_solde.
'">';
389if (!empty($arrayfields[
'variation'][
'checked'])) {
390 print
'<td class="liste_titre"></td>';
394if (!empty($arrayfields[
'cpl.new_solde'][
'checked'])) {
395 print
'<td class="liste_titre right">';
396 print
'<input type="text" class="maxwidth50" name="search_new_solde" value="'.$search_new_solde.
'">';
402 print
'<td class="liste_titre maxwidthsearch">';
403 $searchpicto = $form->showFilterButtons();
409print
'<tr class="liste_titre">';
412 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
414if (!empty($arrayfields[
'cpl.rowid'][
'checked'])) {
415 print_liste_field_titre($arrayfields[
'cpl.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'cpl.rowid',
'',
'',
'', $sortfield, $sortorder);
417if (!empty($arrayfields[
'cpl.date_action'][
'checked'])) {
418 print_liste_field_titre($arrayfields[
'cpl.date_action'][
'label'], $_SERVER[
"PHP_SELF"],
'date_action',
'',
'',
'', $sortfield, $sortorder,
'center ');
420if (!empty($arrayfields[
'cpl.fk_user_action'][
'checked'])) {
421 print_liste_field_titre($arrayfields[
'cpl.fk_user_action'][
'label'], $_SERVER[
"PHP_SELF"],
'fk_user_action',
'',
'',
'', $sortfield, $sortorder);
423if (!empty($arrayfields[
'cpl.fk_user_update'][
'checked'])) {
424 print_liste_field_titre($arrayfields[
'cpl.fk_user_update'][
'label'], $_SERVER[
"PHP_SELF"],
'fk_user_update',
'',
'',
'', $sortfield, $sortorder);
426if (!empty($arrayfields[
'cpl.type_action'][
'checked'])) {
427 print_liste_field_titre($arrayfields[
'cpl.type_action'][
'label'], $_SERVER[
"PHP_SELF"],
'type_action',
'',
'',
'', $sortfield, $sortorder);
429if (!empty($arrayfields[
'cpl.fk_type'][
'checked'])) {
430 print_liste_field_titre($arrayfields[
'cpl.fk_type'][
'label'], $_SERVER[
"PHP_SELF"],
'fk_type',
'',
'',
'', $sortfield, $sortorder);
432if (!empty($arrayfields[
'cpl.prev_solde'][
'checked'])) {
433 print_liste_field_titre($arrayfields[
'cpl.prev_solde'][
'label'], $_SERVER[
"PHP_SELF"],
'prev_solde',
'',
'',
'', $sortfield, $sortorder,
'right ');
435if (!empty($arrayfields[
'variation'][
'checked'])) {
436 print_liste_field_titre($arrayfields[
'variation'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'right ');
438if (!empty($arrayfields[
'cpl.new_solde'][
'checked'])) {
439 print_liste_field_titre($arrayfields[
'cpl.new_solde'][
'label'], $_SERVER[
"PHP_SELF"],
'new_solde',
'',
'',
'', $sortfield, $sortorder,
'right ');
443 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
449while ($j < ($page * $limit)) {
450 $obj = next($object->logs);
455while ($i < min($num, $limit)) {
457 $obj = current($object->logs);
462 $holidaylogstatic->id = $obj[
'rowid'];
463 $holidaylogstatic->date = $obj[
'date_action'];
464 $holidaylogstatic->validator = $obj[
'fk_user_action'];
465 $holidaylogstatic->employee = $obj[
'fk_user_update'];
466 $holidaylogstatic->description = $obj[
'type_action'];
467 $holidaylogstatic->type = $obj[
'fk_type'];
468 $holidaylogstatic->balance_previous = $obj[
'prev_solde'];
469 $holidaylogstatic->balance_new = $obj[
'new_solde'];
471 print
'<tr class="oddeven">';
479 if (!empty($arrayfields[
'cpl.rowid'][
'checked'])) {
480 print
'<td>'.$holidaylogstatic->id.
'</td>';
484 if (!empty($arrayfields[
'cpl.date_action'][
'checked'])) {
485 print
'<td style="text-align: center">'.$holidaylogstatic->date.
'</td>';
489 if (!empty($arrayfields[
'cpl.fk_user_action'][
'checked'])) {
490 $user_action =
new User($db);
491 $user_action->fetch($holidaylogstatic->validator);
492 print
'<td>'.$user_action->getNomUrl(-1).
'</td>';
496 if (!empty($arrayfields[
'cpl.fk_user_update'][
'checked'])) {
497 $user_update =
new User($db);
498 $user_update->fetch($holidaylogstatic->employee);
499 print
'<td>'.$user_update->getNomUrl(-1).
'</td>';
503 if (!empty($arrayfields[
'cpl.type_action'][
'checked'])) {
504 print
'<td class="tdoverflowmax400" title="'.dol_escape_htmltag($holidaylogstatic->description).
'">'.
dol_escape_htmltag($holidaylogstatic->description).
'</td>';
508 if (!empty($arrayfields[
'cpl.fk_type'][
'checked'])) {
510 if (!empty($alltypeleaves[$holidaylogstatic->type])) {
511 if ($alltypeleaves[$holidaylogstatic->type][
'code'] && $langs->trans($alltypeleaves[$holidaylogstatic->type][
'code']) != $alltypeleaves[$holidaylogstatic->type][
'code']) {
512 $label = $langs->trans($alltypeleaves[$holidaylogstatic->type][
'code']);
514 $label = $alltypeleaves[$holidaylogstatic->type][
'label'];
519 print $label ? $label : $holidaylogstatic->type;
524 if (!empty($arrayfields[
'cpl.prev_solde'][
'checked'])) {
525 print
'<td style="text-align: right;">'.price2num($holidaylogstatic->balance_previous, 5).
' '.$langs->trans(
'days').
'</td>';
529 if (!empty($arrayfields[
'variation'][
'checked'])) {
530 $delta =
price2num($holidaylogstatic->balance_new - $holidaylogstatic->balance_previous, 5);
531 print
'<td style="text-align: right;">';
533 print
'<span class="stockmovemententry fontsizeunset">+'.$delta.
'</span>';
535 print
'<span class="stockmovementexit fontsizeunset">'.$delta.
'</span>';
541 if (!empty($arrayfields[
'cpl.new_solde'][
'checked'])) {
542 print
'<td style="text-align: right;">'.price2num($holidaylogstatic->balance_new, 5).
' '.$langs->trans(
'days').
'</td>';
556if ($log_holiday ==
'2') {
557 print
'<tr class="opacitymedium">';
558 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.
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.
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...
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.