dolibarr  17.0.4
list.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
3  * Copyright (C) 2013-2020 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2012-2016 Regis Houssin <regis.houssin@inodbox.com>
5  * Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
6  * Copyright (C) 2019-2022 Frédéric France <frederic.france@netlogic.fr>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20  */
21 
28 // Load Dolibarr environment
29 require '../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
34 require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
35 require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
36 require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
37 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
38 require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
39 
40 // Load translation files required by the page
41 $langs->loadLangs(array('users', 'other', 'holiday', 'hrm'));
42 
43 // Protection if external user
44 if ($user->socid > 0) {
46 }
47 
48 $action = GETPOST('action', 'aZ09'); // The action 'add', 'create', 'edit', 'update', 'view', ...
49 $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
50 $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
51 $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
52 $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
53 $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
54 $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'holidaylist'; // To manage different context of search
55 
56 $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
57 $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
58 
59 $id = GETPOST('id', 'int');
60 
61 $childids = $user->getAllChildIds(1);
62 
63 
64 $diroutputmassaction = $conf->holiday->dir_output.'/temp/massgeneration/'.$user->id;
65 
66 
67 // Load variable for pagination
68 $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
69 $sortfield = GETPOST('sortfield', 'aZ09comma');
70 $sortorder = GETPOST('sortorder', 'aZ09comma');
71 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
72 if (empty($page) || $page == -1) {
73  $page = 0;
74 } // If $page is not defined, or '' or -1
75 $offset = $limit * $page;
76 $pageprev = $page - 1;
77 $pagenext = $page + 1;
78 if (!$sortorder) {
79  $sortorder = "DESC";
80 }
81 if (!$sortfield) {
82  $sortfield = "cp.ref";
83 }
84 
85 $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
86 $search_ref = GETPOST('search_ref', 'alphanohtml');
87 $search_day_create = GETPOST('search_day_create', 'int');
88 $search_month_create = GETPOST('search_month_create', 'int');
89 $search_year_create = GETPOST('search_year_create', 'int');
90 $search_day_start = GETPOST('search_day_start', 'int');
91 $search_month_start = GETPOST('search_month_start', 'int');
92 $search_year_start = GETPOST('search_year_start', 'int');
93 $search_day_end = GETPOST('search_day_end', 'int');
94 $search_month_end = GETPOST('search_month_end', 'int');
95 $search_year_end = GETPOST('search_year_end', 'int');
96 $search_employee = GETPOST('search_employee', 'int');
97 $search_valideur = GETPOST('search_valideur', 'int');
98 $search_status = GETPOSTISSET('search_status') ? GETPOST('search_status', 'int') : GETPOST('search_statut', 'int');
99 $search_type = GETPOST('search_type', 'int');
100 
101 // Initialize technical objects
102 $object = new Holiday($db);
103 $extrafields = new ExtraFields($db);
104 $hookmanager->initHooks(array('holidaylist')); // Note that conf->hooks_modules contains array
105 
106 // Fetch optionals attributes and labels
107 $extrafields->fetch_name_optionals_label($object->table_element);
108 
109 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
110 
111 // List of fields to search into when doing a "search in all"
112 $fieldstosearchall = array(
113  'cp.ref'=>'Ref',
114  'cp.description'=>'Description',
115  'uu.lastname'=>'EmployeeLastname',
116  'uu.firstname'=>'EmployeeFirstname',
117  'uu.login'=>'Login'
118 );
119 
120 $arrayfields = array(
121  'cp.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
122  'cp.fk_user'=>array('label'=>$langs->trans("Employee"), 'checked'=>1, 'position'=>20),
123  'cp.fk_validator'=>array('label'=>$langs->trans("ValidatorCP"), 'checked'=>1, 'position'=>30),
124  'cp.fk_type'=>array('label'=>$langs->trans("Type"), 'checked'=>1, 'position'=>35),
125  'duration'=>array('label'=>$langs->trans("NbUseDaysCPShort"), 'checked'=>1, 'position'=>38),
126  'cp.date_debut'=>array('label'=>$langs->trans("DateStart"), 'checked'=>1, 'position'=>40),
127  'cp.date_fin'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1, 'position'=>42),
128  'cp.date_valid'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>1, 'position'=>60),
129  'cp.date_approval'=>array('label'=>$langs->trans("DateApprove"), 'checked'=>1, 'position'=>70),
130  'cp.date_create'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
131  'cp.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>501),
132  'cp.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
133 );
134 // Extra fields
135 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
136 
137 
138 // Security check
139 $socid = 0;
140 if ($user->socid > 0) { // Protection if external user
141  //$socid = $user->socid;
142  accessforbidden();
143 }
144 
145 if (empty($conf->holiday->enabled)) accessforbidden('Module not enabled');
146 
147 $result = restrictedArea($user, 'holiday', '', '');
148 // If we are on the view of a specific user
149 if ($id > 0) {
150  $canread = 0;
151  if ($id == $user->id) {
152  $canread = 1;
153  }
154  if (!empty($user->rights->holiday->readall)) {
155  $canread = 1;
156  }
157  if (!empty($user->rights->holiday->read) && in_array($id, $childids)) {
158  $canread = 1;
159  }
160  if (!$canread) {
161  accessforbidden();
162  }
163 }
164 
165 
166 
167 
168 /*
169  * Actions
170  */
171 
172 if (GETPOST('cancel', 'alpha')) {
173  $action = 'list'; $massaction = '';
174 }
175 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
176  $massaction = '';
177 }
178 
179 $parameters = array('socid'=>$socid);
180 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
181 if ($reshook < 0) {
182  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
183 }
184 
185 if (empty($reshook)) {
186  // Selection of new fields
187  include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
188 
189  // Purge search criteria
190  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
191  $search_ref = "";
192  $search_month_create = "";
193  $search_year_create = "";
194  $search_month_start = "";
195  $search_year_start = "";
196  $search_month_end = "";
197  $search_year_end = "";
198  $search_employee = "";
199  $search_valideur = "";
200  $search_status = "";
201  $search_type = '';
202  $toselect = array();
203  $search_array_options = array();
204  }
205  if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
206  || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
207  $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
208  }
209 
210  // Mass actions
211  $objectclass = 'Holiday';
212  $objectlabel = 'Holiday';
213  $permissiontoread = $user->hasRight('holiday', 'read');
214  $permissiontodelete = $user->hasRight('holiday', 'delete');
215  $permissiontoapprove = $user->hasRight('holiday', 'approve');
216  $uploaddir = $conf->holiday->dir_output;
217  include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
218 }
219 
220 
221 
222 
223 /*
224  * View
225  */
226 
227 $form = new Form($db);
228 $formother = new FormOther($db);
229 $formfile = new FormFile($db);
230 
231 $fuser = new User($db);
232 $holidaystatic = new Holiday($db);
233 
234 // Update sold
235 $result = $object->updateBalance();
236 
237 $title = $langs->trans('CPTitreMenu');
238 llxHeader('', $title);
239 
240 $max_year = 5;
241 $min_year = 10;
242 
243 // Get current user id
244 $user_id = $user->id;
245 
246 if ($id > 0) {
247  // Charge utilisateur edite
248  $fuser->fetch($id, '', '', 1);
249  $fuser->getrights();
250  $user_id = $fuser->id;
251 
252  $search_employee = $user_id;
253 }
254 
255 // Récupération des congés payés de l'utilisateur ou de tous les users de sa hierarchy
256 // Load array $object->holiday
257 
258 $sql = "SELECT";
259 $sql .= " cp.rowid,";
260 $sql .= " cp.ref,";
261 
262 $sql .= " cp.fk_user,";
263 $sql .= " cp.fk_type,";
264 $sql .= " cp.date_create,";
265 $sql .= " cp.tms as date_update,";
266 $sql .= " cp.description,";
267 $sql .= " cp.date_debut,";
268 $sql .= " cp.date_fin,";
269 $sql .= " cp.halfday,";
270 $sql .= " cp.statut as status,";
271 $sql .= " cp.fk_validator,";
272 $sql .= " cp.date_valid,";
273 $sql .= " cp.fk_user_valid,";
274 $sql .= " cp.date_approval,";
275 $sql .= " cp.fk_user_approve,";
276 $sql .= " cp.date_refuse,";
277 $sql .= " cp.fk_user_refuse,";
278 $sql .= " cp.date_cancel,";
279 $sql .= " cp.fk_user_cancel,";
280 $sql .= " cp.detail_refuse,";
281 
282 $sql .= " uu.lastname as user_lastname,";
283 $sql .= " uu.firstname as user_firstname,";
284 $sql .= " uu.admin as user_admin,";
285 $sql .= " uu.email as user_email,";
286 $sql .= " uu.login as user_login,";
287 $sql .= " uu.statut as user_status,";
288 $sql .= " uu.photo as user_photo,";
289 
290 $sql .= " ua.lastname as validator_lastname,";
291 $sql .= " ua.firstname as validator_firstname,";
292 $sql .= " ua.admin as validator_admin,";
293 $sql .= " ua.email as validator_email,";
294 $sql .= " ua.login as validator_login,";
295 $sql .= " ua.statut as validator_status,";
296 $sql .= " ua.photo as validator_photo";
297 // Add fields from extrafields
298 if (!empty($extrafields->attributes[$object->table_element]['label'])) {
299  foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
300  $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
301  }
302 }
303 // Add fields from hooks
304 $parameters = array();
305 $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
306 $sql .= $hookmanager->resPrint;
307 
308 $sqlfields = $sql; // $sql fields to remove for count total
309 
310 $sql .= " FROM ".MAIN_DB_PREFIX."holiday as cp";
311 if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
312  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (cp.rowid = ef.fk_object)";
313 }
314 $sql .= ", ".MAIN_DB_PREFIX."user as uu, ".MAIN_DB_PREFIX."user as ua";
315 $sql .= " WHERE cp.entity IN (".getEntity('holiday').")";
316 $sql .= " AND cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid "; // Hack pour la recherche sur le tableau
317 // Search all
318 if (!empty($sall)) {
319  $sql .= natural_search(array_keys($fieldstosearchall), $sall);
320 }
321 // Ref
322 if (!empty($search_ref)) {
323  $sql .= natural_search("cp.ref", $search_ref);
324 }
325 // Start date
326 $sql .= dolSqlDateFilter("cp.date_debut", $search_day_start, $search_month_start, $search_year_start);
327 // End date
328 $sql .= dolSqlDateFilter("cp.date_fin", $search_day_end, $search_month_end, $search_year_end);
329 // Create date
330 $sql .= dolSqlDateFilter("cp.date_create", $search_day_create, $search_month_create, $search_year_create);
331 // Employee
332 if (!empty($search_employee) && $search_employee != -1) {
333  $sql .= " AND cp.fk_user = '".$db->escape($search_employee)."'\n";
334 }
335 // Validator
336 if (!empty($search_valideur) && $search_valideur != -1) {
337  $sql .= " AND cp.fk_validator = '".$db->escape($search_valideur)."'\n";
338 }
339 // Type
340 if (!empty($search_type) && $search_type != -1) {
341  $sql .= ' AND cp.fk_type IN ('.$db->sanitize($db->escape($search_type)).')';
342 }
343 // Status
344 if (!empty($search_status) && $search_status != -1) {
345  $sql .= " AND cp.statut = '".$db->escape($search_status)."'\n";
346 }
347 
348 if (empty($user->rights->holiday->readall)) {
349  $sql .= ' AND cp.fk_user IN ('.$db->sanitize(join(',', $childids)).')';
350 }
351 if ($id > 0) {
352  $sql .= " AND cp.fk_user IN (".$db->sanitize($id).")";
353 }
354 
355 // Add where from extra fields
356 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
357 // Add where from hooks
358 $parameters = array();
359 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
360 $sql .= $hookmanager->resPrint;
361 
362 // Count total nb of records
363 $nbtotalofrecords = '';
364 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
365  /* The fast and low memory method to get and count full list converts the sql into a sql count */
366  $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
367  $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
368  $resql = $db->query($sqlforcount);
369  if ($resql) {
370  $objforcount = $db->fetch_object($resql);
371  $nbtotalofrecords = $objforcount->nbtotalofrecords;
372  } else {
373  dol_print_error($db);
374  }
375 
376  if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
377  $page = 0;
378  $offset = 0;
379  }
380  $db->free($resql);
381 }
382 
383 // Complete request and execute it with limit
384 $sql .= $db->order($sortfield, $sortorder);
385 if ($limit) {
386  $sql .= $db->plimit($limit + 1, $offset);
387 }
388 
389 //print $sql;
390 $resql = $db->query($sql);
391 if ($resql) {
392  $num = $db->num_rows($resql);
393 
394  $arrayofselected = is_array($toselect) ? $toselect : array();
395 
396  $param = '';
397  if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
398  $param .= '&contextpage='.urlencode($contextpage);
399  }
400  if ($limit > 0 && $limit != $conf->liste_limit) {
401  $param .= '&limit='.urlencode($limit);
402  }
403  if ($optioncss != '') {
404  $param .= '&optioncss='.urlencode($optioncss);
405  }
406  if ($search_ref) {
407  $param .= '&search_ref='.urlencode($search_ref);
408  }
409  if ($search_day_create) {
410  $param .= '&search_day_create='.urlencode($search_day_create);
411  }
412  if ($search_month_create) {
413  $param .= '&search_month_create='.urlencode($search_month_create);
414  }
415  if ($search_year_create) {
416  $param .= '&search_year_create='.urlencode($search_year_create);
417  }
418  if ($search_day_start) {
419  $param .= '&search_day_start='.urlencode($search_day_start);
420  }
421  if ($search_month_start) {
422  $param .= '&search_month_start='.urlencode($search_month_start);
423  }
424  if ($search_year_start) {
425  $param .= '&search_year_start='.urlencode($search_year_start);
426  }
427  if ($search_day_end) {
428  $param .= '&search_day_end='.urlencode($search_day_end);
429  }
430  if ($search_month_end) {
431  $param .= '&search_month_end='.urlencode($search_month_end);
432  }
433  if ($search_year_end) {
434  $param .= '&search_year_end='.urlencode($search_year_end);
435  }
436  if ($search_employee > 0) {
437  $param .= '&search_employee='.urlencode($search_employee);
438  }
439  if ($search_valideur > 0) {
440  $param .= '&search_valideur='.urlencode($search_valideur);
441  }
442  if ($search_type > 0) {
443  $param .= '&search_type='.urlencode($search_type);
444  }
445  if ($search_status > 0) {
446  $param .= '&search_status='.urlencode($search_status);
447  }
448  // Add $param from extra fields
449  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
450 
451  // List of mass actions available
452  $arrayofmassactions = array(
453  //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
454  //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
455  //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
456  );
457  if (!empty($user->rights->holiday->delete)) {
458  $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
459  }
460  if (!empty($user->rights->holiday->approve)) {
461  $arrayofmassactions['preapproveleave'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Approve");
462  }
463  if (in_array($massaction, array('presend', 'predelete'))) {
464  $arrayofmassactions = array();
465  }
466  $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
467 
468  // Lines of title fields
469  print '<form id="searchFormList" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
470  if ($optioncss != '') {
471  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
472  }
473  print '<input type="hidden" name="token" value="'.newToken().'">';
474  print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
475  print '<input type="hidden" name="action" value="'.($action == 'edit' ? 'update' : 'list').'">';
476  print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
477  print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
478  print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
479  if ($id > 0) {
480  print '<input type="hidden" name="id" value="'.$id.'">';
481  }
482 
483  if ($id > 0) { // For user tab
484  $title = $langs->trans("User");
485  $linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
486  $head = user_prepare_head($fuser);
487 
488  print dol_get_fiche_head($head, 'paidholidays', $title, -1, 'user');
489 
490  dol_banner_tab($fuser, 'id', $linkback, $user->rights->user->user->lire || $user->admin);
491 
492  if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) {
493  print '<div class="underbanner clearboth"></div>';
494 
495  print '<br>';
496 
497  showMyBalance($object, $user_id);
498  }
499 
500  print dol_get_fiche_end();
501 
502  // Buttons for actions
503 
504  print '<div class="tabsAction">';
505 
506  $cancreate = 0;
507  if (!empty($user->rights->holiday->writeall)) {
508  $cancreate = 1;
509  }
510  if (!empty($user->rights->holiday->write) && in_array($user_id, $childids)) {
511  $cancreate = 1;
512  }
513 
514  if ($cancreate) {
515  print '<a href="'.DOL_URL_ROOT.'/holiday/card.php?action=create&fuserid='.$user_id.'" class="butAction">'.$langs->trans("AddCP").'</a>';
516  }
517 
518  print '</div>';
519  } else {
520  $title = $langs->trans("ListeCP");
521 
522  $newcardbutton = dolGetButtonTitle($langs->trans('MenuAddCP'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/holiday/card.php?action=create', '', $user->rights->holiday->write);
523 
524  print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_hrm', 0, $newcardbutton, '', $limit, 0, 0, 1);
525  }
526 
527  $topicmail = "Information";
528  $modelmail = "leaverequest";
529  $objecttmp = new Holiday($db);
530  $trackid = 'leav'.$object->id;
531  include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
532 
533  if ($sall) {
534  foreach ($fieldstosearchall as $key => $val) {
535  $fieldstosearchall[$key] = $langs->trans($val);
536  }
537  print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
538  }
539 
540  $moreforfilter = '';
541 
542  $parameters = array();
543  $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
544  if (empty($reshook)) {
545  $moreforfilter .= $hookmanager->resPrint;
546  } else {
547  $moreforfilter = $hookmanager->resPrint;
548  }
549 
550  if (!empty($moreforfilter)) {
551  print '<div class="liste_titre liste_titre_bydiv centpercent">';
552  print $moreforfilter;
553  print '</div>';
554  }
555 
556  $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
557  $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields
558  $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
559 
560 
561  $include = '';
562  if (empty($user->rights->holiday->readall)) {
563  $include = 'hierarchyme'; // Can see only its hierarchyl
564  }
565 
566  print '<div class="div-table-responsive">';
567  print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
568 
569 
570  // Filters
571  print '<tr class="liste_titre_filter">';
572  // Action column
573  if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
574  print '<td class="liste_titre maxwidthsearch">';
575  $searchpicto = $form->showFilterButtons('left');
576  print $searchpicto;
577  print '</td>';
578  }
579  if (!empty($arrayfields['cp.ref']['checked'])) {
580  print '<td class="liste_titre">';
581  print '<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
582  print '</td>';
583  }
584 
585  if (!empty($arrayfields['cp.fk_user']['checked'])) {
586  $morefilter = '';
587  if (!empty($conf->global->HOLIDAY_HIDE_FOR_NON_SALARIES)) {
588  $morefilter = 'AND employee = 1';
589  }
590 
591  // User
592  $disabled = 0;
593  // If into the tab holiday of a user ($id is set in such a case)
594  if ($id && !GETPOSTISSET('search_employee')) {
595  $search_employee = $id;
596  $disabled = 1;
597  }
598 
599  print '<td class="liste_titre maxwidthonsmartphone left">';
600  print $form->select_dolusers($search_employee, "search_employee", 1, "", $disabled, $include, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth125');
601  print '</td>';
602  }
603 
604  // Approver
605  if (!empty($arrayfields['cp.fk_validator']['checked'])) {
606  if ($user->hasRight('holiday', 'readall')) {
607  print '<td class="liste_titre maxwidthonsmartphone left">';
608  $validator = new UserGroup($db);
609  $excludefilter = $user->admin ? '' : 'u.rowid <> '.$user->id;
610  $valideurobjects = $validator->listUsersForGroup($excludefilter, 1);
611  $valideurarray = array();
612  foreach ($valideurobjects as $val) {
613  $valideurarray[$val->id] = $val->id;
614  }
615  print $form->select_dolusers($search_valideur, "search_valideur", 1, "", 0, $valideurarray, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth125');
616  print '</td>';
617  } else {
618  print '<td class="liste_titre">&nbsp;</td>';
619  }
620  }
621 
622  // Type
623  if (!empty($arrayfields['cp.fk_type']['checked'])) {
624  print '<td class="liste_titre">';
625  if (empty($mysoc->country_id)) {
626  setEventMessages(null, array($langs->trans("ErrorSetACountryFirst"), $langs->trans("CompanyFoundation")), 'errors');
627  } else {
628  $typeleaves = $holidaystatic->getTypes(1, -1);
629  $arraytypeleaves = array();
630  foreach ($typeleaves as $key => $val) {
631  $labeltoshow = ($langs->trans($val['code']) != $val['code'] ? $langs->trans($val['code']) : $val['label']);
632  //$labeltoshow .= ($val['delay'] > 0 ? ' ('.$langs->trans("NoticePeriod").': '.$val['delay'].' '.$langs->trans("days").')':'');
633  $arraytypeleaves[$val['rowid']] = $labeltoshow;
634  }
635  print $form->selectarray('search_type', $arraytypeleaves, $search_type, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100', 1);
636  }
637  print '</td>';
638  }
639 
640  // Duration
641  if (!empty($arrayfields['duration']['checked'])) {
642  print '<td class="liste_titre">&nbsp;</td>';
643  }
644 
645  // Start date
646  if (!empty($arrayfields['cp.date_debut']['checked'])) {
647  print '<td class="liste_titre center nowraponall">';
648  print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_start" value="'.dol_escape_htmltag($search_month_start).'">';
649  print $formother->selectyear($search_year_start, 'search_year_start', 1, $min_year, $max_year);
650  print '</td>';
651  }
652 
653  // End date
654  if (!empty($arrayfields['cp.date_fin']['checked'])) {
655  print '<td class="liste_titre center nowraponall">';
656  print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_end" value="'.dol_escape_htmltag($search_month_end).'">';
657  print $formother->selectyear($search_year_end, 'search_year_end', 1, $min_year, $max_year);
658  print '</td>';
659  }
660 
661  // Date validation
662  if (!empty($arrayfields['cp.date_valid']['checked'])) {
663  print '<td class="liste_titre center nowraponall">';
664  print '</td>';
665  }
666 
667  // Date appoval
668  if (!empty($arrayfields['cp.date_approval']['checked'])) {
669  print '<td class="liste_titre center nowraponall">';
670  print '</td>';
671  }
672 
673  // Extra fields
674  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
675  // Fields from hook
676  $parameters = array('arrayfields'=>$arrayfields);
677  $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
678  print $hookmanager->resPrint;
679 
680  // Create date
681  if (!empty($arrayfields['cp.date_create']['checked'])) {
682  print '<td class="liste_titre center width200">';
683  print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_create" value="'.dol_escape_htmltag($search_month_create).'">';
684  print $formother->selectyear($search_year_create, 'search_year_create', 1, $min_year, 0);
685  print '</td>';
686  }
687 
688  // Create date
689  if (!empty($arrayfields['cp.tms']['checked'])) {
690  print '<td class="liste_titre center width200">';
691  print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month_update" value="'.dol_escape_htmltag($search_month_update).'">';
692  print $formother->selectyear($search_year_update, 'search_year_update', 1, $min_year, 0);
693  print '</td>';
694  }
695 
696  // Status
697  if (!empty($arrayfields['cp.statut']['checked'])) {
698  print '<td class="liste_titre right">';
699  $object->selectStatutCP($search_status, 'search_status', 'minwidth125');
700  print '</td>';
701  }
702 
703  // Action column
704  if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
705  print '<td class="liste_titre maxwidthsearch">';
706  $searchpicto = $form->showFilterButtons();
707  print $searchpicto;
708  print '</td>';
709  }
710 
711  print "</tr>\n";
712 
713  print '<tr class="liste_titre">';
714  if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
715  print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ');
716  }
717  if (!empty($arrayfields['cp.ref']['checked'])) {
718  print_liste_field_titre($arrayfields['cp.ref']['label'], $_SERVER["PHP_SELF"], "cp.ref", "", $param, '', $sortfield, $sortorder);
719  }
720  if (!empty($arrayfields['cp.fk_user']['checked'])) {
721  print_liste_field_titre($arrayfields['cp.fk_user']['label'], $_SERVER["PHP_SELF"], "cp.fk_user", "", $param, '', $sortfield, $sortorder);
722  }
723  if (!empty($arrayfields['cp.fk_validator']['checked'])) {
724  print_liste_field_titre($arrayfields['cp.fk_validator']['label'], $_SERVER["PHP_SELF"], "cp.fk_validator", "", $param, '', $sortfield, $sortorder);
725  }
726  if (!empty($arrayfields['cp.fk_type']['checked'])) {
727  print_liste_field_titre($arrayfields['cp.fk_type']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
728  }
729  if (!empty($arrayfields['duration']['checked'])) {
730  print_liste_field_titre($arrayfields['duration']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right maxwidth100');
731  }
732  if (!empty($arrayfields['cp.date_debut']['checked'])) {
733  print_liste_field_titre($arrayfields['cp.date_debut']['label'], $_SERVER["PHP_SELF"], "cp.date_debut", "", $param, '', $sortfield, $sortorder, 'center ');
734  }
735  if (!empty($arrayfields['cp.date_fin']['checked'])) {
736  print_liste_field_titre($arrayfields['cp.date_fin']['label'], $_SERVER["PHP_SELF"], "cp.date_fin", "", $param, '', $sortfield, $sortorder, 'center ');
737  }
738  if (!empty($arrayfields['cp.date_valid']['checked'])) {
739  print_liste_field_titre($arrayfields['cp.date_valid']['label'], $_SERVER["PHP_SELF"], "cp.date_valid", "", $param, '', $sortfield, $sortorder, 'center ');
740  }
741  if (!empty($arrayfields['cp.date_approval']['checked'])) {
742  print_liste_field_titre($arrayfields['cp.date_approval']['label'], $_SERVER["PHP_SELF"], "cp.date_approval", "", $param, '', $sortfield, $sortorder, 'center ');
743  }
744  // Extra fields
745  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
746  // Hook fields
747  $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
748  $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
749  print $hookmanager->resPrint;
750  if (!empty($arrayfields['cp.date_create']['checked'])) {
751  print_liste_field_titre($arrayfields['cp.date_create']['label'], $_SERVER["PHP_SELF"], "cp.date_create", "", $param, '', $sortfield, $sortorder, 'center ');
752  }
753  if (!empty($arrayfields['cp.tms']['checked'])) {
754  print_liste_field_titre($arrayfields['cp.tms']['label'], $_SERVER["PHP_SELF"], "cp.tms", "", $param, '', $sortfield, $sortorder, 'center ');
755  }
756  if (!empty($arrayfields['cp.statut']['checked'])) {
757  print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "cp.statut", "", $param, '', $sortfield, $sortorder, 'right ');
758  }
759  if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
760  print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ');
761  }
762  print "</tr>\n";
763 
764  $listhalfday = array('morning'=>$langs->trans("Morning"), "afternoon"=>$langs->trans("Afternoon"));
765 
766 
767  // If we ask a dedicated card and not allow to see it, we force on user.
768  if ($id && empty($user->rights->holiday->readall) && !in_array($id, $childids)) {
769  $langs->load("errors");
770  print '<tr class="oddeven opacitymediuem"><td colspan="10">'.$langs->trans("NotEnoughPermissions").'</td></tr>';
771  $result = 0;
772  } elseif ($num > 0 && !empty($mysoc->country_id)) {
773  // Lines
774  $userstatic = new User($db);
775  $approbatorstatic = new User($db);
776 
777  $typeleaves = $object->getTypes(1, -1);
778 
779  $i = 0;
780  $totalarray = array();
781  $totalarray['nbfield'] = 0;
782  $totalduration = 0;
783  while ($i < min($num, $limit)) {
784  $obj = $db->fetch_object($resql);
785 
786  // Leave request
787  $holidaystatic->id = $obj->rowid;
788  $holidaystatic->ref = ($obj->ref ? $obj->ref : $obj->rowid);
789  $holidaystatic->statut = $obj->status;
790  $holidaystatic->date_debut = $db->jdate($obj->date_debut);
791 
792  // User
793  $userstatic->id = $obj->fk_user;
794  $userstatic->lastname = $obj->user_lastname;
795  $userstatic->firstname = $obj->user_firstname;
796  $userstatic->admin = $obj->user_admin;
797  $userstatic->email = $obj->user_email;
798  $userstatic->login = $obj->user_login;
799  $userstatic->statut = $obj->user_status;
800  $userstatic->photo = $obj->user_photo;
801 
802  // Validator
803  $approbatorstatic->id = $obj->fk_validator;
804  $approbatorstatic->lastname = $obj->validator_lastname;
805  $approbatorstatic->firstname = $obj->validator_firstname;
806  $approbatorstatic->admin = $obj->validator_admin;
807  $approbatorstatic->email = $obj->validator_email;
808  $approbatorstatic->login = $obj->validator_login;
809  $approbatorstatic->statut = $obj->validator_status;
810  $approbatorstatic->photo = $obj->validator_photo;
811 
812  $date = $obj->date_create;
813  $date_modif = $obj->date_update;
814 
815  $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ? 'afternoon' : 'morning';
816  $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ? 'morning' : 'afternoon';
817 
818  print '<tr class="oddeven">';
819  // Action column
820  if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
821  print '<td class="nowrap center">';
822  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
823  $selected = 0;
824  if (in_array($obj->rowid, $arrayofselected)) {
825  $selected = 1;
826  }
827  print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
828  }
829  print '</td>';
830  if (!$i) {
831  $totalarray['nbfield']++;
832  }
833  }
834  if (!empty($arrayfields['cp.ref']['checked'])) {
835  print '<td class="nowraponall">';
836  print $holidaystatic->getNomUrl(1, 1);
837  print '</td>';
838  if (!$i) {
839  $totalarray['nbfield']++;
840  }
841  }
842  if (!empty($arrayfields['cp.fk_user']['checked'])) {
843  print '<td class="tdoverflowmax125">'.$userstatic->getNomUrl(-1, 'leave').'</td>';
844  if (!$i) {
845  $totalarray['nbfield']++;
846  }
847  }
848  if (!empty($arrayfields['cp.fk_validator']['checked'])) {
849  print '<td class="tdoverflowmax125">'.$approbatorstatic->getNomUrl(-1).'</td>';
850  if (!$i) {
851  $totalarray['nbfield']++;
852  }
853  }
854  if (!empty($arrayfields['cp.fk_type']['checked'])) {
855  if (empty($typeleaves[$obj->fk_type])) {
856  $labeltypeleavetoshow = $langs->trans("TypeWasDisabledOrRemoved", $obj->fk_type);
857  } else {
858  $labeltypeleavetoshow = ($langs->trans($typeleaves[$obj->fk_type]['code']) != $typeleaves[$obj->fk_type]['code'] ? $langs->trans($typeleaves[$obj->fk_type]['code']) : $typeleaves[$obj->fk_type]['label']);
859  }
860 
861  print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($labeltypeleavetoshow).'">';
862  print $labeltypeleavetoshow;
863  print '</td>';
864  if (!$i) {
865  $totalarray['nbfield']++;
866  }
867  }
868  if (!empty($arrayfields['duration']['checked'])) {
869  print '<td class="right">';
870  $nbopenedday = num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday); // user jdate(..., 1) because num_open_day need UTC dates
871  $totalduration += $nbopenedday;
872  print $nbopenedday;
873  //print ' '.$langs->trans('DurationDays');
874  print '</td>';
875  if (!$i) {
876  $totalarray['nbfield']++;
877  }
878  }
879  if (!empty($arrayfields['cp.date_debut']['checked'])) {
880  print '<td class="center">';
881  print dol_print_date($db->jdate($obj->date_debut), 'day');
882  print ' <span class="opacitymedium nowraponall">('.$langs->trans($listhalfday[$starthalfday]).')</span>';
883  print '</td>';
884  if (!$i) {
885  $totalarray['nbfield']++;
886  }
887  }
888  if (!empty($arrayfields['cp.date_fin']['checked'])) {
889  print '<td class="center">';
890  print dol_print_date($db->jdate($obj->date_fin), 'day');
891  print ' <span class="opacitymedium nowraponall">('.$langs->trans($listhalfday[$endhalfday]).')</span>';
892  print '</td>';
893  if (!$i) {
894  $totalarray['nbfield']++;
895  }
896  }
897  // Date validation
898  if (!empty($arrayfields['cp.date_valid']['checked'])) { // date_valid is both date_valid but also date_approval
899  print '<td class="center" title="'.dol_print_date($db->jdate($obj->date_valid), 'dayhour').'">';
900  print dol_print_date($db->jdate($obj->date_valid), 'day');
901  print '</td>';
902  if (!$i) $totalarray['nbfield']++;
903  }
904  // Date approval
905  if (!empty($arrayfields['cp.date_approval']['checked'])) {
906  print '<td class="center" title="'.dol_print_date($db->jdate($obj->date_approval), 'dayhour').'">';
907  print dol_print_date($db->jdate($obj->date_approval), 'day');
908  print '</td>';
909  if (!$i) $totalarray['nbfield']++;
910  }
911 
912  // Extra fields
913  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
914  // Fields from hook
915  $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
916  $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
917  print $hookmanager->resPrint;
918 
919  // Date creation
920  if (!empty($arrayfields['cp.date_create']['checked'])) {
921  print '<td style="text-align: center;">'.dol_print_date($date, 'dayhour').'</td>';
922  if (!$i) {
923  $totalarray['nbfield']++;
924  }
925  }
926  if (!empty($arrayfields['cp.tms']['checked'])) {
927  print '<td style="text-align: center;">'.dol_print_date($date_modif, 'dayhour').'</td>';
928  if (!$i) {
929  $totalarray['nbfield']++;
930  }
931  }
932  if (!empty($arrayfields['cp.statut']['checked'])) {
933  print '<td class="right nowrap">'.$holidaystatic->getLibStatut(5).'</td>';
934  if (!$i) {
935  $totalarray['nbfield']++;
936  }
937  }
938 
939  // Action column
940  if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
941  print '<td class="nowrap center">';
942  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
943  $selected = 0;
944  if (in_array($obj->rowid, $arrayofselected)) {
945  $selected = 1;
946  }
947  print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
948  }
949  print '</td>';
950  if (!$i) {
951  $totalarray['nbfield']++;
952  }
953  }
954 
955  print '</tr>'."\n";
956 
957  $i++;
958  }
959 
960  // Add a line for total if there is a total to show
961  if (!empty($arrayfields['duration']['checked'])) {
962  print '<tr class="total">';
963  if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
964  print '<td></td>';
965  }
966  foreach ($arrayfields as $key => $val) {
967  if (!empty($val['checked'])) {
968  if ($key == 'duration') {
969  print '<td class="right">'.$totalduration.' '.$langs->trans('DurationDays').'</td>';
970  } else {
971  print '<td></td>';
972  }
973  }
974  }
975  // status
976  if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
977  print '<td></td>';
978  }
979  print '</tr>';
980  }
981  }
982 
983  // Si il n'y a pas d'enregistrement suite à une recherche
984  if ($num == 0) {
985  $colspan = 1;
986  foreach ($arrayfields as $key => $val) {
987  if (!empty($val['checked'])) {
988  $colspan++;
989  }
990  }
991  print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
992  }
993 
994  print '</table>';
995  print '</div>';
996 
997  print '</form>';
998 } else {
999  dol_print_error($db);
1000 }
1001 
1002 // End of page
1003 llxFooter();
1004 $db->close();
1005 
1006 
1007 
1008 
1009 
1017 function showMyBalance($holiday, $user_id)
1018 {
1019  global $conf, $langs;
1020 
1021  $alltypeleaves = $holiday->getTypes(1, -1); // To have labels
1022 
1023  $out = '';
1024  $nb_holiday = 0;
1025  $typeleaves = $holiday->getTypes(1, 1);
1026  foreach ($typeleaves as $key => $val) {
1027  $nb_type = $holiday->getCPforUser($user_id, $val['rowid']);
1028  $nb_holiday += $nb_type;
1029  $out .= ' - '.$val['label'].': <strong>'.($nb_type ?price2num($nb_type) : 0).'</strong><br>';
1030  }
1031  print $langs->trans('SoldeCPUser', round($nb_holiday, 5)).'<br>';
1032  print $out;
1033 }
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 offer components to list and upload files.
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:47
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:745
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $excludefirstand=0, $gm=false)
Generate a SQL string to make a filter into a range (for second of date until last second of date).
Definition: date.lib.php:358
num_open_day($timestampStart, $timestampEnd, $inhour=0, $lastday=0, $halfday=0, $country_code='')
Function to return number of working days (and text of units) between two dates (working days)
Definition: date.lib.php:1015
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show 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.
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.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
showMyBalance($holiday, $user_id)
Show balance of user.
Definition: list.php:1017
$nbtotalofrecords
Count total nb of records.
Definition: list.php:329
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
user_prepare_head(User $object)
Prepare array with list of tabs.