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