dolibarr  18.0.6
view_log.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2007-2016 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
4  * Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <https://www.gnu.org/licenses/>.
18  */
19 
27 // Load Dolibarr environment
28 require '../main.inc.php';
29 
30 // Security check (access forbidden for external user too)
31 if (empty($user->rights->holiday->define_holiday) || $user->socid > 0) {
33 }
34 
35 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
36 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
37 require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
38 require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
39 
40 $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
41 $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
42 $mode = GETPOST('mode', 'alpha');
43 $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
44 $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
45 $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
46 $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
47 $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search
48 $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
49 $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
50 
51 $search_id = GETPOST('search_id', 'alphanohtml');
52 $search_month = GETPOST('search_month', 'int');
53 $search_year = GETPOST('search_year', 'int');
54 $search_employee = GETPOST('search_employee', 'int');
55 $search_validator = GETPOST('search_validator', 'int');
56 $search_description = GETPOST('search_description', 'alphanohtml');
57 $search_type = GETPOST('search_type', 'int');
58 $search_prev_solde = GETPOST('search_prev_solde', 'alphanohtml');
59 $search_new_solde = GETPOST('search_new_solde', 'alphanohtml');
60 
61 // Load variable for pagination
62 $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
63 $sortfield = GETPOST('sortfield', 'aZ09comma');
64 $sortorder = GETPOST('sortorder', 'aZ09comma');
65 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
66 if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) {
67  $page = 0;
68 } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
69 $offset = $limit * $page;
70 $pageprev = $page - 1;
71 $pagenext = $page + 1;
72 if (!$sortfield) {
73  $sortfield = "cpl.rowid";
74 }
75 if (!$sortorder) {
76  $sortorder = "DESC";
77 }
78 
79 // Load translation files required by the page
80 $langs->loadLangs(array('users', 'other', 'holiday'));
81 
82 // Initialize technical objects
83 $object = new Holiday($db);
84 $extrafields = new ExtraFields($db);
85 //$diroutputmassaction = $conf->mymodule->dir_output . '/temp/massgeneration/'.$user->id;
86 $hookmanager->initHooks(array('leavemovementlist')); // Note that conf->hooks_modules contains array
87 
88 $arrayfields = array();
89 $arrayofmassactions = array();
90 
91 if (empty($conf->holiday->enabled)) {
92  accessforbidden('Module not enabled');
93 }
94 
95 // Si l'utilisateur n'a pas le droit de lire cette page
96 if (!$user->rights->holiday->readall) {
98 }
99 
100 
101 /*
102  * Actions
103  */
104 
105 if (GETPOST('cancel', 'alpha')) {
106  $action = 'list'; $massaction = '';
107 }
108 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
109  $massaction = '';
110 }
111 
112 $parameters = array();
113 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
114 if ($reshook < 0) {
115  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
116 }
117 
118 if (empty($reshook)) {
119  // Selection of new fields
120  include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
121 
122  // Purge search criteria
123  if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
124  $search_id = '';
125  $search_month = '';
126  $search_year = '';
127  $search_employee = '';
128  $search_validator = '';
129  $search_description = '';
130  $search_type = '';
131  $search_prev_solde = '';
132  $search_new_solde = '';
133  $toselect = array();
134  $search_array_options = array();
135  }
136 
137  if (GETPOST('button_removefilter_x', 'alpha')
138  || GETPOST('button_removefilter.x', 'alpha')
139  || GETPOST('button_removefilter', 'alpha')
140  || GETPOST('button_search_x', 'alpha')
141  || GETPOST('button_search.x', 'alpha')
142  || GETPOST('button_search', 'alpha')) {
143  $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
144  }
145 
146  // Mass actions
147  /*$objectclass='MyObject';
148  $objectlabel='MyObject';
149  $permissiontoread = $user->rights->mymodule->read;
150  $permissiontodelete = $user->rights->mymodule->delete;
151  $uploaddir = $conf->mymodule->dir_output;
152  include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
153  */
154 }
155 
156 
157 // Definition of fields for lists
158 $arrayfields = array(
159  'cpl.rowid'=>array('label'=>"ID", 'checked'=>1),
160  'cpl.date_action'=>array('label'=>"Date", 'checked'=>1),
161  'cpl.fk_user_action'=>array('label'=>"ActionByCP", 'checked'=>1),
162  'cpl.fk_user_update'=>array('label'=>"UserUpdateCP", 'checked'=>1),
163  'cpl.type_action'=>array('label'=>"Description", 'checked'=>1),
164  'cpl.fk_type'=>array('label'=>"Type", 'checked'=>1),
165  'cpl.prev_solde'=>array('label'=>"PrevSoldeCP", 'checked'=>1),
166  'variation'=>array('label'=>"Variation", 'checked'=>1),
167  'cpl.new_solde'=>array('label'=>"NewSoldeCP", 'checked'=>1),
168 );
169 
170 
171 /*
172  * View
173  */
174 
175 $form = new Form($db);
176 $formother = new FormOther($db);
177 $holidaylogstatic = new stdClass();
178 $alltypeleaves = $object->getTypes(1, -1); // To have labels
179 
180 $title = $langs->trans('CPTitreMenu');
181 llxHeader('', $title);
182 
183 $sqlwhere = '';
184 
185 if (!empty($search_year) && $search_year > 0) {
186  if (!empty($search_month) && $search_month > 0) {
187  $from_date = dol_get_first_day($search_year, $search_month, 1);
188  $to_date = dol_get_last_day($search_year, $search_month, 1);
189  } else {
190  $from_date = dol_get_first_day($search_year, 1, 1);
191  $to_date = dol_get_last_day($search_year, 12, 1);
192  }
193 
194  $sqlwhere .= "AND date_action BETWEEN '".$db->idate($from_date)."' AND '".$db->idate($to_date)."'";
195 }
196 
197 if (!empty($search_id) && $search_id > 0) {
198  $sqlwhere .= natural_search('rowid', $search_id, 1);
199 }
200 if (!empty($search_validator) && $search_validator > 0) {
201  $sqlwhere .= natural_search('fk_user_action', $search_validator, 1);
202 }
203 if (!empty($search_employee) && $search_employee > 0) {
204  $sqlwhere .= natural_search('fk_user_update', $search_employee, 1);
205 }
206 if (!empty($search_description)) {
207  $sqlwhere .= natural_search('type_action', $search_description);
208 }
209 if (!empty($search_type) && $search_type > 0) {
210  $sqlwhere .= natural_search('fk_type', $search_type, 1);
211 }
212 if (!empty($search_prev_solde)) {
213  $sqlwhere .= natural_search('prev_solde', $search_prev_solde, 1);
214 }
215 if (!empty($search_new_solde)) {
216  $sqlwhere .= natural_search('new_solde', $search_new_solde, 1);
217 }
218 
219 $sqlorder = $db->order($sortfield, $sortorder);
220 
221 // Recent changes are more important than old changes
222 $log_holiday = $object->fetchLog($sqlorder, $sqlwhere); // Load $object->logs
223 
224 // Count total nb of records
225 $nbtotalofrecords = '';
226 if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
227  //TODO: $result = $db->query($sql);
228  //TODO: $nbtotalofrecords = $db->num_rows($result);
229  $nbtotalofrecords = is_array($object->logs) ? count($object->logs) : 0;
230 
231  if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
232  $page = 0;
233  $offset = 0;
234  }
235 }
236 
237 // TODO: $num = $db->num_rows($resql);
238 $num = is_array($object->logs) ? count($object->logs) : 0;
239 
240 $param = '';
241 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
242  $param .= '&contextpage='.urlencode($contextpage);
243 }
244 if ($limit > 0 && $limit != $conf->liste_limit) {
245  $param .= '&limit='.((int) $limit);
246 }
247 if (!empty($search_id)) {
248  $param .= '&search_statut='.urlencode($search_statut);
249 }
250 if (!empty($search_month) && $search_month > 0) {
251  $param .= '&search_month='.urlencode($search_month);
252 }
253 if (!empty($search_year) && $search_year > 0) {
254  $param .= '&search_year='.urlencode($search_year);
255 }
256 if (!empty($search_validator) && $search_validator > 0) {
257  $param .= '&search_validator='.urlencode($search_validator);
258 }
259 if (!empty($search_employee) && $search_employee > 0) {
260  $param .= '&search_employee='.urlencode($search_employee);
261 }
262 if (!empty($search_description)) {
263  $param .= '&search_description='.urlencode($search_description);
264 }
265 if (!empty($search_type) && $search_type > 0) {
266  $param .= '&search_type='.urlencode($search_type);
267 }
268 if (!empty($search_prev_solde)) {
269  $param .= '&search_prev_solde='.urlencode($search_prev_solde);
270 }
271 if (!empty($search_new_solde)) {
272  $param .= '&search_new_solde='.urlencode($search_new_solde);
273 }
274 
275 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
276 if ($optioncss != '') {
277  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
278 }
279 print '<input type="hidden" name="token" value="'.newToken().'">';
280 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
281 print '<input type="hidden" name="action" value="list">';
282 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
283 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
284 print '<input type="hidden" name="page" value="'.$page.'">';
285 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
286 
287 $newcardbutton = dolGetButtonTitle($langs->trans('MenuAddCP'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/holiday/card.php?action=create', '', $user->rights->holiday->write);
288 print_barre_liste($langs->trans('LogCP'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_hrm', 0, $newcardbutton, '', $limit, 0, 0, 1);
289 
290 print '<div class="info">'.$langs->trans('LastUpdateCP').': ';
291 
292 $lastUpdate = $object->getConfCP('lastUpdate');
293 if ($lastUpdate) {
294  $monthLastUpdate = $lastUpdate[4].$lastUpdate[5];
295  $yearLastUpdate = $lastUpdate[0].$lastUpdate[1].$lastUpdate[2].$lastUpdate[3];
296  print '<strong>'.dol_print_date($db->jdate($object->getConfCP('lastUpdate')), 'dayhour', 'tzuser').'</strong>';
297  print '<br>';
298  print $langs->trans("MonthOfLastMonthlyUpdate").': <strong>'.$yearLastUpdate.'-'.$monthLastUpdate.'</strong>';
299 } else {
300  print $langs->trans('None');
301 }
302 print '</div>';
303 print '<br>';
304 
305 $moreforfilter = '';
306 $morefilter = '';
307 $disabled = 0;
308 $include = '';
309 
310 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
311 $selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields
312 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
313 
314 print '<div class="div-table-responsive">';
315 print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'" id="tablelines3">';
316 
317 print '<tr class="liste_titre_filter">';
318 
319 // Action column
320 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
321  print '<td class="liste_titre maxwidthsearch">';
322  $searchpicto = $form->showFilterButtons();
323  print $searchpicto;
324  print '</td>';
325 }
326 
327 // Filter Id
328 if (!empty($arrayfields['cpl.rowid']['checked'])) {
329  print '<td class="liste_titre"><input type="text" class="maxwidth50" name="search_id" value="'.$search_id.'"></td>';
330 }
331 
332 // Filter: Date
333 if (!empty($arrayfields['cpl.date_action']['checked'])) {
334  print '<td class="liste_titre center">';
335  print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.dol_escape_htmltag($search_month).'">';
336  print $formother->selectyear($search_year, 'search_year', 1, 10, 5, 0, 0, '', 'valignmiddle width75', true);
337  print '</td>';
338 }
339 
340 // Filter: Validator
341 if (!empty($arrayfields['cpl.fk_user_action']['checked'])) {
342  $validator = new UserGroup($db);
343  $excludefilter = $user->admin ? '' : 'u.rowid <> '.$user->id;
344  $valideurobjects = $validator->listUsersForGroup($excludefilter, 1);
345  $valideurarray = array();
346  foreach ($valideurobjects as $val) {
347  $valideurarray[$val] = $val;
348  }
349 
350  print '<td class="liste_titre">';
351  print $form->select_dolusers($search_validator, "search_validator", 1, "", 0, $valideurarray, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth200');
352  print '</td>';
353 }
354 
355 // Filter: User
356 if (!empty($arrayfields['cpl.fk_user_update']['checked'])) {
357  print '<td class="liste_titre">';
358  print $form->select_dolusers($search_employee, "search_employee", 1, "", $disabled, $include, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth200');
359  print '</td>';
360 }
361 
362 // Filter: Description
363 if (!empty($arrayfields['cpl.type_action']['checked'])) {
364  print '<td class="liste_titre">';
365  print '<input type="text" class="maxwidth50" name="search_description" value="'.$search_description.'">';
366  print '</td>';
367 }
368 
369 // Filter: Type
370 if (!empty($arrayfields['cpl.fk_type']['checked'])) {
371  foreach ($alltypeleaves as $key => $val) {
372  $labeltoshow = ($langs->trans($val['code']) != $val['code'] ? $langs->trans($val['code']) : $val['label']);
373  $arraytypeleaves[$val['rowid']] = $labeltoshow;
374  }
375 
376  print '<td class="liste_titre">';
377  print $form->selectarray('search_type', $arraytypeleaves, $search_type, 1, 0, 0, '', 0, 0, 0, '', '', 1);
378  print '</td>';
379 }
380 
381 // Filter: Previous balance
382 if (!empty($arrayfields['cpl.prev_solde']['checked'])) {
383  print '<td class="liste_titre right">';
384  print '<input type="text" class="maxwidth50" name="search_prev_solde" value="'.$search_prev_solde.'">';
385  print '</td>';
386 }
387 
388 // Filter: Variation (only placeholder)
389 if (!empty($arrayfields['variation']['checked'])) {
390  print '<td class="liste_titre"></td>';
391 }
392 
393 // Filter: New Balance
394 if (!empty($arrayfields['cpl.new_solde']['checked'])) {
395  print '<td class="liste_titre right">';
396  print '<input type="text" class="maxwidth50" name="search_new_solde" value="'.$search_new_solde.'">';
397  print '</td>';
398 }
399 
400 // Action column
401 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
402  print '<td class="liste_titre maxwidthsearch">';
403  $searchpicto = $form->showFilterButtons();
404  print $searchpicto;
405  print '</td>';
406 }
407 print '</tr>';
408 
409 print '<tr class="liste_titre">';
410 // Action column
411 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
412  print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
413 }
414 if (!empty($arrayfields['cpl.rowid']['checked'])) {
415  print_liste_field_titre($arrayfields['cpl.rowid']['label'], $_SERVER["PHP_SELF"], 'cpl.rowid', '', '', '', $sortfield, $sortorder);
416 }
417 if (!empty($arrayfields['cpl.date_action']['checked'])) {
418  print_liste_field_titre($arrayfields['cpl.date_action']['label'], $_SERVER["PHP_SELF"], 'date_action', '', '', '', $sortfield, $sortorder, 'center ');
419 }
420 if (!empty($arrayfields['cpl.fk_user_action']['checked'])) {
421  print_liste_field_titre($arrayfields['cpl.fk_user_action']['label'], $_SERVER["PHP_SELF"], 'fk_user_action', '', '', '', $sortfield, $sortorder);
422 }
423 if (!empty($arrayfields['cpl.fk_user_update']['checked'])) {
424  print_liste_field_titre($arrayfields['cpl.fk_user_update']['label'], $_SERVER["PHP_SELF"], 'fk_user_update', '', '', '', $sortfield, $sortorder);
425 }
426 if (!empty($arrayfields['cpl.type_action']['checked'])) {
427  print_liste_field_titre($arrayfields['cpl.type_action']['label'], $_SERVER["PHP_SELF"], 'type_action', '', '', '', $sortfield, $sortorder);
428 }
429 if (!empty($arrayfields['cpl.fk_type']['checked'])) {
430  print_liste_field_titre($arrayfields['cpl.fk_type']['label'], $_SERVER["PHP_SELF"], 'fk_type', '', '', '', $sortfield, $sortorder);
431 }
432 if (!empty($arrayfields['cpl.prev_solde']['checked'])) {
433  print_liste_field_titre($arrayfields['cpl.prev_solde']['label'], $_SERVER["PHP_SELF"], 'prev_solde', '', '', '', $sortfield, $sortorder, 'right ');
434 }
435 if (!empty($arrayfields['variation']['checked'])) {
436  print_liste_field_titre($arrayfields['variation']['label'], $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'right ');
437 }
438 if (!empty($arrayfields['cpl.new_solde']['checked'])) {
439  print_liste_field_titre($arrayfields['cpl.new_solde']['label'], $_SERVER["PHP_SELF"], 'new_solde', '', '', '', $sortfield, $sortorder, 'right ');
440 }
441 // Action column
442 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
443  print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
444 }
445 print '</tr>';
446 
447 
448 $j = 0;
449 while ($j < ($page * $limit)) {
450  $obj = next($object->logs);
451  $j++;
452 }
453 
454 $i = 0;
455 while ($i < min($num, $limit)) {
456  //TODO: $obj = $db->fetch_object($resql);
457  $obj = current($object->logs);
458  if (empty($obj)) {
459  break;
460  }
461 
462  $holidaylogstatic->id = $obj['rowid'];
463  $holidaylogstatic->date = $obj['date_action'];
464  $holidaylogstatic->validator = $obj['fk_user_action'];
465  $holidaylogstatic->employee = $obj['fk_user_update'];
466  $holidaylogstatic->description = $obj['type_action'];
467  $holidaylogstatic->type = $obj['fk_type'];
468  $holidaylogstatic->balance_previous = $obj['prev_solde'];
469  $holidaylogstatic->balance_new = $obj['new_solde'];
470 
471  print '<tr class="oddeven">';
472 
473  // Action column
474  if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
475  print '<td></td>';
476  }
477 
478  // Id
479  if (!empty($arrayfields['cpl.rowid']['checked'])) {
480  print '<td>'.$holidaylogstatic->id.'</td>';
481  }
482 
483  // Date
484  if (!empty($arrayfields['cpl.date_action']['checked'])) {
485  print '<td style="text-align: center">'.$holidaylogstatic->date.'</td>';
486  }
487 
488  // Validator
489  if (!empty($arrayfields['cpl.fk_user_action']['checked'])) {
490  $user_action = new User($db);
491  $user_action->fetch($holidaylogstatic->validator);
492  print '<td>'.$user_action->getNomUrl(-1).'</td>';
493  }
494 
495  // Emloyee
496  if (!empty($arrayfields['cpl.fk_user_update']['checked'])) {
497  $user_update = new User($db);
498  $user_update->fetch($holidaylogstatic->employee);
499  print '<td>'.$user_update->getNomUrl(-1).'</td>';
500  }
501 
502  // Description
503  if (!empty($arrayfields['cpl.type_action']['checked'])) {
504  print '<td class="tdoverflowmax400" title="'.dol_escape_htmltag($holidaylogstatic->description).'">'.dol_escape_htmltag($holidaylogstatic->description).'</td>';
505  }
506 
507  // Type
508  if (!empty($arrayfields['cpl.fk_type']['checked'])) {
509  $label = '';
510  if (!empty($alltypeleaves[$holidaylogstatic->type])) {
511  if ($alltypeleaves[$holidaylogstatic->type]['code'] && $langs->trans($alltypeleaves[$holidaylogstatic->type]['code']) != $alltypeleaves[$holidaylogstatic->type]['code']) {
512  $label = $langs->trans($alltypeleaves[$holidaylogstatic->type]['code']);
513  } else {
514  $label = $alltypeleaves[$holidaylogstatic->type]['label'];
515  }
516  }
517 
518  print '<td>';
519  print $label ? $label : $holidaylogstatic->type;
520  print '</td>';
521  }
522 
523  // Previous balance
524  if (!empty($arrayfields['cpl.prev_solde']['checked'])) {
525  print '<td style="text-align: right;">'.price2num($holidaylogstatic->balance_previous, 5).' '.$langs->trans('days').'</td>';
526  }
527 
528  // Variation
529  if (!empty($arrayfields['variation']['checked'])) {
530  $delta = price2num($holidaylogstatic->balance_new - $holidaylogstatic->balance_previous, 5);
531  print '<td style="text-align: right;">';
532  if ($delta > 0) {
533  print '<span class="stockmovemententry fontsizeunset">+'.$delta.'</span>';
534  } else {
535  print '<span class="stockmovementexit fontsizeunset">'.$delta.'</span>';
536  }
537  print '</td>';
538  }
539 
540  // New Balance
541  if (!empty($arrayfields['cpl.new_solde']['checked'])) {
542  print '<td style="text-align: right;">'.price2num($holidaylogstatic->balance_new, 5).' '.$langs->trans('days').'</td>';
543  }
544 
545  // Action column
546  if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
547  print '<td></td>';
548  }
549 
550  print '</tr>';
551 
552  $i++;
553  next($object->logs);
554 }
555 
556 if ($log_holiday == '2') {
557  print '<tr class="opacitymedium">';
558  print '<td colspan="10" class="opacitymedium">'.$langs->trans('NoRecordFound').'</td>';
559  print '</tr>';
560 }
561 
562 print '</table>';
563 print '</div>';
564 
565 print '</form>';
566 
567 // End of page
568 llxFooter();
569 $db->close();
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
llxFooter()
Empty footer.
Definition: wrapper.php:70
Class to manage standard extra fields.
Class to manage generation of HTML components Only common components must be here.
Classe permettant la generation de composants html autre Only common components are here.
Class of the module paid holiday.
Class to manage user groups.
Class to manage Dolibarr users.
Definition: user.class.php:48
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
Definition: date.lib.php:577
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
Definition: date.lib.php:596
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 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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
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.