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');
184$help_url =
'EN:Module_Holiday';
186llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-holiday page-view_log');
190if (!empty($search_year) && $search_year > 0) {
191 if (!empty($search_month) && $search_month > 0) {
199 $sqlwhere .=
"AND date_action BETWEEN '".$db->idate($from_date).
"' AND '".$db->idate($to_date).
"'";
202if (!empty($search_id) && $search_id > 0) {
205if (!empty($search_validator) && $search_validator > 0) {
206 $sqlwhere .=
natural_search(
'fk_user_action', $search_validator, 1);
208if (!empty($search_employee) && $search_employee > 0) {
209 $sqlwhere .=
natural_search(
'fk_user_update', $search_employee, 1);
211if (!empty($search_description)) {
214if (!empty($search_type) && $search_type > 0) {
217if (!empty($search_prev_solde)) {
220if (!empty($search_new_solde)) {
224$sqlorder = $db->order($sortfield, $sortorder);
227$log_holiday =
$object->fetchLog($sqlorder, $sqlwhere);
230$nbtotalofrecords =
'';
234 $nbtotalofrecords = is_array(
$object->logs) ? count(
$object->logs) : 0;
236 if (($page * $limit) > $nbtotalofrecords) {
246if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
247 $param .=
'&contextpage='.urlencode($contextpage);
249if ($limit > 0 && $limit != $conf->liste_limit) {
250 $param .=
'&limit='.((int) $limit);
252if (!empty($search_id)) {
253 $param .=
'&search_status='.urlencode($search_status);
255if (!empty($search_month) && $search_month > 0) {
256 $param .=
'&search_month='.urlencode((
string) ($search_month));
258if (!empty($search_year) && $search_year > 0) {
259 $param .=
'&search_year='.urlencode((
string) ($search_year));
261if (!empty($search_validator) && $search_validator > 0) {
262 $param .=
'&search_validator='.urlencode((
string) ($search_validator));
264if (!empty($search_employee) && $search_employee > 0) {
265 $param .=
'&search_employee='.urlencode((
string) ($search_employee));
267if (!empty($search_description)) {
268 $param .=
'&search_description='.urlencode($search_description);
270if (!empty($search_type) && $search_type > 0) {
271 $param .=
'&search_type='.urlencode((
string) ($search_type));
273if (!empty($search_prev_solde)) {
274 $param .=
'&search_prev_solde='.urlencode($search_prev_solde);
276if (!empty($search_new_solde)) {
277 $param .=
'&search_new_solde='.urlencode($search_new_solde);
280print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
281if ($optioncss !=
'') {
282 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
284print
'<input type="hidden" name="token" value="'.newToken().
'">';
285print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
286print
'<input type="hidden" name="action" value="list">';
287print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
288print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
289print
'<input type="hidden" name="page" value="'.$page.
'">';
290print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
292$newcardbutton =
dolGetButtonTitle($langs->trans(
'MenuAddCP'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/holiday/card.php?action=create',
'', $user->hasRight(
'holiday',
'write'));
294print_barre_liste($langs->trans(
'LogCP'), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'title_hrm', 0, $newcardbutton,
'', $limit, 0, 0, 1);
296print
'<div class="info">'.$langs->trans(
'LastUpdateCP').
': ';
298$lastUpdate =
$object->getConfCP(
'lastUpdate');
300 $monthLastUpdate = $lastUpdate[4].$lastUpdate[5];
301 $yearLastUpdate = $lastUpdate[0].$lastUpdate[1].$lastUpdate[2].$lastUpdate[3];
302 print
'<strong>'.dol_print_date($db->jdate(
$object->getConfCP(
'lastUpdate')),
'dayhour',
'tzuser').
'</strong>';
304 print $langs->trans(
"MonthOfLastMonthlyUpdate").
': <strong>'.$yearLastUpdate.
'-'.$monthLastUpdate.
'</strong>';
306 print $langs->trans(
'None');
316$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
317$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
318$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
319$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
321print
'<div class="div-table-responsive">';
322print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'" id="tablelines3">';
324print
'<tr class="liste_titre_filter">';
328 print
'<td class="liste_titre maxwidthsearch">';
329 $searchpicto = $form->showFilterButtons();
335if (!empty($arrayfields[
'cpl.rowid'][
'checked'])) {
336 print
'<td class="liste_titre"><input type="text" class="maxwidth50" name="search_id" value="'.$search_id.
'"></td>';
340if (!empty($arrayfields[
'cpl.date_action'][
'checked'])) {
341 print
'<td class="liste_titre center">';
342 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.dol_escape_htmltag($search_month ? (
string) $search_month :
'').
'">';
343 print $formother->selectyear($search_year,
'search_year', 1, 10, 5, 0, 0,
'',
'valignmiddle width75',
true);
348if (!empty($arrayfields[
'cpl.fk_user_action'][
'checked'])) {
350 $excludefilter = $user->admin ?
'' :
'u.rowid <> '.((int) $user->id);
351 $valideurobjects = $validator->listUsersForGroup($excludefilter, 1);
352 $valideurarray = array();
353 foreach ($valideurobjects as $val) {
354 $valideurarray[$val] = $val;
357 print
'<td class="liste_titre">';
358 print $form->select_dolusers($search_validator,
"search_validator", 1,
"", 0, $valideurarray,
'', 0, 0, 0, $morefilter, 0,
'',
'maxwidth200');
363if (!empty($arrayfields[
'cpl.fk_user_update'][
'checked'])) {
364 print
'<td class="liste_titre">';
365 print $form->select_dolusers($search_employee,
"search_employee", 1,
"", $disabled, $include,
'', 0, 0, 0, $morefilter, 0,
'',
'maxwidth200');
370if (!empty($arrayfields[
'cpl.type_action'][
'checked'])) {
371 print
'<td class="liste_titre">';
372 print
'<input type="text" class="maxwidth50" name="search_description" value="'.$search_description.
'">';
377if (!empty($arrayfields[
'cpl.fk_type'][
'checked'])) {
378 $arraytypeleaves = array();
379 foreach ($alltypeleaves as $key => $val) {
380 $labeltoshow = ($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']);
381 $arraytypeleaves[$val[
'rowid']] = $labeltoshow;
384 print
'<td class="liste_titre">';
385 print $form->selectarray(
'search_type', $arraytypeleaves, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'', 1);
390if (!empty($arrayfields[
'cpl.prev_solde'][
'checked'])) {
391 print
'<td class="liste_titre right">';
392 print
'<input type="text" class="maxwidth50" name="search_prev_solde" value="'.$search_prev_solde.
'">';
397if (!empty($arrayfields[
'variation'][
'checked'])) {
398 print
'<td class="liste_titre"></td>';
402if (!empty($arrayfields[
'cpl.new_solde'][
'checked'])) {
403 print
'<td class="liste_titre right">';
404 print
'<input type="text" class="maxwidth50" name="search_new_solde" value="'.$search_new_solde.
'">';
410 print
'<td class="liste_titre maxwidthsearch">';
411 $searchpicto = $form->showFilterButtons();
417print
'<tr class="liste_titre">';
420 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
422if (!empty($arrayfields[
'cpl.rowid'][
'checked'])) {
423 print_liste_field_titre($arrayfields[
'cpl.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'cpl.rowid',
'',
'',
'', $sortfield, $sortorder);
425if (!empty($arrayfields[
'cpl.date_action'][
'checked'])) {
426 print_liste_field_titre($arrayfields[
'cpl.date_action'][
'label'], $_SERVER[
"PHP_SELF"],
'date_action',
'',
'',
'', $sortfield, $sortorder,
'center ');
428if (!empty($arrayfields[
'cpl.fk_user_action'][
'checked'])) {
429 print_liste_field_titre($arrayfields[
'cpl.fk_user_action'][
'label'], $_SERVER[
"PHP_SELF"],
'fk_user_action',
'',
'',
'', $sortfield, $sortorder);
431if (!empty($arrayfields[
'cpl.fk_user_update'][
'checked'])) {
432 print_liste_field_titre($arrayfields[
'cpl.fk_user_update'][
'label'], $_SERVER[
"PHP_SELF"],
'fk_user_update',
'',
'',
'', $sortfield, $sortorder);
434if (!empty($arrayfields[
'cpl.type_action'][
'checked'])) {
435 print_liste_field_titre($arrayfields[
'cpl.type_action'][
'label'], $_SERVER[
"PHP_SELF"],
'type_action',
'',
'',
'', $sortfield, $sortorder);
437if (!empty($arrayfields[
'cpl.fk_type'][
'checked'])) {
438 print_liste_field_titre($arrayfields[
'cpl.fk_type'][
'label'], $_SERVER[
"PHP_SELF"],
'fk_type',
'',
'',
'', $sortfield, $sortorder);
440if (!empty($arrayfields[
'cpl.prev_solde'][
'checked'])) {
441 print_liste_field_titre($arrayfields[
'cpl.prev_solde'][
'label'], $_SERVER[
"PHP_SELF"],
'prev_solde',
'',
'',
'', $sortfield, $sortorder,
'right ');
443if (!empty($arrayfields[
'variation'][
'checked'])) {
444 print_liste_field_titre($arrayfields[
'variation'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'right ');
446if (!empty($arrayfields[
'cpl.new_solde'][
'checked'])) {
447 print_liste_field_titre($arrayfields[
'cpl.new_solde'][
'label'], $_SERVER[
"PHP_SELF"],
'new_solde',
'',
'',
'', $sortfield, $sortorder,
'right ');
451 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
457while ($j < ($page * $limit)) {
463while ($i < min($num, $limit)) {
470 $holidaylogstatic->id = $obj[
'rowid'];
471 $holidaylogstatic->date = $obj[
'date_action'];
472 $holidaylogstatic->validator = $obj[
'fk_user_action'];
473 $holidaylogstatic->employee = $obj[
'fk_user_update'];
474 $holidaylogstatic->description = $obj[
'type_action'];
475 $holidaylogstatic->type = $obj[
'fk_type'];
476 $holidaylogstatic->balance_previous = $obj[
'prev_solde'];
477 $holidaylogstatic->balance_new = $obj[
'new_solde'];
479 print
'<tr class="oddeven">';
487 if (!empty($arrayfields[
'cpl.rowid'][
'checked'])) {
488 print
'<td>'.$holidaylogstatic->id.
'</td>';
492 if (!empty($arrayfields[
'cpl.date_action'][
'checked'])) {
493 print
'<td style="text-align: center">'.$holidaylogstatic->date.
'</td>';
497 if (!empty($arrayfields[
'cpl.fk_user_action'][
'checked'])) {
498 $user_action =
new User($db);
499 $user_action->fetch($holidaylogstatic->validator);
500 print
'<td>'.$user_action->getNomUrl(-1).
'</td>';
504 if (!empty($arrayfields[
'cpl.fk_user_update'][
'checked'])) {
505 $user_update =
new User($db);
506 $user_update->fetch($holidaylogstatic->employee);
507 print
'<td>'.$user_update->getNomUrl(-1).
'</td>';
511 if (!empty($arrayfields[
'cpl.type_action'][
'checked'])) {
512 print
'<td class="tdoverflowmax400" title="'.dol_escape_htmltag($holidaylogstatic->description).
'">'.
dol_escape_htmltag($holidaylogstatic->description).
'</td>';
516 if (!empty($arrayfields[
'cpl.fk_type'][
'checked'])) {
518 if (!empty($alltypeleaves[$holidaylogstatic->type])) {
519 if ($alltypeleaves[$holidaylogstatic->type][
'code'] && $langs->trans($alltypeleaves[$holidaylogstatic->type][
'code']) != $alltypeleaves[$holidaylogstatic->type][
'code']) {
520 $label = $langs->trans($alltypeleaves[$holidaylogstatic->type][
'code']);
522 $label = $alltypeleaves[$holidaylogstatic->type][
'label'];
527 print $label ? $label : $holidaylogstatic->type;
532 if (!empty($arrayfields[
'cpl.prev_solde'][
'checked'])) {
533 print
'<td style="text-align: right;">'.price2num($holidaylogstatic->balance_previous, 5).
' '.$langs->trans(
'days').
'</td>';
537 if (!empty($arrayfields[
'variation'][
'checked'])) {
538 $delta =
price2num($holidaylogstatic->balance_new - $holidaylogstatic->balance_previous, 5);
539 print
'<td style="text-align: right;">';
541 print
'<span class="stockmovemententry fontsizeunset">+'.$delta.
'</span>';
543 print
'<span class="stockmovementexit fontsizeunset">'.$delta.
'</span>';
549 if (!empty($arrayfields[
'cpl.new_solde'][
'checked'])) {
550 print
'<td style="text-align: right;">'.price2num($holidaylogstatic->balance_new, 5).
' '.$langs->trans(
'days').
'</td>';
564if ($log_holiday ==
'2') {
566 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...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.