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';
51$langs->loadLangs(array(
'users',
'other',
'holiday'));
53$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
54$massaction =
GETPOST(
'massaction',
'alpha');
55$mode =
GETPOST(
'mode',
'alpha');
57$confirm =
GETPOST(
'confirm',
'alpha');
58$cancel =
GETPOST(
'cancel',
'alpha');
59$toselect =
GETPOST(
'toselect',
'array');
60$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'myobjectlist';
61$backtopage =
GETPOST(
'backtopage',
'alpha');
62$optioncss =
GETPOST(
'optioncss',
'aZ');
64$search_id =
GETPOST(
'search_id',
'alphanohtml');
67$search_employee =
GETPOST(
'search_employee',
"intcomma");
68$search_validator =
GETPOST(
'search_validator',
"intcomma");
69$search_description =
GETPOST(
'search_description',
'alphanohtml');
70$search_type =
GETPOST(
'search_type',
"intcomma");
71$search_prev_solde =
GETPOST(
'search_prev_solde',
'alphanohtml');
72$search_new_solde =
GETPOST(
'search_new_solde',
'alphanohtml');
76$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
77$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
79if (empty($page) || $page == -1 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') || (empty($toselect) && $massaction ===
'0')) {
82$offset = $limit * $page;
86 $sortfield =
"cpl.rowid";
96$hookmanager->initHooks(array(
'leavemovementlist'));
98$arrayfields = array();
99$arrayofmassactions = array();
101if (!isModEnabled(
'holiday')) {
106if (!$user->hasRight(
'holiday',
'readall')) {
115if (
GETPOST(
'cancel',
'alpha')) {
119if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
123$parameters = array();
124$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
129if (empty($reshook)) {
131 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
134 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
138 $search_employee =
'';
139 $search_validator =
'';
140 $search_description =
'';
142 $search_prev_solde =
'';
143 $search_new_solde =
'';
145 $search_array_options = array();
148 if (
GETPOST(
'button_removefilter_x',
'alpha')
149 ||
GETPOST(
'button_removefilter.x',
'alpha')
150 ||
GETPOST(
'button_removefilter',
'alpha')
151 ||
GETPOST(
'button_search_x',
'alpha')
152 ||
GETPOST(
'button_search.x',
'alpha')
153 ||
GETPOST(
'button_search',
'alpha')) {
170 'cpl.rowid' => array(
'label' =>
"ID",
'checked' => 1),
171 'cpl.date_action' => array(
'label' =>
"Date",
'checked' => 1),
172 'cpl.fk_user_action' => array(
'label' =>
"ActionByCP",
'checked' => 1),
173 'cpl.fk_user_update' => array(
'label' =>
"UserUpdateCP",
'checked' => 1),
174 'cpl.type_action' => array(
'label' =>
"Description",
'checked' => 1),
175 'cpl.fk_type' => array(
'label' =>
"Type",
'checked' => 1),
176 'cpl.prev_solde' => array(
'label' =>
"PrevSoldeCP",
'checked' => 1),
177 'variation' => array(
'label' =>
"Variation",
'checked' => 1),
178 'cpl.new_solde' => array(
'label' =>
"NewSoldeCP",
'checked' => 1),
186$form =
new Form($db);
189$alltypeleaves =
$object->getTypes(1, -1);
191$title = $langs->trans(
'CPTitreMenu');
192$help_url =
'EN:Module_Holiday';
194llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-holiday page-view_log');
198if (!empty($search_year) && $search_year > 0) {
199 if (!empty($search_month) && $search_month > 0) {
207 $sqlwhere .=
"AND date_action BETWEEN '".$db->idate($from_date).
"' AND '".$db->idate($to_date).
"'";
210if (!empty($search_id) && $search_id > 0) {
213if (!empty($search_validator) && $search_validator > 0) {
214 $sqlwhere .=
natural_search(
'fk_user_action', $search_validator, 1);
216if (!empty($search_employee) && $search_employee > 0) {
217 $sqlwhere .=
natural_search(
'fk_user_update', $search_employee, 1);
219if (!empty($search_description)) {
222if (!empty($search_type) && $search_type > 0) {
225if (!empty($search_prev_solde)) {
228if (!empty($search_new_solde)) {
232$sqlorder = $db->order($sortfield, $sortorder);
235$log_holiday =
$object->fetchLog($sqlorder, $sqlwhere);
238$nbtotalofrecords =
'';
242 $nbtotalofrecords = is_array(
$object->logs) ? count(
$object->logs) : 0;
244 if (($page * $limit) > $nbtotalofrecords) {
254if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
255 $param .=
'&contextpage='.urlencode($contextpage);
257if ($limit > 0 && $limit !=
$conf->liste_limit) {
258 $param .=
'&limit='.((int) $limit);
260if (!empty($search_id)) {
261 $param .=
'&search_status='.urlencode($search_status);
263if (!empty($search_month) && $search_month > 0) {
264 $param .=
'&search_month='.urlencode((
string) ($search_month));
266if (!empty($search_year) && $search_year > 0) {
267 $param .=
'&search_year='.urlencode((
string) ($search_year));
269if (!empty($search_validator) && $search_validator > 0) {
270 $param .=
'&search_validator='.urlencode((
string) ($search_validator));
272if (!empty($search_employee) && $search_employee > 0) {
273 $param .=
'&search_employee='.urlencode((
string) ($search_employee));
275if (!empty($search_description)) {
276 $param .=
'&search_description='.urlencode($search_description);
278if (!empty($search_type) && $search_type > 0) {
279 $param .=
'&search_type='.urlencode((
string) ($search_type));
281if (!empty($search_prev_solde)) {
282 $param .=
'&search_prev_solde='.urlencode($search_prev_solde);
284if (!empty($search_new_solde)) {
285 $param .=
'&search_new_solde='.urlencode($search_new_solde);
288print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
289if ($optioncss !=
'') {
290 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
292print
'<input type="hidden" name="token" value="'.newToken().
'">';
293print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
294print
'<input type="hidden" name="action" value="list">';
295print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
296print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
297print
'<input type="hidden" name="page" value="'.$page.
'">';
298print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
300$newcardbutton =
dolGetButtonTitle($langs->trans(
'MenuAddCP'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/holiday/card.php?action=create',
'', $user->hasRight(
'holiday',
'write'));
302print_barre_liste($langs->trans(
'LogCP'), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'title_hrm', 0, $newcardbutton,
'', $limit, 0, 0, 1);
304print
'<div class="info">'.$langs->trans(
'LastUpdateCP').
': ';
306$lastUpdate =
$object->getConfCP(
'lastUpdate');
308 $monthLastUpdate = $lastUpdate[4].$lastUpdate[5];
309 $yearLastUpdate = $lastUpdate[0].$lastUpdate[1].$lastUpdate[2].$lastUpdate[3];
310 print
'<strong>'.dol_print_date($db->jdate(
$object->getConfCP(
'lastUpdate')),
'dayhour',
'tzuser').
'</strong>';
312 print $langs->trans(
"MonthOfLastMonthlyUpdate").
': <strong>'.$yearLastUpdate.
'-'.$monthLastUpdate.
'</strong>';
314 print $langs->trans(
'None');
324$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
325$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
326$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
327$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
329print
'<div class="div-table-responsive">';
330print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'" id="tablelines3">';
332print
'<tr class="liste_titre_filter">';
336 print
'<td class="liste_titre maxwidthsearch">';
337 $searchpicto = $form->showFilterButtons();
343if (!empty($arrayfields[
'cpl.rowid'][
'checked'])) {
344 print
'<td class="liste_titre"><input type="text" class="maxwidth50" name="search_id" value="'.$search_id.
'"></td>';
348if (!empty($arrayfields[
'cpl.date_action'][
'checked'])) {
349 print
'<td class="liste_titre center">';
350 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.dol_escape_htmltag($search_month ? (
string) $search_month :
'').
'">';
351 print $formother->selectyear($search_year,
'search_year', 1, 10, 5, 0, 0,
'',
'valignmiddle width75',
true);
356if (!empty($arrayfields[
'cpl.fk_user_action'][
'checked'])) {
358 $excludefilter = $user->admin ?
'' :
'u.rowid <> '.((int) $user->id);
359 $valideurobjects = $validator->listUsersForGroup($excludefilter, 1);
360 $valideurarray = array();
361 foreach ($valideurobjects as $val) {
362 $valideurarray[$val] = $val;
365 print
'<td class="liste_titre">';
366 print $form->select_dolusers($search_validator,
"search_validator", 1,
"", 0, $valideurarray,
'', 0, 0, 0, $morefilter, 0,
'',
'maxwidth200');
371if (!empty($arrayfields[
'cpl.fk_user_update'][
'checked'])) {
372 print
'<td class="liste_titre">';
373 print $form->select_dolusers($search_employee,
"search_employee", 1,
"", $disabled, $include,
'', 0, 0, 0, $morefilter, 0,
'',
'maxwidth200');
378if (!empty($arrayfields[
'cpl.type_action'][
'checked'])) {
379 print
'<td class="liste_titre">';
380 print
'<input type="text" class="maxwidth50" name="search_description" value="'.$search_description.
'">';
385if (!empty($arrayfields[
'cpl.fk_type'][
'checked'])) {
386 $arraytypeleaves = array();
387 foreach ($alltypeleaves as $key => $val) {
388 $labeltoshow = ($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']);
389 $arraytypeleaves[$val[
'rowid']] = $labeltoshow;
392 print
'<td class="liste_titre">';
393 print $form->selectarray(
'search_type', $arraytypeleaves, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'', 1);
398if (!empty($arrayfields[
'cpl.prev_solde'][
'checked'])) {
399 print
'<td class="liste_titre right">';
400 print
'<input type="text" class="maxwidth50" name="search_prev_solde" value="'.$search_prev_solde.
'">';
405if (!empty($arrayfields[
'variation'][
'checked'])) {
406 print
'<td class="liste_titre"></td>';
410if (!empty($arrayfields[
'cpl.new_solde'][
'checked'])) {
411 print
'<td class="liste_titre right">';
412 print
'<input type="text" class="maxwidth50" name="search_new_solde" value="'.$search_new_solde.
'">';
418 print
'<td class="liste_titre maxwidthsearch">';
419 $searchpicto = $form->showFilterButtons();
425print
'<tr class="liste_titre">';
428 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
430if (!empty($arrayfields[
'cpl.rowid'][
'checked'])) {
431 print_liste_field_titre($arrayfields[
'cpl.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'cpl.rowid',
'',
'',
'', $sortfield, $sortorder);
433if (!empty($arrayfields[
'cpl.date_action'][
'checked'])) {
434 print_liste_field_titre($arrayfields[
'cpl.date_action'][
'label'], $_SERVER[
"PHP_SELF"],
'date_action',
'',
'',
'', $sortfield, $sortorder,
'center ');
436if (!empty($arrayfields[
'cpl.fk_user_action'][
'checked'])) {
437 print_liste_field_titre($arrayfields[
'cpl.fk_user_action'][
'label'], $_SERVER[
"PHP_SELF"],
'fk_user_action',
'',
'',
'', $sortfield, $sortorder);
439if (!empty($arrayfields[
'cpl.fk_user_update'][
'checked'])) {
440 print_liste_field_titre($arrayfields[
'cpl.fk_user_update'][
'label'], $_SERVER[
"PHP_SELF"],
'fk_user_update',
'',
'',
'', $sortfield, $sortorder);
442if (!empty($arrayfields[
'cpl.type_action'][
'checked'])) {
443 print_liste_field_titre($arrayfields[
'cpl.type_action'][
'label'], $_SERVER[
"PHP_SELF"],
'type_action',
'',
'',
'', $sortfield, $sortorder);
445if (!empty($arrayfields[
'cpl.fk_type'][
'checked'])) {
446 print_liste_field_titre($arrayfields[
'cpl.fk_type'][
'label'], $_SERVER[
"PHP_SELF"],
'fk_type',
'',
'',
'', $sortfield, $sortorder);
448if (!empty($arrayfields[
'cpl.prev_solde'][
'checked'])) {
449 print_liste_field_titre($arrayfields[
'cpl.prev_solde'][
'label'], $_SERVER[
"PHP_SELF"],
'prev_solde',
'',
'',
'', $sortfield, $sortorder,
'right ');
451if (!empty($arrayfields[
'variation'][
'checked'])) {
452 print_liste_field_titre($arrayfields[
'variation'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'right ');
454if (!empty($arrayfields[
'cpl.new_solde'][
'checked'])) {
455 print_liste_field_titre($arrayfields[
'cpl.new_solde'][
'label'], $_SERVER[
"PHP_SELF"],
'new_solde',
'',
'',
'', $sortfield, $sortorder,
'right ');
459 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
465while ($j < ($page * $limit)) {
471while ($i < min($num, $limit)) {
478 $holidaylogstatic->id = $obj[
'rowid'];
479 $holidaylogstatic->date = $obj[
'date_action'];
480 $holidaylogstatic->validator = $obj[
'fk_user_action'];
481 $holidaylogstatic->employee = $obj[
'fk_user_update'];
482 $holidaylogstatic->description = $obj[
'type_action'];
483 $holidaylogstatic->type = $obj[
'fk_type'];
484 $holidaylogstatic->balance_previous = $obj[
'prev_solde'];
485 $holidaylogstatic->balance_new = $obj[
'new_solde'];
487 print
'<tr class="oddeven">';
495 if (!empty($arrayfields[
'cpl.rowid'][
'checked'])) {
496 print
'<td>'.$holidaylogstatic->id.
'</td>';
500 if (!empty($arrayfields[
'cpl.date_action'][
'checked'])) {
501 print
'<td style="text-align: center">'.$holidaylogstatic->date.
'</td>';
505 if (!empty($arrayfields[
'cpl.fk_user_action'][
'checked'])) {
506 $user_action =
new User($db);
507 $user_action->fetch($holidaylogstatic->validator);
508 print
'<td>'.$user_action->getNomUrl(-1).
'</td>';
512 if (!empty($arrayfields[
'cpl.fk_user_update'][
'checked'])) {
513 $user_update =
new User($db);
514 $user_update->fetch($holidaylogstatic->employee);
515 print
'<td>'.$user_update->getNomUrl(-1).
'</td>';
519 if (!empty($arrayfields[
'cpl.type_action'][
'checked'])) {
520 print
'<td class="tdoverflowmax400" title="'.dol_escape_htmltag($holidaylogstatic->description).
'">'.
dol_escape_htmltag($holidaylogstatic->description).
'</td>';
524 if (!empty($arrayfields[
'cpl.fk_type'][
'checked'])) {
526 if (!empty($alltypeleaves[$holidaylogstatic->type])) {
527 if ($alltypeleaves[$holidaylogstatic->type][
'code'] && $langs->trans($alltypeleaves[$holidaylogstatic->type][
'code']) != $alltypeleaves[$holidaylogstatic->type][
'code']) {
528 $label = $langs->trans($alltypeleaves[$holidaylogstatic->type][
'code']);
530 $label = $alltypeleaves[$holidaylogstatic->type][
'label'];
535 print $label ? $label : $holidaylogstatic->type;
540 if (!empty($arrayfields[
'cpl.prev_solde'][
'checked'])) {
541 print
'<td style="text-align: right;">'.price2num($holidaylogstatic->balance_previous, 5).
' '.$langs->trans(
'days').
'</td>';
545 if (!empty($arrayfields[
'variation'][
'checked'])) {
546 $delta =
price2num($holidaylogstatic->balance_new - $holidaylogstatic->balance_previous, 5);
547 print
'<td style="text-align: right;">';
549 print
'<span class="stockmovemententry fontsizeunset">+'.$delta.
'</span>';
551 print
'<span class="stockmovementexit fontsizeunset">'.$delta.
'</span>';
557 if (!empty($arrayfields[
'cpl.new_solde'][
'checked'])) {
558 print
'<td style="text-align: right;">'.price2num($holidaylogstatic->balance_new, 5).
' '.$langs->trans(
'days').
'</td>';
572if ($log_holiday ==
'2') {
574 print
'<td colspan="10"><span class="opacitymedium">'.$langs->trans(
'NoRecordFound').
'</span></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($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_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)
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.
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.
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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.