31require
'../main.inc.php';
34if (!$user->hasRight(
'holiday',
'define_holiday') || $user->socid > 0) {
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
52$langs->loadLangs(array(
'users',
'other',
'holiday'));
54$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
55$massaction =
GETPOST(
'massaction',
'alpha');
56$mode =
GETPOST(
'mode',
'alpha');
58$confirm =
GETPOST(
'confirm',
'alpha');
59$cancel =
GETPOST(
'cancel',
'alpha');
60$toselect =
GETPOST(
'toselect',
'array:int');
61$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'myobjectlist';
62$backtopage =
GETPOST(
'backtopage',
'alpha');
63$optioncss =
GETPOST(
'optioncss',
'aZ');
65$search_id =
GETPOST(
'search_id',
'alphanohtml');
68$search_employee =
GETPOST(
'search_employee',
"intcomma");
69$search_validator =
GETPOST(
'search_validator',
"intcomma");
70$search_description =
GETPOST(
'search_description',
'alphanohtml');
71$search_type =
GETPOST(
'search_type',
"intcomma");
72$search_prev_solde =
GETPOST(
'search_prev_solde',
'alphanohtml');
73$search_new_solde =
GETPOST(
'search_new_solde',
'alphanohtml');
77$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
78$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
80if (empty($page) || $page == -1 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') || (empty($toselect) && $massaction ===
'0')) {
83$offset = $limit * $page;
87 $sortfield =
"cpl.rowid";
97$hookmanager->initHooks(array(
'leavemovementlist'));
99$arrayfields = array();
100$arrayofmassactions = array();
107if (!$user->hasRight(
'holiday',
'readall')) {
116if (
GETPOST(
'cancel',
'alpha')) {
120if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
124$parameters = array();
125$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
130if (empty($reshook)) {
132 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
135 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
139 $search_employee =
'';
140 $search_validator =
'';
141 $search_description =
'';
143 $search_prev_solde =
'';
144 $search_new_solde =
'';
146 $search_array_options = array();
149 if (
GETPOST(
'button_removefilter_x',
'alpha')
150 ||
GETPOST(
'button_removefilter.x',
'alpha')
151 ||
GETPOST(
'button_removefilter',
'alpha')
152 ||
GETPOST(
'button_search_x',
'alpha')
153 ||
GETPOST(
'button_search.x',
'alpha')
154 ||
GETPOST(
'button_search',
'alpha')) {
171 'cpl.rowid' => array(
'label' =>
"ID",
'checked' =>
'1'),
172 'cpl.date_action' => array(
'label' =>
"Date",
'checked' =>
'1'),
173 'cpl.fk_user_action' => array(
'label' =>
"ActionByCP",
'checked' =>
'1'),
174 'cpl.fk_user_update' => array(
'label' =>
"UserUpdateCP",
'checked' =>
'1'),
175 'cpl.type_action' => array(
'label' =>
"Description",
'checked' =>
'1'),
176 'cpl.fk_type' => array(
'label' =>
"Type",
'checked' =>
'1'),
177 'cpl.prev_solde' => array(
'label' =>
"PrevSoldeCP",
'checked' =>
'1'),
178 'variation' => array(
'label' =>
"Variation",
'checked' =>
'1'),
179 'cpl.new_solde' => array(
'label' =>
"NewSoldeCP",
'checked' =>
'1'),
187$form =
new Form($db);
190$alltypeleaves =
$object->getTypes(1, -1);
192$title = $langs->trans(
'CPTitreMenu');
193$help_url =
'EN:Module_Holiday';
195llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-holiday page-view_log');
199if (!empty($search_year) && $search_year > 0) {
200 if (!empty($search_month) && $search_month > 0) {
208 $sqlwhere .=
"AND date_action BETWEEN '".$db->idate($from_date).
"' AND '".$db->idate($to_date).
"'";
211if (!empty($search_id) && $search_id > 0) {
214if (!empty($search_validator) && $search_validator > 0) {
215 $sqlwhere .=
natural_search(
'fk_user_action', $search_validator, 1);
217if (!empty($search_employee) && $search_employee > 0) {
218 $sqlwhere .=
natural_search(
'fk_user_update', $search_employee, 1);
220if (!empty($search_description)) {
223if (!empty($search_type) && $search_type > 0) {
226if (!empty($search_prev_solde)) {
229if (!empty($search_new_solde)) {
233$sqlorder = $db->order($sortfield, $sortorder);
236$log_holiday =
$object->fetchLog($sqlorder, $sqlwhere);
239$nbtotalofrecords =
'';
243 $nbtotalofrecords = is_array(
$object->logs) ? count(
$object->logs) : 0;
245 if (($page * $limit) > (
int) $nbtotalofrecords) {
255if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
256 $param .=
'&contextpage='.urlencode($contextpage);
258if ($limit > 0 && $limit != $conf->liste_limit) {
259 $param .=
'&limit='.((int) $limit);
261if (!empty($search_id)) {
262 $param .=
'&search_status='.urlencode($search_status);
264if (!empty($search_month) && $search_month > 0) {
265 $param .=
'&search_month='.urlencode((
string) ($search_month));
267if (!empty($search_year) && $search_year > 0) {
268 $param .=
'&search_year='.urlencode((
string) ($search_year));
270if (!empty($search_validator) && $search_validator > 0) {
271 $param .=
'&search_validator='.urlencode((
string) ($search_validator));
273if (!empty($search_employee) && $search_employee > 0) {
274 $param .=
'&search_employee='.urlencode((
string) ($search_employee));
276if (!empty($search_description)) {
277 $param .=
'&search_description='.urlencode($search_description);
279if (!empty($search_type) && $search_type > 0) {
280 $param .=
'&search_type='.urlencode((
string) ($search_type));
282if (!empty($search_prev_solde)) {
283 $param .=
'&search_prev_solde='.urlencode($search_prev_solde);
285if (!empty($search_new_solde)) {
286 $param .=
'&search_new_solde='.urlencode($search_new_solde);
289print
'<form method="POST" id="searchFormList" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
290if ($optioncss !=
'') {
291 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
293print
'<input type="hidden" name="token" value="'.newToken().
'">';
294print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
295print
'<input type="hidden" name="action" value="list">';
296print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
297print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
298print
'<input type="hidden" name="page" value="'.$page.
'">';
299print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
301$newcardbutton =
dolGetButtonTitle($langs->trans(
'MenuAddCP'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/holiday/card.php?action=create',
'', $user->hasRight(
'holiday',
'write'));
303print_barre_liste($langs->trans(
'LogCP'), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'title_hrm', 0, $newcardbutton,
'', $limit, 0, 0, 1);
305print
'<div class="info">'.$langs->trans(
'LastUpdateCP').
': ';
307$lastUpdate =
$object->getConfCP(
'lastUpdate');
309 $monthLastUpdate = $lastUpdate[4].$lastUpdate[5];
310 $yearLastUpdate = $lastUpdate[0].$lastUpdate[1].$lastUpdate[2].$lastUpdate[3];
311 print
'<strong>'.dol_print_date($db->jdate(
$object->getConfCP(
'lastUpdate')),
'dayhour',
'tzuser').
'</strong>';
313 print $langs->trans(
"MonthOfLastMonthlyUpdate").
': <strong>'.$yearLastUpdate.
'-'.$monthLastUpdate.
'</strong>';
315 print $langs->trans(
'None');
325$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
326$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
327$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
328$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
330print
'<div class="div-table-responsive">';
331print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'" id="tablelines3">';
333print
'<tr class="liste_titre_filter">';
337 print
'<td class="liste_titre maxwidthsearch">';
338 $searchpicto = $form->showFilterButtons();
344if (!empty($arrayfields[
'cpl.rowid'][
'checked'])) {
345 print
'<td class="liste_titre"><input type="text" class="maxwidth50" name="search_id" value="'.$search_id.
'"></td>';
349if (!empty($arrayfields[
'cpl.date_action'][
'checked'])) {
350 print
'<td class="liste_titre center">';
351 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.dol_escape_htmltag($search_month ? (
string) $search_month :
'').
'">';
352 print $formother->selectyear($search_year,
'search_year', 1, 10, 5, 0, 0,
'',
'valignmiddle width75',
true);
357if (!empty($arrayfields[
'cpl.fk_user_action'][
'checked'])) {
359 $excludefilter = $user->admin ?
'' :
'u.rowid <> '.((int) $user->id);
360 $valideurobjects = $validator->listUsersForGroup($excludefilter, 1);
361 $valideurarray = array();
362 foreach ($valideurobjects as $val) {
363 $valideurarray[$val] = $val;
366 print
'<td class="liste_titre">';
367 print $form->select_dolusers($search_validator,
"search_validator", 1,
null, 0, $valideurarray,
'',
'0', 0, 0, $morefilter, 0,
'',
'maxwidth200');
372if (!empty($arrayfields[
'cpl.fk_user_update'][
'checked'])) {
373 print
'<td class="liste_titre">';
374 print $form->select_dolusers($search_employee,
"search_employee", 1,
null, $disabled, $include,
'',
'0', 0, 0, $morefilter, 0,
'',
'maxwidth200');
379if (!empty($arrayfields[
'cpl.type_action'][
'checked'])) {
380 print
'<td class="liste_titre">';
381 print
'<input type="text" class="maxwidth50" name="search_description" value="'.$search_description.
'">';
386if (!empty($arrayfields[
'cpl.fk_type'][
'checked'])) {
387 $arraytypeleaves = array();
388 foreach ($alltypeleaves as $key => $val) {
389 $labeltoshow = ($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']);
390 $arraytypeleaves[$val[
'rowid']] = $labeltoshow;
393 print
'<td class="liste_titre">';
394 print $form->selectarray(
'search_type', $arraytypeleaves, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'', 1);
399if (!empty($arrayfields[
'cpl.prev_solde'][
'checked'])) {
400 print
'<td class="liste_titre right">';
401 print
'<input type="text" class="maxwidth50" name="search_prev_solde" value="'.$search_prev_solde.
'">';
406if (!empty($arrayfields[
'variation'][
'checked'])) {
407 print
'<td class="liste_titre"></td>';
411if (!empty($arrayfields[
'cpl.new_solde'][
'checked'])) {
412 print
'<td class="liste_titre right">';
413 print
'<input type="text" class="maxwidth50" name="search_new_solde" value="'.$search_new_solde.
'">';
419 print
'<td class="liste_titre maxwidthsearch">';
420 $searchpicto = $form->showFilterButtons();
426print
'<tr class="liste_titre">';
429 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
431if (!empty($arrayfields[
'cpl.rowid'][
'checked'])) {
432 print_liste_field_titre($arrayfields[
'cpl.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'cpl.rowid',
'',
'',
'', $sortfield, $sortorder);
434if (!empty($arrayfields[
'cpl.date_action'][
'checked'])) {
435 print_liste_field_titre($arrayfields[
'cpl.date_action'][
'label'], $_SERVER[
"PHP_SELF"],
'date_action',
'',
'',
'', $sortfield, $sortorder,
'center ');
437if (!empty($arrayfields[
'cpl.fk_user_action'][
'checked'])) {
438 print_liste_field_titre($arrayfields[
'cpl.fk_user_action'][
'label'], $_SERVER[
"PHP_SELF"],
'fk_user_action',
'',
'',
'', $sortfield, $sortorder);
440if (!empty($arrayfields[
'cpl.fk_user_update'][
'checked'])) {
441 print_liste_field_titre($arrayfields[
'cpl.fk_user_update'][
'label'], $_SERVER[
"PHP_SELF"],
'fk_user_update',
'',
'',
'', $sortfield, $sortorder);
443if (!empty($arrayfields[
'cpl.type_action'][
'checked'])) {
444 print_liste_field_titre($arrayfields[
'cpl.type_action'][
'label'], $_SERVER[
"PHP_SELF"],
'type_action',
'',
'',
'', $sortfield, $sortorder);
446if (!empty($arrayfields[
'cpl.fk_type'][
'checked'])) {
447 print_liste_field_titre($arrayfields[
'cpl.fk_type'][
'label'], $_SERVER[
"PHP_SELF"],
'fk_type',
'',
'',
'', $sortfield, $sortorder);
449if (!empty($arrayfields[
'cpl.prev_solde'][
'checked'])) {
450 print_liste_field_titre($arrayfields[
'cpl.prev_solde'][
'label'], $_SERVER[
"PHP_SELF"],
'prev_solde',
'',
'',
'', $sortfield, $sortorder,
'right ');
452if (!empty($arrayfields[
'variation'][
'checked'])) {
453 print_liste_field_titre($arrayfields[
'variation'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'right ');
455if (!empty($arrayfields[
'cpl.new_solde'][
'checked'])) {
456 print_liste_field_titre($arrayfields[
'cpl.new_solde'][
'label'], $_SERVER[
"PHP_SELF"],
'new_solde',
'',
'',
'', $sortfield, $sortorder,
'right ');
460 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
466while ($j < ($page * $limit)) {
472while ($i < min($num, $limit)) {
479 $holidaylogstatic->id = (int) $obj[
'rowid'];
480 $holidaylogstatic->date = (string) $obj[
'date_action'];
481 $holidaylogstatic->validator = (int) $obj[
'fk_user_action'];
482 $holidaylogstatic->employee = (int) $obj[
'fk_user_update'];
483 $holidaylogstatic->description = (string) $obj[
'type_action'];
484 $holidaylogstatic->type = (int) $obj[
'fk_type'];
485 $holidaylogstatic->balance_previous = (float) $obj[
'prev_solde'];
486 $holidaylogstatic->balance_new = (float) $obj[
'new_solde'];
488 print
'<tr class="oddeven">';
496 if (!empty($arrayfields[
'cpl.rowid'][
'checked'])) {
497 print
'<td>'.$holidaylogstatic->id.
'</td>';
501 if (!empty($arrayfields[
'cpl.date_action'][
'checked'])) {
502 print
'<td style="text-align: center">'.$holidaylogstatic->date.
'</td>';
506 if (!empty($arrayfields[
'cpl.fk_user_action'][
'checked'])) {
507 $user_action =
new User($db);
508 $user_action->fetch($holidaylogstatic->validator);
509 print
'<td>'.$user_action->getNomUrl(-1).
'</td>';
513 if (!empty($arrayfields[
'cpl.fk_user_update'][
'checked'])) {
514 $user_update =
new User($db);
515 $user_update->fetch($holidaylogstatic->employee);
516 print
'<td>'.$user_update->getNomUrl(-1).
'</td>';
520 if (!empty($arrayfields[
'cpl.type_action'][
'checked'])) {
521 print
'<td class="tdoverflowmax400" title="'.dol_escape_htmltag($holidaylogstatic->description).
'">'.
dol_escape_htmltag($holidaylogstatic->description).
'</td>';
525 if (!empty($arrayfields[
'cpl.fk_type'][
'checked'])) {
527 if (!empty($alltypeleaves[$holidaylogstatic->type])) {
528 if ($alltypeleaves[$holidaylogstatic->type][
'code'] && $langs->trans($alltypeleaves[$holidaylogstatic->type][
'code']) != $alltypeleaves[$holidaylogstatic->type][
'code']) {
529 $label = $langs->trans($alltypeleaves[$holidaylogstatic->type][
'code']);
531 $label = $alltypeleaves[$holidaylogstatic->type][
'label'];
536 print $label ? $label : $holidaylogstatic->type;
541 if (!empty($arrayfields[
'cpl.prev_solde'][
'checked'])) {
542 print
'<td style="text-align: right;">'.price2num($holidaylogstatic->balance_previous, 5).
' '.$langs->trans(
'days').
'</td>';
546 if (!empty($arrayfields[
'variation'][
'checked'])) {
547 $delta =
price2num($holidaylogstatic->balance_new - $holidaylogstatic->balance_previous, 5);
548 print
'<td style="text-align: right;">';
550 print
'<span class="stockmovemententry fontsizeunset">+'.$delta.
'</span>';
552 print
'<span class="stockmovementexit fontsizeunset">'.$delta.
'</span>';
558 if (!empty($arrayfields[
'cpl.new_solde'][
'checked'])) {
559 print
'<td style="text-align: right;">'.price2num($holidaylogstatic->balance_new, 5).
' '.$langs->trans(
'days').
'</td>';
573if ($log_holiday ==
'2') {
575 print
'<td colspan="10"><span class="opacitymedium">'.$langs->trans(
'NoRecordFound').
'</span></td>';
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.
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show 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, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
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, $sqltoadd='')
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.
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.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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.