view_log.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  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. /**
  20. * Displays the log of actions performed in the module.
  21. *
  22. * \file htdocs/holiday/view_log.php
  23. * \ingroup holiday
  24. */
  25. require '../main.inc.php';
  26. // Security check (access forbidden for external user too)
  27. if (empty($user->rights->holiday->define_holiday) || $user->socid > 0) {
  28. accessforbidden();
  29. }
  30. require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
  31. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
  32. require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
  33. require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
  34. $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
  35. $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
  36. $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
  37. $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
  38. $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
  39. $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
  40. $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search
  41. $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
  42. $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
  43. $search_id = GETPOST('search_id', 'alphanohtml');
  44. $search_month = GETPOST('search_month', 'int');
  45. $search_year = GETPOST('search_year', 'int');
  46. $search_employee = GETPOST('search_employee', 'int');
  47. $search_validator = GETPOST('search_validator', 'int');
  48. $search_description = GETPOST('search_description', 'alphanohtml');
  49. $search_type = GETPOST('search_type', 'int');
  50. $search_prev_solde = GETPOST('search_prev_solde', 'alphanohtml');
  51. $search_new_solde = GETPOST('search_new_solde', 'alphanohtml');
  52. // Load variable for pagination
  53. $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
  54. $sortfield = GETPOST('sortfield', 'aZ09comma');
  55. $sortorder = GETPOST('sortorder', 'aZ09comma');
  56. $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
  57. if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) {
  58. $page = 0;
  59. } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
  60. $offset = $limit * $page;
  61. $pageprev = $page - 1;
  62. $pagenext = $page + 1;
  63. if (!$sortfield) {
  64. $sortfield = "cpl.rowid";
  65. }
  66. if (!$sortorder) {
  67. $sortorder = "DESC";
  68. }
  69. // Si l'utilisateur n'a pas le droit de lire cette page
  70. if (!$user->rights->holiday->readall) {
  71. accessforbidden();
  72. }
  73. // Load translation files required by the page
  74. $langs->loadLangs(array('users', 'other', 'holiday'));
  75. // Initialize technical objects
  76. $object = new Holiday($db);
  77. $extrafields = new ExtraFields($db);
  78. //$diroutputmassaction = $conf->mymodule->dir_output . '/temp/massgeneration/'.$user->id;
  79. $hookmanager->initHooks(array('leavemovementlist')); // Note that conf->hooks_modules contains array
  80. $arrayfields = array();
  81. $arrayofmassactions = array();
  82. if (empty($conf->holiday->enabled)) {
  83. llxHeader('', $langs->trans('CPTitreMenu'));
  84. print '<div class="tabBar">';
  85. print '<span style="color: #FF0000;">'.$langs->trans('NotActiveModCP').'</span>';
  86. print '</div>';
  87. llxFooter();
  88. exit();
  89. }
  90. /*
  91. * Actions
  92. */
  93. if (GETPOST('cancel', 'alpha')) {
  94. $action = 'list'; $massaction = '';
  95. }
  96. if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
  97. $massaction = '';
  98. }
  99. $parameters = array();
  100. $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
  101. if ($reshook < 0) {
  102. setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  103. }
  104. if (empty($reshook)) {
  105. // Selection of new fields
  106. include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
  107. // Purge search criteria
  108. 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
  109. $search_id = '';
  110. $search_month = '';
  111. $search_year = '';
  112. $search_employee = '';
  113. $search_validator = '';
  114. $search_description = '';
  115. $search_type = '';
  116. $search_prev_solde = '';
  117. $search_new_solde = '';
  118. $toselect = array();
  119. $search_array_options = array();
  120. }
  121. if (GETPOST('button_removefilter_x', 'alpha')
  122. || GETPOST('button_removefilter.x', 'alpha')
  123. || GETPOST('button_removefilter', 'alpha')
  124. || GETPOST('button_search_x', 'alpha')
  125. || GETPOST('button_search.x', 'alpha')
  126. || GETPOST('button_search', 'alpha')) {
  127. $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
  128. }
  129. // Mass actions
  130. /*$objectclass='MyObject';
  131. $objectlabel='MyObject';
  132. $permissiontoread = $user->rights->mymodule->read;
  133. $permissiontodelete = $user->rights->mymodule->delete;
  134. $uploaddir = $conf->mymodule->dir_output;
  135. include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
  136. */
  137. }
  138. // Definition of fields for lists
  139. $arrayfields = array(
  140. 'cpl.rowid'=>array('label'=>$langs->trans("ID"), 'checked'=>1),
  141. 'cpl.date_action'=>array('label'=>$langs->trans("Date"), 'checked'=>1),
  142. 'cpl.fk_user_action'=>array('label'=>$langs->trans("ActionByCP"), 'checked'=>1),
  143. 'cpl.fk_user_update'=>array('label'=>$langs->trans("UserUpdateCP"), 'checked'=>1),
  144. 'cpl.type_action'=>array('label'=>$langs->trans("Description"), 'checked'=>1),
  145. 'cpl.fk_type'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
  146. 'cpl.prev_solde'=>array('label'=>$langs->trans("PrevSoldeCP"), 'checked'=>1),
  147. 'variation'=>array('label'=>$langs->trans("Variation"), 'checked'=>1),
  148. 'cpl.new_solde'=>array('label'=>$langs->trans("NewSoldeCP"), 'checked'=>1),
  149. );
  150. /*
  151. * View
  152. */
  153. $form = new Form($db);
  154. $formother = new FormOther($db);
  155. $holidaylogstatic = new stdClass();
  156. $alltypeleaves = $object->getTypes(1, -1); // To have labels
  157. $title = $langs->trans('CPTitreMenu');
  158. llxHeader('', $title);
  159. $sqlwhere = '';
  160. if (!empty($search_year) && $search_year > 0) {
  161. if (!empty($search_month) && $search_month > 0) {
  162. $from_date = dol_get_first_day($search_year, $search_month, 1);
  163. $to_date = dol_get_last_day($search_year, $search_month, 1);
  164. } else {
  165. $from_date = dol_get_first_day($search_year, 1, 1);
  166. $to_date = dol_get_last_day($search_year, 12, 1);
  167. }
  168. $sqlwhere .= "AND date_action BETWEEN '".$db->idate($from_date)."' AND '".$db->idate($to_date)."'";
  169. }
  170. if (!empty($search_id) && $search_id > 0) {
  171. $sqlwhere .= natural_search('rowid', $search_id, 1);
  172. }
  173. if (!empty($search_validator) && $search_validator > 0) {
  174. $sqlwhere .= natural_search('fk_user_action', $search_validator, 1);
  175. }
  176. if (!empty($search_employee) && $search_employee > 0) {
  177. $sqlwhere .= natural_search('fk_user_update', $search_employee, 1);
  178. }
  179. if (!empty($search_description)) {
  180. $sqlwhere .= natural_search('type_action', $search_description);
  181. }
  182. if (!empty($search_type) && $search_type > 0) {
  183. $sqlwhere .= natural_search('fk_type', $search_type, 1);
  184. }
  185. if (!empty($search_prev_solde)) {
  186. $sqlwhere .= natural_search('prev_solde', $search_prev_solde, 1);
  187. }
  188. if (!empty($search_new_solde)) {
  189. $sqlwhere .= natural_search('new_solde', $search_new_solde, 1);
  190. }
  191. $sqlorder = $db->order($sortfield, $sortorder);
  192. // Recent changes are more important than old changes
  193. $log_holiday = $object->fetchLog($sqlorder, $sqlwhere); // Load $object->logs
  194. // Count total nb of records
  195. $nbtotalofrecords = '';
  196. if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
  197. //TODO: $result = $db->query($sql);
  198. //TODO: $nbtotalofrecords = $db->num_rows($result);
  199. $nbtotalofrecords = is_array($object->logs) ? count($object->logs) : 0;
  200. if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
  201. $page = 0;
  202. $offset = 0;
  203. }
  204. }
  205. // TODO: $num = $db->num_rows($resql);
  206. $num = is_array($object->logs) ? count($object->logs) : 0;
  207. $param = '';
  208. if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
  209. $param .= '&contextpage='.urlencode($contextpage);
  210. }
  211. if ($limit > 0 && $limit != $conf->liste_limit) {
  212. $param .= '&limit='.urlencode($limit);
  213. }
  214. if (!empty($search_id)) {
  215. $param .= '&search_statut='.urlencode($search_statut);
  216. }
  217. if (!empty($search_month) && $search_month > 0) {
  218. $param .= '&search_month='.urlencode($search_month);
  219. }
  220. if (!empty($search_year) && $search_year > 0) {
  221. $param .= '&search_year='.urlencode($search_year);
  222. }
  223. if (!empty($search_validator) && $search_validator > 0) {
  224. $param .= '&search_validator='.urlencode($search_validator);
  225. }
  226. if (!empty($search_employee) && $search_employee > 0) {
  227. $param .= '&search_employee='.urlencode($search_employee);
  228. }
  229. if (!empty($search_description)) {
  230. $param .= '&search_description='.urlencode($search_description);
  231. }
  232. if (!empty($search_type) && $search_type > 0) {
  233. $param .= '&search_type='.urlencode($search_type);
  234. }
  235. if (!empty($search_prev_solde)) {
  236. $param .= '&search_prev_solde='.urlencode($search_prev_solde);
  237. }
  238. if (!empty($search_new_solde)) {
  239. $param .= '&search_new_solde='.urlencode($search_new_solde);
  240. }
  241. print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
  242. if ($optioncss != '') {
  243. print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
  244. }
  245. print '<input type="hidden" name="token" value="'.newToken().'">';
  246. print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
  247. print '<input type="hidden" name="action" value="list">';
  248. print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
  249. print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
  250. print '<input type="hidden" name="page" value="'.$page.'">';
  251. print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
  252. $newcardbutton = dolGetButtonTitle($langs->trans('MenuAddCP'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/holiday/card.php?action=request', '', $user->rights->holiday->write);
  253. print_barre_liste($langs->trans('LogCP'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_hrm', 0, $newcardbutton, '', $limit, 0, 0, 1);
  254. print '<div class="info">'.$langs->trans('LastUpdateCP').': ';
  255. $lastUpdate = $object->getConfCP('lastUpdate');
  256. if ($lastUpdate) {
  257. $monthLastUpdate = $lastUpdate[4].$lastUpdate[5];
  258. $yearLastUpdate = $lastUpdate[0].$lastUpdate[1].$lastUpdate[2].$lastUpdate[3];
  259. print '<strong>'.dol_print_date($db->jdate($object->getConfCP('lastUpdate')), 'dayhour', 'tzuser').'</strong>';
  260. print '<br>';
  261. print $langs->trans("MonthOfLastMonthlyUpdate").': <strong>'.$yearLastUpdate.'-'.$monthLastUpdate.'</strong>';
  262. } else {
  263. print $langs->trans('None');
  264. }
  265. print '</div>';
  266. print '<br>';
  267. $moreforfilter = '';
  268. $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
  269. $selectedfields = '';
  270. $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
  271. $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
  272. print '<div class="div-table-responsive">';
  273. print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'" id="tablelines3">';
  274. print '<tr class="liste_titre_filter">';
  275. // Filter Id
  276. if (!empty($arrayfields['cpl.rowid']['checked'])) {
  277. print '<td class="liste_titre"><input type="text" class="maxwidth50" name="search_id" value="'.$search_id.'"></td>';
  278. }
  279. // Filter: Date
  280. if (!empty($arrayfields['cpl.date_action']['checked'])) {
  281. print '<td class="liste_titre center">';
  282. print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.dol_escape_htmltag($search_month).'">';
  283. print $formother->selectyear($search_year, 'search_year', 1, 10, 5, 0, 0, '', 'valignmiddle width75', true);
  284. print '</td>';
  285. }
  286. // Filter: Validator
  287. if (!empty($arrayfields['cpl.fk_user_action']['checked'])) {
  288. $validator = new UserGroup($db);
  289. $excludefilter = $user->admin ? '' : 'u.rowid <> '.$user->id;
  290. $valideurobjects = $validator->listUsersForGroup($excludefilter);
  291. $valideurarray = array();
  292. foreach ($valideurobjects as $val) {
  293. $valideurarray[$val->id] = $val->id;
  294. }
  295. print '<td class="liste_titre">';
  296. print $form->select_dolusers($search_validator, "search_validator", 1, "", 0, $valideurarray, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth200');
  297. print '</td>';
  298. }
  299. // Filter: User
  300. if (!empty($arrayfields['cpl.fk_user_update']['checked'])) {
  301. print '<td class="liste_titre">';
  302. print $form->select_dolusers($search_employee, "search_employee", 1, "", $disabled, $include, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth200');
  303. print '</td>';
  304. }
  305. // Filter: Description
  306. if (!empty($arrayfields['cpl.type_action']['checked'])) {
  307. print '<td class="liste_titre">';
  308. print '<input type="text" class="maxwidth50" name="search_description" value="'.$search_description.'">';
  309. print '</td>';
  310. }
  311. // Filter: Type
  312. if (!empty($arrayfields['cpl.fk_type']['checked'])) {
  313. foreach ($alltypeleaves as $key => $val) {
  314. $labeltoshow = ($langs->trans($val['code']) != $val['code'] ? $langs->trans($val['code']) : $val['label']);
  315. $arraytypeleaves[$val['rowid']] = $labeltoshow;
  316. }
  317. print '<td class="liste_titre">';
  318. print $form->selectarray('search_type', $arraytypeleaves, $search_type, 1, 0, 0, '', 0, 0, 0, '', '', 1);
  319. print '</td>';
  320. }
  321. // Filter: Previous balance
  322. if (!empty($arrayfields['cpl.prev_solde']['checked'])) {
  323. print '<td class="liste_titre right">';
  324. print '<input type="text" class="maxwidth50" name="search_prev_solde" value="'.$search_prev_solde.'">';
  325. print '</td>';
  326. }
  327. // Filter: Variation (only placeholder)
  328. if (!empty($arrayfields['variation']['checked'])) {
  329. print '<td class="liste_titre"></td>';
  330. }
  331. // Filter: New Balance
  332. if (!empty($arrayfields['cpl.new_solde']['checked'])) {
  333. print '<td class="liste_titre right">';
  334. print '<input type="text" class="maxwidth50" name="search_new_solde" value="'.$search_new_solde.'">';
  335. print '</td>';
  336. }
  337. // Action column
  338. print '<td class="liste_titre maxwidthsearch">';
  339. $searchpicto = $form->showFilterButtons();
  340. print $searchpicto;
  341. print '</td>';
  342. print '</tr>';
  343. print '<tr class="liste_titre">';
  344. if (!empty($arrayfields['cpl.rowid']['checked'])) {
  345. print_liste_field_titre($arrayfields['cpl.rowid']['label'], $_SERVER["PHP_SELF"], 'rowid', '', '', '', $sortfield, $sortorder);
  346. }
  347. if (!empty($arrayfields['cpl.date_action']['checked'])) {
  348. print_liste_field_titre($arrayfields['cpl.date_action']['label'], $_SERVER["PHP_SELF"], 'date_action', '', '', '', $sortfield, $sortorder, 'center ');
  349. }
  350. if (!empty($arrayfields['cpl.fk_user_action']['checked'])) {
  351. print_liste_field_titre($arrayfields['cpl.fk_user_action']['label'], $_SERVER["PHP_SELF"], 'fk_user_action', '', '', '', $sortfield, $sortorder);
  352. }
  353. if (!empty($arrayfields['cpl.fk_user_update']['checked'])) {
  354. print_liste_field_titre($arrayfields['cpl.fk_user_update']['label'], $_SERVER["PHP_SELF"], 'fk_user_update', '', '', '', $sortfield, $sortorder);
  355. }
  356. if (!empty($arrayfields['cpl.type_action']['checked'])) {
  357. print_liste_field_titre($arrayfields['cpl.type_action']['label'], $_SERVER["PHP_SELF"], 'type_action', '', '', '', $sortfield, $sortorder);
  358. }
  359. if (!empty($arrayfields['cpl.fk_type']['checked'])) {
  360. print_liste_field_titre($arrayfields['cpl.fk_type']['label'], $_SERVER["PHP_SELF"], 'fk_type', '', '', '', $sortfield, $sortorder);
  361. }
  362. if (!empty($arrayfields['cpl.prev_solde']['checked'])) {
  363. print_liste_field_titre($arrayfields['cpl.prev_solde']['label'], $_SERVER["PHP_SELF"], 'prev_solde', '', '', '', $sortfield, $sortorder, 'right ');
  364. }
  365. if (!empty($arrayfields['variation']['checked'])) {
  366. print_liste_field_titre($arrayfields['variation']['label'], $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'right ');
  367. }
  368. if (!empty($arrayfields['cpl.new_solde']['checked'])) {
  369. print_liste_field_titre($arrayfields['cpl.new_solde']['label'], $_SERVER["PHP_SELF"], 'new_solde', '', '', '', $sortfield, $sortorder, 'right ');
  370. }
  371. print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
  372. print '</tr>';
  373. $j = 0;
  374. while ($j < ($page * $limit)) {
  375. $obj = next($object->logs);
  376. $j++;
  377. }
  378. $i = 0;
  379. while ($i < min($num, $limit)) {
  380. //TODO: $obj = $db->fetch_object($resql);
  381. $obj = current($object->logs);
  382. if (empty($obj)) {
  383. break;
  384. }
  385. $holidaylogstatic->id = $obj['rowid'];
  386. $holidaylogstatic->date = $obj['date_action'];
  387. $holidaylogstatic->validator = $obj['fk_user_action'];
  388. $holidaylogstatic->employee = $obj['fk_user_update'];
  389. $holidaylogstatic->description = $obj['type_action'];
  390. $holidaylogstatic->type = $obj['fk_type'];
  391. $holidaylogstatic->balance_previous = $obj['prev_solde'];
  392. $holidaylogstatic->balance_new = $obj['new_solde'];
  393. print '<tr class="oddeven">';
  394. // Id
  395. if (!empty($arrayfields['cpl.rowid']['checked'])) {
  396. print '<td>'.$holidaylogstatic->id.'</td>';
  397. }
  398. // Date
  399. if (!empty($arrayfields['cpl.date_action']['checked'])) {
  400. print '<td style="text-align: center">'.$holidaylogstatic->date.'</td>';
  401. }
  402. // Validator
  403. if (!empty($arrayfields['cpl.fk_user_action']['checked'])) {
  404. $user_action = new User($db);
  405. $user_action->fetch($holidaylogstatic->validator);
  406. print '<td>'.$user_action->getNomUrl(-1).'</td>';
  407. }
  408. // Emloyee
  409. if (!empty($arrayfields['cpl.fk_user_update']['checked'])) {
  410. $user_update = new User($db);
  411. $user_update->fetch($holidaylogstatic->employee);
  412. print '<td>'.$user_update->getNomUrl(-1).'</td>';
  413. }
  414. // Description
  415. if (!empty($arrayfields['cpl.type_action']['checked'])) {
  416. print '<td>'.$holidaylogstatic->description.'</td>';
  417. }
  418. // Type
  419. if (!empty($arrayfields['cpl.fk_type']['checked'])) {
  420. if ($alltypeleaves[$holidaylogstatic->type]['code'] && $langs->trans($alltypeleaves[$holidaylogstatic->type]['code']) != $alltypeleaves[$holidaylogstatic->type]['code']) {
  421. $label = $langs->trans($alltypeleaves[$holidaylogstatic->type]['code']);
  422. } else {
  423. $label = $alltypeleaves[$holidaylogstatic->type]['label'];
  424. }
  425. print '<td>';
  426. print $label ? $label : $holidaylogstatic->type;
  427. print '</td>';
  428. }
  429. // Previous balance
  430. if (!empty($arrayfields['cpl.prev_solde']['checked'])) {
  431. print '<td style="text-align: right;">'.price2num($holidaylogstatic->balance_previous, 5).' '.$langs->trans('days').'</td>';
  432. }
  433. // Variation
  434. if (!empty($arrayfields['variation']['checked'])) {
  435. $delta = price2num($holidaylogstatic->balance_new - $holidaylogstatic->balance_previous, 5);
  436. $detasign = ($delta > 0 ? '+' : '');
  437. print '<td style="text-align: right;">'.$detasign.$delta.'</td>';
  438. }
  439. // New Balance
  440. if (!empty($arrayfields['cpl.new_solde']['checked'])) {
  441. print '<td style="text-align: right;">'.price2num($holidaylogstatic->balance_new, 5).' '.$langs->trans('days').'</td>';
  442. }
  443. // Buttons
  444. print '<td></td>';
  445. print '</tr>';
  446. $i++;
  447. next($object->logs);
  448. }
  449. if ($log_holiday == '2') {
  450. print '<tr class="opacitymedium">';
  451. print '<td colspan="10" class="opacitymedium">'.$langs->trans('NoRecordFound').'</td>';
  452. print '</tr>';
  453. }
  454. print '</table>';
  455. print '</div>';
  456. print '</form>';
  457. // End of page
  458. llxFooter();
  459. $db->close();