30require
'../main.inc.php';
33if (!$user->hasRight(
'holiday',
'define_holiday') || $user->socid > 0) {
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
42$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
43$massaction =
GETPOST(
'massaction',
'alpha');
44$mode =
GETPOST(
'mode',
'alpha');
46$confirm =
GETPOST(
'confirm',
'alpha');
47$cancel =
GETPOST(
'cancel',
'alpha');
48$toselect =
GETPOST(
'toselect',
'array');
49$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'myobjectlist';
50$backtopage =
GETPOST(
'backtopage',
'alpha');
51$optioncss =
GETPOST(
'optioncss',
'aZ');
53$search_id =
GETPOST(
'search_id',
'alphanohtml');
56$search_employee =
GETPOST(
'search_employee',
"intcomma");
57$search_validator =
GETPOST(
'search_validator',
"intcomma");
58$search_description =
GETPOST(
'search_description',
'alphanohtml');
59$search_type =
GETPOST(
'search_type',
"intcomma");
60$search_prev_solde =
GETPOST(
'search_prev_solde',
'alphanohtml');
61$search_new_solde =
GETPOST(
'search_new_solde',
'alphanohtml');
65$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
66$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
68if (empty($page) || $page == -1 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') || (empty($toselect) && $massaction ===
'0')) {
71$offset = $limit * $page;
75 $sortfield =
"cpl.rowid";
82$langs->loadLangs(array(
'users',
'other',
'holiday'));
88$hookmanager->initHooks(array(
'leavemovementlist'));
90$arrayfields = array();
91$arrayofmassactions = array();
93if (!isModEnabled(
'holiday')) {
98if (!$user->hasRight(
'holiday',
'readall')) {
107if (
GETPOST(
'cancel',
'alpha')) {
111if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
115$parameters = array();
116$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
121if (empty($reshook)) {
123 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
126 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
130 $search_employee =
'';
131 $search_validator =
'';
132 $search_description =
'';
134 $search_prev_solde =
'';
135 $search_new_solde =
'';
137 $search_array_options = array();
140 if (
GETPOST(
'button_removefilter_x',
'alpha')
141 ||
GETPOST(
'button_removefilter.x',
'alpha')
142 ||
GETPOST(
'button_removefilter',
'alpha')
143 ||
GETPOST(
'button_search_x',
'alpha')
144 ||
GETPOST(
'button_search.x',
'alpha')
145 ||
GETPOST(
'button_search',
'alpha')) {
162 'cpl.rowid' => array(
'label' =>
"ID",
'checked' => 1),
163 'cpl.date_action' => array(
'label' =>
"Date",
'checked' => 1),
164 'cpl.fk_user_action' => array(
'label' =>
"ActionByCP",
'checked' => 1),
165 'cpl.fk_user_update' => array(
'label' =>
"UserUpdateCP",
'checked' => 1),
166 'cpl.type_action' => array(
'label' =>
"Description",
'checked' => 1),
167 'cpl.fk_type' => array(
'label' =>
"Type",
'checked' => 1),
168 'cpl.prev_solde' => array(
'label' =>
"PrevSoldeCP",
'checked' => 1),
169 'variation' => array(
'label' =>
"Variation",
'checked' => 1),
170 'cpl.new_solde' => array(
'label' =>
"NewSoldeCP",
'checked' => 1),
178$form =
new Form($db);
181$alltypeleaves =
$object->getTypes(1, -1);
183$title = $langs->trans(
'CPTitreMenu');
188if (!empty($search_year) && $search_year > 0) {
189 if (!empty($search_month) && $search_month > 0) {
197 $sqlwhere .=
"AND date_action BETWEEN '".$db->idate($from_date).
"' AND '".$db->idate($to_date).
"'";
200if (!empty($search_id) && $search_id > 0) {
203if (!empty($search_validator) && $search_validator > 0) {
204 $sqlwhere .=
natural_search(
'fk_user_action', $search_validator, 1);
206if (!empty($search_employee) && $search_employee > 0) {
207 $sqlwhere .=
natural_search(
'fk_user_update', $search_employee, 1);
209if (!empty($search_description)) {
212if (!empty($search_type) && $search_type > 0) {
215if (!empty($search_prev_solde)) {
218if (!empty($search_new_solde)) {
222$sqlorder = $db->order($sortfield, $sortorder);
225$log_holiday =
$object->fetchLog($sqlorder, $sqlwhere);
228$nbtotalofrecords =
'';
232 $nbtotalofrecords = is_array(
$object->logs) ? count(
$object->logs) : 0;
234 if (($page * $limit) > $nbtotalofrecords) {
244if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
245 $param .=
'&contextpage='.urlencode($contextpage);
247if ($limit > 0 && $limit != $conf->liste_limit) {
248 $param .=
'&limit='.((int) $limit);
250if (!empty($search_id)) {
251 $param .=
'&search_status='.urlencode($search_status);
253if (!empty($search_month) && $search_month > 0) {
254 $param .=
'&search_month='.urlencode((
string) ($search_month));
256if (!empty($search_year) && $search_year > 0) {
257 $param .=
'&search_year='.urlencode((
string) ($search_year));
259if (!empty($search_validator) && $search_validator > 0) {
260 $param .=
'&search_validator='.urlencode((
string) ($search_validator));
262if (!empty($search_employee) && $search_employee > 0) {
263 $param .=
'&search_employee='.urlencode((
string) ($search_employee));
265if (!empty($search_description)) {
266 $param .=
'&search_description='.urlencode($search_description);
268if (!empty($search_type) && $search_type > 0) {
269 $param .=
'&search_type='.urlencode((
string) ($search_type));
271if (!empty($search_prev_solde)) {
272 $param .=
'&search_prev_solde='.urlencode($search_prev_solde);
274if (!empty($search_new_solde)) {
275 $param .=
'&search_new_solde='.urlencode($search_new_solde);
278print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
279if ($optioncss !=
'') {
280 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
282print
'<input type="hidden" name="token" value="'.newToken().
'">';
283print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
284print
'<input type="hidden" name="action" value="list">';
285print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
286print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
287print
'<input type="hidden" name="page" value="'.$page.
'">';
288print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
290$newcardbutton =
dolGetButtonTitle($langs->trans(
'MenuAddCP'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/holiday/card.php?action=create',
'', $user->hasRight(
'holiday',
'write'));
292print_barre_liste($langs->trans(
'LogCP'), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'title_hrm', 0, $newcardbutton,
'', $limit, 0, 0, 1);
294print
'<div class="info">'.$langs->trans(
'LastUpdateCP').
': ';
296$lastUpdate =
$object->getConfCP(
'lastUpdate');
298 $monthLastUpdate = $lastUpdate[4].$lastUpdate[5];
299 $yearLastUpdate = $lastUpdate[0].$lastUpdate[1].$lastUpdate[2].$lastUpdate[3];
300 print
'<strong>'.dol_print_date($db->jdate(
$object->getConfCP(
'lastUpdate')),
'dayhour',
'tzuser').
'</strong>';
302 print $langs->trans(
"MonthOfLastMonthlyUpdate").
': <strong>'.$yearLastUpdate.
'-'.$monthLastUpdate.
'</strong>';
304 print $langs->trans(
'None');
314$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
315$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
316$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
317$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
319print
'<div class="div-table-responsive">';
320print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'" id="tablelines3">';
322print
'<tr class="liste_titre_filter">';
326 print
'<td class="liste_titre maxwidthsearch">';
327 $searchpicto = $form->showFilterButtons();
333if (!empty($arrayfields[
'cpl.rowid'][
'checked'])) {
334 print
'<td class="liste_titre"><input type="text" class="maxwidth50" name="search_id" value="'.$search_id.
'"></td>';
338if (!empty($arrayfields[
'cpl.date_action'][
'checked'])) {
339 print
'<td class="liste_titre center">';
340 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.dol_escape_htmltag($search_month).
'">';
341 print $formother->selectyear($search_year,
'search_year', 1, 10, 5, 0, 0,
'',
'valignmiddle width75',
true);
346if (!empty($arrayfields[
'cpl.fk_user_action'][
'checked'])) {
348 $excludefilter = $user->admin ?
'' :
'u.rowid <> '.((int) $user->id);
349 $valideurobjects = $validator->listUsersForGroup($excludefilter, 1);
350 $valideurarray = array();
351 foreach ($valideurobjects as $val) {
352 $valideurarray[$val] = $val;
355 print
'<td class="liste_titre">';
356 print $form->select_dolusers($search_validator,
"search_validator", 1,
"", 0, $valideurarray,
'', 0, 0, 0, $morefilter, 0,
'',
'maxwidth200');
361if (!empty($arrayfields[
'cpl.fk_user_update'][
'checked'])) {
362 print
'<td class="liste_titre">';
363 print $form->select_dolusers($search_employee,
"search_employee", 1,
"", $disabled, $include,
'', 0, 0, 0, $morefilter, 0,
'',
'maxwidth200');
368if (!empty($arrayfields[
'cpl.type_action'][
'checked'])) {
369 print
'<td class="liste_titre">';
370 print
'<input type="text" class="maxwidth50" name="search_description" value="'.$search_description.
'">';
375if (!empty($arrayfields[
'cpl.fk_type'][
'checked'])) {
376 $arraytypeleaves = array();
377 foreach ($alltypeleaves as $key => $val) {
378 $labeltoshow = ($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']);
379 $arraytypeleaves[$val[
'rowid']] = $labeltoshow;
382 print
'<td class="liste_titre">';
383 print $form->selectarray(
'search_type', $arraytypeleaves, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'', 1);
388if (!empty($arrayfields[
'cpl.prev_solde'][
'checked'])) {
389 print
'<td class="liste_titre right">';
390 print
'<input type="text" class="maxwidth50" name="search_prev_solde" value="'.$search_prev_solde.
'">';
395if (!empty($arrayfields[
'variation'][
'checked'])) {
396 print
'<td class="liste_titre"></td>';
400if (!empty($arrayfields[
'cpl.new_solde'][
'checked'])) {
401 print
'<td class="liste_titre right">';
402 print
'<input type="text" class="maxwidth50" name="search_new_solde" value="'.$search_new_solde.
'">';
408 print
'<td class="liste_titre maxwidthsearch">';
409 $searchpicto = $form->showFilterButtons();
415print
'<tr class="liste_titre">';
418 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
420if (!empty($arrayfields[
'cpl.rowid'][
'checked'])) {
421 print_liste_field_titre($arrayfields[
'cpl.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'cpl.rowid',
'',
'',
'', $sortfield, $sortorder);
423if (!empty($arrayfields[
'cpl.date_action'][
'checked'])) {
424 print_liste_field_titre($arrayfields[
'cpl.date_action'][
'label'], $_SERVER[
"PHP_SELF"],
'date_action',
'',
'',
'', $sortfield, $sortorder,
'center ');
426if (!empty($arrayfields[
'cpl.fk_user_action'][
'checked'])) {
427 print_liste_field_titre($arrayfields[
'cpl.fk_user_action'][
'label'], $_SERVER[
"PHP_SELF"],
'fk_user_action',
'',
'',
'', $sortfield, $sortorder);
429if (!empty($arrayfields[
'cpl.fk_user_update'][
'checked'])) {
430 print_liste_field_titre($arrayfields[
'cpl.fk_user_update'][
'label'], $_SERVER[
"PHP_SELF"],
'fk_user_update',
'',
'',
'', $sortfield, $sortorder);
432if (!empty($arrayfields[
'cpl.type_action'][
'checked'])) {
433 print_liste_field_titre($arrayfields[
'cpl.type_action'][
'label'], $_SERVER[
"PHP_SELF"],
'type_action',
'',
'',
'', $sortfield, $sortorder);
435if (!empty($arrayfields[
'cpl.fk_type'][
'checked'])) {
436 print_liste_field_titre($arrayfields[
'cpl.fk_type'][
'label'], $_SERVER[
"PHP_SELF"],
'fk_type',
'',
'',
'', $sortfield, $sortorder);
438if (!empty($arrayfields[
'cpl.prev_solde'][
'checked'])) {
439 print_liste_field_titre($arrayfields[
'cpl.prev_solde'][
'label'], $_SERVER[
"PHP_SELF"],
'prev_solde',
'',
'',
'', $sortfield, $sortorder,
'right ');
441if (!empty($arrayfields[
'variation'][
'checked'])) {
442 print_liste_field_titre($arrayfields[
'variation'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'right ');
444if (!empty($arrayfields[
'cpl.new_solde'][
'checked'])) {
445 print_liste_field_titre($arrayfields[
'cpl.new_solde'][
'label'], $_SERVER[
"PHP_SELF"],
'new_solde',
'',
'',
'', $sortfield, $sortorder,
'right ');
449 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
455while ($j < ($page * $limit)) {
461while ($i < min($num, $limit)) {
468 $holidaylogstatic->id = $obj[
'rowid'];
469 $holidaylogstatic->date = $obj[
'date_action'];
470 $holidaylogstatic->validator = $obj[
'fk_user_action'];
471 $holidaylogstatic->employee = $obj[
'fk_user_update'];
472 $holidaylogstatic->description = $obj[
'type_action'];
473 $holidaylogstatic->type = $obj[
'fk_type'];
474 $holidaylogstatic->balance_previous = $obj[
'prev_solde'];
475 $holidaylogstatic->balance_new = $obj[
'new_solde'];
477 print
'<tr class="oddeven">';
485 if (!empty($arrayfields[
'cpl.rowid'][
'checked'])) {
486 print
'<td>'.$holidaylogstatic->id.
'</td>';
490 if (!empty($arrayfields[
'cpl.date_action'][
'checked'])) {
491 print
'<td style="text-align: center">'.$holidaylogstatic->date.
'</td>';
495 if (!empty($arrayfields[
'cpl.fk_user_action'][
'checked'])) {
496 $user_action =
new User($db);
497 $user_action->fetch($holidaylogstatic->validator);
498 print
'<td>'.$user_action->getNomUrl(-1).
'</td>';
502 if (!empty($arrayfields[
'cpl.fk_user_update'][
'checked'])) {
503 $user_update =
new User($db);
504 $user_update->fetch($holidaylogstatic->employee);
505 print
'<td>'.$user_update->getNomUrl(-1).
'</td>';
509 if (!empty($arrayfields[
'cpl.type_action'][
'checked'])) {
510 print
'<td class="tdoverflowmax400" title="'.dol_escape_htmltag($holidaylogstatic->description).
'">'.
dol_escape_htmltag($holidaylogstatic->description).
'</td>';
514 if (!empty($arrayfields[
'cpl.fk_type'][
'checked'])) {
516 if (!empty($alltypeleaves[$holidaylogstatic->type])) {
517 if ($alltypeleaves[$holidaylogstatic->type][
'code'] && $langs->trans($alltypeleaves[$holidaylogstatic->type][
'code']) != $alltypeleaves[$holidaylogstatic->type][
'code']) {
518 $label = $langs->trans($alltypeleaves[$holidaylogstatic->type][
'code']);
520 $label = $alltypeleaves[$holidaylogstatic->type][
'label'];
525 print $label ? $label : $holidaylogstatic->type;
530 if (!empty($arrayfields[
'cpl.prev_solde'][
'checked'])) {
531 print
'<td style="text-align: right;">'.price2num($holidaylogstatic->balance_previous, 5).
' '.$langs->trans(
'days').
'</td>';
535 if (!empty($arrayfields[
'variation'][
'checked'])) {
536 $delta =
price2num($holidaylogstatic->balance_new - $holidaylogstatic->balance_previous, 5);
537 print
'<td style="text-align: right;">';
539 print
'<span class="stockmovemententry fontsizeunset">+'.$delta.
'</span>';
541 print
'<span class="stockmovementexit fontsizeunset">'.$delta.
'</span>';
547 if (!empty($arrayfields[
'cpl.new_solde'][
'checked'])) {
548 print
'<td style="text-align: right;">'.price2num($holidaylogstatic->balance_new, 5).
' '.$langs->trans(
'days').
'</td>';
562if ($log_holiday ==
'2') {
563 print
'<tr class="opacitymedium">';
564 print
'<td colspan="10" class="opacitymedium">'.$langs->trans(
'NoRecordFound').
'</td>';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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 a 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.
print_barre_liste($title, $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.
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.
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.