view_log.php 20 KB

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