31require
'../main.inc.php';
43if (!$user->hasRight(
'holiday',
'define_holiday') || $user->socid > 0) {
47require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
53$langs->loadLangs(array(
'users',
'other',
'holiday'));
55$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
56$massaction =
GETPOST(
'massaction',
'alpha');
57$mode =
GETPOST(
'mode',
'alpha');
59$confirm =
GETPOST(
'confirm',
'alpha');
60$cancel =
GETPOST(
'cancel',
'alpha');
61$toselect =
GETPOST(
'toselect',
'array:int');
62$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'myobjectlist';
63$backtopage =
GETPOST(
'backtopage',
'alpha');
64$optioncss =
GETPOST(
'optioncss',
'aZ');
66$search_id =
GETPOST(
'search_id',
'alphanohtml');
69$search_employee =
GETPOST(
'search_employee',
"intcomma");
70$search_validator =
GETPOST(
'search_validator',
"intcomma");
71$search_description =
GETPOST(
'search_description',
'alphanohtml');
72$search_type =
GETPOST(
'search_type',
"intcomma");
73$search_prev_solde =
GETPOST(
'search_prev_solde',
'alphanohtml');
74$search_new_solde =
GETPOST(
'search_new_solde',
'alphanohtml');
78$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
79$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
81if (empty($page) || $page == -1 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') || (empty($toselect) && $massaction ===
'0')) {
84$offset = $limit * $page;
88 $sortfield =
"cpl.rowid";
98$hookmanager->initHooks(array(
'leavemovementlist'));
100$arrayfields = array();
101$arrayofmassactions = array();
108if (!$user->hasRight(
'holiday',
'readall')) {
117if (
GETPOST(
'cancel',
'alpha')) {
121if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
125$parameters = array();
126$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
131if (empty($reshook)) {
133 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
136 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
140 $search_employee =
'';
141 $search_validator =
'';
142 $search_description =
'';
144 $search_prev_solde =
'';
145 $search_new_solde =
'';
147 $search_array_options = array();
150 if (
GETPOST(
'button_removefilter_x',
'alpha')
151 ||
GETPOST(
'button_removefilter.x',
'alpha')
152 ||
GETPOST(
'button_removefilter',
'alpha')
153 ||
GETPOST(
'button_search_x',
'alpha')
154 ||
GETPOST(
'button_search.x',
'alpha')
155 ||
GETPOST(
'button_search',
'alpha')) {
172 'cpl.rowid' => array(
'label' =>
"ID",
'checked' =>
'1'),
173 'cpl.date_action' => array(
'label' =>
"Date",
'checked' =>
'1'),
174 'cpl.fk_user_action' => array(
'label' =>
"ActionByCP",
'checked' =>
'1'),
175 'cpl.fk_user_update' => array(
'label' =>
"UserUpdateCP",
'checked' =>
'1'),
176 'cpl.type_action' => array(
'label' =>
"Description",
'checked' =>
'1'),
177 'cpl.fk_type' => array(
'label' =>
"Type",
'checked' =>
'1'),
178 'cpl.prev_solde' => array(
'label' =>
"PrevSoldeCP",
'checked' =>
'1'),
179 'variation' => array(
'label' =>
"Variation",
'checked' =>
'1'),
180 'cpl.new_solde' => array(
'label' =>
"NewSoldeCP",
'checked' =>
'1'),
191$alltypeleaves =
$object->getTypes(1, -1);
193$title = $langs->trans(
'CPTitreMenu');
194$help_url =
'EN:Module_Holiday';
196llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-holiday page-view_log');
200if (!empty($search_year) && $search_year > 0) {
201 if (!empty($search_month) && $search_month > 0) {
209 $sqlwhere .=
"AND date_action BETWEEN '".$db->idate($from_date).
"' AND '".
$db->idate($to_date).
"'";
212if (!empty($search_id) && $search_id > 0) {
215if (!empty($search_validator) && $search_validator > 0) {
216 $sqlwhere .=
natural_search(
'fk_user_action', $search_validator, 1);
218if (!empty($search_employee) && $search_employee > 0) {
219 $sqlwhere .=
natural_search(
'fk_user_update', $search_employee, 1);
221if (!empty($search_description)) {
224if (!empty($search_type) && $search_type > 0) {
227if (!empty($search_prev_solde)) {
230if (!empty($search_new_solde)) {
234$sqlorder =
$db->order($sortfield, $sortorder);
237$log_holiday =
$object->fetchLog($sqlorder, $sqlwhere);
240$nbtotalofrecords =
'';
244 $nbtotalofrecords = is_array(
$object->logs) ? count(
$object->logs) : 0;
246 if (($page * $limit) > (
int) $nbtotalofrecords) {
256if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
257 $param .=
'&contextpage='.urlencode($contextpage);
259if ($limit > 0 && $limit !=
$conf->liste_limit) {
260 $param .=
'&limit='.((int) $limit);
262if (!empty($search_id)) {
263 $param .=
'&search_id='.urlencode($search_id);
265if (!empty($search_month) && $search_month > 0) {
266 $param .=
'&search_month='.urlencode((
string) ($search_month));
268if (!empty($search_year) && $search_year > 0) {
269 $param .=
'&search_year='.urlencode((
string) ($search_year));
271if (!empty($search_validator) && $search_validator > 0) {
272 $param .=
'&search_validator='.urlencode((
string) ($search_validator));
274if (!empty($search_employee) && $search_employee > 0) {
275 $param .=
'&search_employee='.urlencode((
string) ($search_employee));
277if (!empty($search_description)) {
278 $param .=
'&search_description='.urlencode($search_description);
280if (!empty($search_type) && $search_type > 0) {
281 $param .=
'&search_type='.urlencode((
string) ($search_type));
283if (!empty($search_prev_solde)) {
284 $param .=
'&search_prev_solde='.urlencode($search_prev_solde);
286if (!empty($search_new_solde)) {
287 $param .=
'&search_new_solde='.urlencode($search_new_solde);
290print
'<form method="POST" id="searchFormList" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
291if ($optioncss !=
'') {
292 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
294print
'<input type="hidden" name="token" value="'.newToken().
'">';
295print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
296print
'<input type="hidden" name="action" value="list">';
297print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
298print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
299print
'<input type="hidden" name="page" value="'.$page.
'">';
300print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
302$newcardbutton = dolGetButtonTitle($langs->trans(
'MenuAddCP'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/holiday/card.php?action=create',
'', $user->hasRight(
'holiday',
'write'));
304print_barre_liste($langs->trans(
'LogCP'), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'title_hrm', 0, $newcardbutton,
'', $limit, 0, 0, 1);
306print
'<div class="info">'.$langs->trans(
'LastUpdateCP').
': ';
308$lastUpdate =
$object->getConfCP(
'lastUpdate');
310 $monthLastUpdate = $lastUpdate[4].$lastUpdate[5];
311 $yearLastUpdate = $lastUpdate[0].$lastUpdate[1].$lastUpdate[2].$lastUpdate[3];
312 print
'<strong>'.dol_print_date(
$db->jdate(
$object->getConfCP(
'lastUpdate')),
'dayhour',
'tzuser').
'</strong>';
314 print $langs->trans(
"MonthOfLastMonthlyUpdate").
': <strong>'.$yearLastUpdate.
'-'.$monthLastUpdate.
'</strong>';
316 print $langs->trans(
'None');
326$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
327$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
328$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
329$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
331print
'<div class="div-table-responsive">';
332print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'" id="tablelines3">';
334print
'<tr class="liste_titre_filter">';
337if (
$conf->main_checkbox_left_column) {
338 print
'<td class="liste_titre maxwidthsearch">';
339 $searchpicto = $form->showFilterButtons();
345if (!empty($arrayfields[
'cpl.rowid'][
'checked'])) {
346 print
'<td class="liste_titre"><input type="text" class="maxwidth50" name="search_id" value="'.$search_id.
'"></td>';
350if (!empty($arrayfields[
'cpl.date_action'][
'checked'])) {
351 print
'<td class="liste_titre center">';
352 print
'<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.dol_escape_htmltag($search_month ? (
string) $search_month :
'').
'">';
353 print $formother->selectyear($search_year,
'search_year', 1, 10, 5, 0, 0,
'',
'valignmiddle width75',
true);
358if (!empty($arrayfields[
'cpl.fk_user_action'][
'checked'])) {
360 $excludefilter = $user->admin ?
'' :
'u.rowid <> '.((int) $user->id);
361 $valideurobjects = $validator->listUsersForGroup($excludefilter, 1);
362 $valideurarray = array();
363 foreach ($valideurobjects as $val) {
364 $valideurarray[$val] = $val;
367 print
'<td class="liste_titre">';
368 print $form->select_dolusers($search_validator,
"search_validator", 1,
null, 0, $valideurarray,
'',
'0', 0, 0, $morefilter, 0,
'',
'maxwidth200');
373if (!empty($arrayfields[
'cpl.fk_user_update'][
'checked'])) {
374 print
'<td class="liste_titre">';
375 print $form->select_dolusers($search_employee,
"search_employee", 1,
null, $disabled, $include,
'',
'0', 0, 0, $morefilter, 0,
'',
'maxwidth200');
380if (!empty($arrayfields[
'cpl.type_action'][
'checked'])) {
381 print
'<td class="liste_titre">';
382 print
'<input type="text" class="maxwidth50" name="search_description" value="'.$search_description.
'">';
387if (!empty($arrayfields[
'cpl.fk_type'][
'checked'])) {
388 $arraytypeleaves = array();
389 foreach ($alltypeleaves as $key => $val) {
390 $labeltoshow = ($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']);
391 $arraytypeleaves[$val[
'rowid']] = $labeltoshow;
394 print
'<td class="liste_titre">';
395 print $form->selectarray(
'search_type', $arraytypeleaves, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'', 1);
400if (!empty($arrayfields[
'cpl.prev_solde'][
'checked'])) {
401 print
'<td class="liste_titre right">';
402 print
'<input type="text" class="maxwidth50" name="search_prev_solde" value="'.$search_prev_solde.
'">';
407if (!empty($arrayfields[
'variation'][
'checked'])) {
408 print
'<td class="liste_titre"></td>';
412if (!empty($arrayfields[
'cpl.new_solde'][
'checked'])) {
413 print
'<td class="liste_titre right">';
414 print
'<input type="text" class="maxwidth50" name="search_new_solde" value="'.$search_new_solde.
'">';
419if (!
$conf->main_checkbox_left_column) {
420 print
'<td class="liste_titre maxwidthsearch">';
421 $searchpicto = $form->showFilterButtons();
427print
'<tr class="liste_titre">';
429if (
$conf->main_checkbox_left_column) {
430 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
432if (!empty($arrayfields[
'cpl.rowid'][
'checked'])) {
433 print_liste_field_titre($arrayfields[
'cpl.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'cpl.rowid',
'',
'',
'', $sortfield, $sortorder);
435if (!empty($arrayfields[
'cpl.date_action'][
'checked'])) {
436 print_liste_field_titre($arrayfields[
'cpl.date_action'][
'label'], $_SERVER[
"PHP_SELF"],
'date_action',
'',
'',
'', $sortfield, $sortorder,
'center ');
438if (!empty($arrayfields[
'cpl.fk_user_action'][
'checked'])) {
439 print_liste_field_titre($arrayfields[
'cpl.fk_user_action'][
'label'], $_SERVER[
"PHP_SELF"],
'fk_user_action',
'',
'',
'', $sortfield, $sortorder);
441if (!empty($arrayfields[
'cpl.fk_user_update'][
'checked'])) {
442 print_liste_field_titre($arrayfields[
'cpl.fk_user_update'][
'label'], $_SERVER[
"PHP_SELF"],
'fk_user_update',
'',
'',
'', $sortfield, $sortorder);
444if (!empty($arrayfields[
'cpl.type_action'][
'checked'])) {
445 print_liste_field_titre($arrayfields[
'cpl.type_action'][
'label'], $_SERVER[
"PHP_SELF"],
'type_action',
'',
'',
'', $sortfield, $sortorder);
447if (!empty($arrayfields[
'cpl.fk_type'][
'checked'])) {
448 print_liste_field_titre($arrayfields[
'cpl.fk_type'][
'label'], $_SERVER[
"PHP_SELF"],
'fk_type',
'',
'',
'', $sortfield, $sortorder);
450if (!empty($arrayfields[
'cpl.prev_solde'][
'checked'])) {
451 print_liste_field_titre($arrayfields[
'cpl.prev_solde'][
'label'], $_SERVER[
"PHP_SELF"],
'prev_solde',
'',
'',
'', $sortfield, $sortorder,
'right ');
453if (!empty($arrayfields[
'variation'][
'checked'])) {
454 print_liste_field_titre($arrayfields[
'variation'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'right ');
456if (!empty($arrayfields[
'cpl.new_solde'][
'checked'])) {
457 print_liste_field_titre($arrayfields[
'cpl.new_solde'][
'label'], $_SERVER[
"PHP_SELF"],
'new_solde',
'',
'',
'', $sortfield, $sortorder,
'right ');
460if (!
$conf->main_checkbox_left_column) {
461 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
467while ($j < ($page * $limit)) {
473while ($i < min($num, $limit)) {
480 $holidaylogstatic->id = (int) $obj[
'rowid'];
481 $holidaylogstatic->date = (
string) $obj[
'date_action'];
482 $holidaylogstatic->validator = (int) $obj[
'fk_user_action'];
483 $holidaylogstatic->employee = (int) $obj[
'fk_user_update'];
484 $holidaylogstatic->description = (
string) $obj[
'type_action'];
485 $holidaylogstatic->type = (int) $obj[
'fk_type'];
486 $holidaylogstatic->balance_previous = (float) $obj[
'prev_solde'];
487 $holidaylogstatic->balance_new = (float) $obj[
'new_solde'];
489 print
'<tr class="oddeven">';
492 if (
$conf->main_checkbox_left_column) {
497 if (!empty($arrayfields[
'cpl.rowid'][
'checked'])) {
498 print
'<td>'.$holidaylogstatic->id.
'</td>';
502 if (!empty($arrayfields[
'cpl.date_action'][
'checked'])) {
503 print
'<td style="text-align: center">'.$holidaylogstatic->date.
'</td>';
507 if (!empty($arrayfields[
'cpl.fk_user_action'][
'checked'])) {
509 $user_action->fetch($holidaylogstatic->validator);
510 print
'<td>'.$user_action->getNomUrl(-1).
'</td>';
514 if (!empty($arrayfields[
'cpl.fk_user_update'][
'checked'])) {
516 $user_update->fetch($holidaylogstatic->employee);
517 print
'<td>'.$user_update->getNomUrl(-1).
'</td>';
521 if (!empty($arrayfields[
'cpl.type_action'][
'checked'])) {
522 print
'<td class="tdoverflowmax400" title="'.dol_escape_htmltag($holidaylogstatic->description).
'">'.
dol_escape_htmltag($holidaylogstatic->description).
'</td>';
526 if (!empty($arrayfields[
'cpl.fk_type'][
'checked'])) {
528 if (!empty($alltypeleaves[$holidaylogstatic->type])) {
529 if ($alltypeleaves[$holidaylogstatic->type][
'code'] && $langs->trans($alltypeleaves[$holidaylogstatic->type][
'code']) != $alltypeleaves[$holidaylogstatic->type][
'code']) {
530 $label = $langs->trans($alltypeleaves[$holidaylogstatic->type][
'code']);
532 $label = $alltypeleaves[$holidaylogstatic->type][
'label'];
537 print $label ? $label : $holidaylogstatic->type;
542 if (!empty($arrayfields[
'cpl.prev_solde'][
'checked'])) {
543 print
'<td style="text-align: right;">'.price2num($holidaylogstatic->balance_previous, 5).
' '.$langs->trans(
'days').
'</td>';
547 if (!empty($arrayfields[
'variation'][
'checked'])) {
548 $delta =
price2num($holidaylogstatic->balance_new - $holidaylogstatic->balance_previous, 5);
549 print
'<td style="text-align: right;">';
551 print
'<span class="stockmovemententry fontsizeunset">+'.$delta.
'</span>';
553 print
'<span class="stockmovementexit fontsizeunset">'.$delta.
'</span>';
559 if (!empty($arrayfields[
'cpl.new_solde'][
'checked'])) {
560 print
'<td style="text-align: right;">'.price2num($holidaylogstatic->balance_new, 5).
' '.$langs->trans(
'days').
'</td>';
564 if (!
$conf->main_checkbox_left_column) {
574if ($log_holiday ==
'2') {
576 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 '.
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.
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...
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.