dolibarr 24.0.0-beta
month_report.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2011 François Legastelois <flegastelois@teclib.com>
4 * Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
5 * Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
6 * Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
7 * Copyright (C) 2025-2026 MDW <mdeweerd@users.noreply.github.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
29// Load Dolibarr environment
30require '../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
39require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
40require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
41require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
42require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
43
44// Load translation files required by the page
45$langs->loadLangs(array('holiday', 'hrm'));
46
47$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view';
48$massaction = GETPOST('massaction', 'alpha');
49$contextpage = GETPOST('contextpage', 'aZ');
50$optioncss = GETPOST('optioncss', 'aZ');
51
52$id = GETPOSTINT('id');
53
54$search_ref = GETPOST('search_ref', 'alphanohtml');
55$search_employee = GETPOST('search_employee', "intcomma");
56$search_type = GETPOST('search_type', "intcomma");
57$search_description = GETPOST('search_description', 'alphanohtml');
58
59$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
60$sortfield = GETPOST('sortfield', 'aZ09comma');
61$sortorder = GETPOST('sortorder', 'aZ09comma');
62
63if (!$sortfield) {
64 $sortfield = "cp.rowid";
65}
66if (!$sortorder) {
67 $sortorder = "ASC";
68}
69
70$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
71if (empty($page) || $page == -1) {
72 $page = 0;
73}
74
75$hookmanager->initHooks(array('leavemovementlist'));
76
77$arrayfields = array();
78$arrayofmassactions = array();
79
80// Security check
81if ($user->socid > 0) { // Protection if external user
82 //$socid = $user->socid;
84}
85$result = restrictedArea($user, 'holiday', $id);
86
87if (!$user->hasRight('holiday', 'readall')) {
89}
90
91
92/*
93 * Actions
94 */
95
96if (GETPOST('cancel', 'alpha')) {
97 $action = 'list';
98 $massaction = '';
99}
100if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
101 $massaction = '';
102}
103
104$parameters = array();
105$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
106if ($reshook < 0) {
107 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
108}
109
110if (empty($reshook)) {
111 // Selection of new fields
112 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
113
114 // Purge search criteria
115 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
116 $search_ref = '';
117 $search_employee = '';
118 $search_type = '';
119 $search_description = '';
120 $toselect = array();
121 $search_array_options = array();
122 }
123
124 if (GETPOST('button_removefilter_x', 'alpha')
125 || GETPOST('button_removefilter.x', 'alpha')
126 || GETPOST('button_removefilter', 'alpha')
127 || GETPOST('button_search_x', 'alpha')
128 || GETPOST('button_search.x', 'alpha')
129 || GETPOST('button_search', 'alpha')) {
130 $massaction = '';
131 }
132}
133
134$arrayfields = array(
135 'cp.ref' => array('label' => 'Ref', 'checked' => '1', 'position' => 5),
136 'cp.fk_type' => array('label' => 'Type', 'checked' => '1', 'position' => 10),
137 'cp.fk_user' => array('label' => 'Employee', 'checked' => '1', 'position' => 20),
138 'cp.date_debut' => array('label' => 'DateDebCP', 'checked' => '-1', 'position' => 30),
139 'cp.date_fin' => array('label' => 'DateFinCP', 'checked' => '-1', 'position' => 32),
140 'used_days' => array('label' => 'NbUseDaysCPShort', 'checked' => '-1', 'position' => 34),
141 'date_start_month' => array('label' => 'DateStartInMonth', 'checked' => '1', 'position' => 50),
142 'date_end_month' => array('label' => 'DateEndInMonth', 'checked' => '1', 'position' => 52),
143 'used_days_month' => array('label' => 'NbUseDaysCPShortInMonth', 'checked' => '1', 'position' => 54),
144 'cp.description' => array('label' => 'DescCP', 'checked' => '-1', 'position' => 800),
145);
146
147
148/*
149 * View
150 */
151
152$form = new Form($db);
153$formother = new FormOther($db);
154$holidaystatic = new Holiday($db);
155
156$listhalfday = array('morning' => $langs->trans("Morning"), "afternoon" => $langs->trans("Afternoon"));
157
158$title = $langs->trans('CPTitreMenu');
159$help_url = 'EN:Module_Holiday';
160
161llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-holiday page-month_report');
162
163$search_month = GETPOSTINT("search_month") ? GETPOSTINT("search_month") : (int) dol_print_date(dol_now(), "%m");
164$search_year = GETPOSTINT("search_year") ? GETPOSTINT("search_year") : (int) dol_print_date(dol_now(), "%Y");
165$year_month = sprintf("%04d", $search_year).'-'.sprintf("%02d", $search_month);
166
167$sql = "SELECT cp.rowid, cp.ref, cp.fk_user, cp.date_debut, cp.date_fin, cp.fk_type, cp.description, cp.halfday, cp.statut as status";
168$sql .= " FROM ".MAIN_DB_PREFIX."holiday cp";
169$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user u ON cp.fk_user = u.rowid";
170$sql .= " WHERE cp.entity IN (".getEntity('holiday').") AND cp.rowid > 0";
171$sql .= " AND cp.statut = ".Holiday::STATUS_APPROVED;
172$sql .= " AND (";
173$sql .= " (date_format(cp.date_debut, '%Y-%m') = '".$db->escape($year_month)."' OR date_format(cp.date_fin, '%Y-%m') = '".$db->escape($year_month)."')";
174$sql .= " OR"; // For leave over several months
175$sql .= " (date_format(cp.date_debut, '%Y-%m') < '".$db->escape($year_month)."' AND date_format(cp.date_fin, '%Y-%m') > '".$db->escape($year_month)."') ";
176$sql .= " )";
177if (!empty($search_ref)) {
178 $sql .= natural_search('cp.ref', $search_ref);
179}
180if (!empty($search_employee) && $search_employee != '-1') {
181 $sql .= " AND cp.fk_user IN (".$db->sanitize($search_employee).")";
182}
183if (!empty($search_type) && $search_type != '-1') {
184 $sql .= " AND cp.fk_type IN (".$db->sanitize($search_type).")";
185}
186if (!empty($search_description)) {
187 $sql .= natural_search('cp.description', $search_description);
188}
189
190$sql .= $db->order($sortfield, $sortorder);
191
192$resql = $db->query($sql);
193if (empty($resql)) {
195 exit;
196}
197
198$num = $db->num_rows($resql);
199
200$param = '';
201if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
202 $param .= '&contextpage='.urlencode($contextpage);
203}
204if ($limit > 0 && $limit != $conf->liste_limit) {
205 $param .= '&limit='.((int) $limit);
206}
207if (!empty($search_ref)) {
208 $param .= '&search_ref='.urlencode($search_ref);
209}
210if (!empty($search_employee) && $search_employee != '-1') {
211 $param .= '&search_employee='.urlencode($search_employee);
212}
213if (!empty($search_type) && $search_type != '-1') {
214 $param .= '&search_type='.urlencode($search_type);
215}
216if (!empty($search_description)) {
217 $param .= '&search_description='.urlencode($search_description);
218}
219if (!empty($search_month)) {
220 $param .= '&search_month='.((int) $search_month);
221}
222if (!empty($search_year)) {
223 $param .= '&search_year='.((int) $search_year);
224}
225
226print '<form method="POST" id="searchFormList" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
227if ($optioncss != '') {
228 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
229}
230print '<input type="hidden" name="token" value="'.newToken().'">';
231print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
232print '<input type="hidden" name="action" value="list">';
233print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
234print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
235print '<input type="hidden" name="page" value="'.$page.'">';
236print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
237
238print load_fiche_titre($langs->trans('MenuReportMonth'), '', 'title_hrm');
239
240// Selection filter
241print '<div class="tabBar">';
242print $formother->select_month($search_month, 'search_month', 0, 1, 'minwidth75 maxwidth150imp valignmiddle', true);
243print $formother->selectyear($search_year, 'search_year', 0, 10, 5, 0, 0, '', 'valignmiddle width75', true);
244print '<input type="submit" class="button smallpaddingimp" value="'.dolPrintHTMLForAttribute($langs->trans("Search")).'" />';
245print '</div>';
246print '<br>';
247
248//$moreforfilter = '';
249
250$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
251$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column); // This also change content of $arrayfields
252$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
253
254print '<div class="div-table-responsive">';
255print '<table class="tagtable nobottomiftotal liste">';
256
257print '<tr class="liste_titre_filter">';
258
259// Action column
260if ($conf->main_checkbox_left_column) {
261 print '<th class="wrapcolumntitle center maxwidthsearch liste_titre">';
262 $searchpicto = $form->showFilterButtons('left');
263 print $searchpicto;
264 print '</th>';
265}
266
267// Filter: Ref
268if (!empty($arrayfields['cp.ref']['checked'])) {
269 print '<th class="liste_titre">';
270 print '<input class="flat maxwidth100" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
271 print '</th>';
272}
273
274// Filter: Type
275$arraytypeleaves = array();
276if (!empty($arrayfields['cp.fk_type']['checked'])) {
277 $typeleaves = $holidaystatic->getTypes(1, -1);
278 foreach ($typeleaves as $key => $val) {
279 $labeltoshow = ($langs->trans($val['code']) != $val['code'] ? $langs->trans($val['code']) : $val['label']);
280 $arraytypeleaves[$val['rowid']] = $labeltoshow;
281 }
282
283 print '<th class="liste_titre">';
284 print $form->selectarray('search_type', $arraytypeleaves, $search_type, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1);
285 print '</th>';
286}
287
288// Filter: Employee
289if (!empty($arrayfields['cp.fk_user']['checked'])) {
290 print '<th class="liste_titre">';
291 print $form->select_dolusers($search_employee, "search_employee", 1, null, 0, '', '', '0', 0, 0, '', 0, '', 'maxwidth150');
292 print '</th>';
293}
294
295if (!empty($arrayfields['cp.date_debut']['checked'])) {
296 print '<th class="liste_titre"></th>';
297}
298if (!empty($arrayfields['cp.date_fin']['checked'])) {
299 print '<th class="liste_titre"></th>';
300}
301if (!empty($arrayfields['used_days']['checked'])) {
302 print '<th class="liste_titre"></th>';
303}
304if (!empty($arrayfields['date_start_month']['checked'])) {
305 print '<th class="liste_titre"></th>';
306}
307if (!empty($arrayfields['date_end_month']['checked'])) {
308 print '<th class="liste_titre"></th>';
309}
310if (!empty($arrayfields['used_days_month']['checked'])) {
311 print '<th class="liste_titre"></th>';
312}
313
314// Filter: Description
315if (!empty($arrayfields['cp.description']['checked'])) {
316 print '<th class="liste_titre">';
317 print '<input type="text" class="maxwidth100" name="search_description" value="'.$search_description.'">';
318 print '</th>';
319}
320// Action column
321if (!$conf->main_checkbox_left_column) {
322 print '<th class="liste_titre maxwidthsearch">';
323 $searchpicto = $form->showFilterButtons();
324 print $searchpicto;
325 print '</th>';
326}
327print '</tr>';
328
329print '<tr class="liste_titre">';
330// Action column
331if ($conf->main_checkbox_left_column) {
332 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
333}
334if (!empty($arrayfields['cp.ref']['checked'])) {
335 print_liste_field_titre($arrayfields['cp.ref']['label'], $_SERVER["PHP_SELF"], 'cp.ref', '', $param, '', $sortfield, $sortorder);
336}
337if (!empty($arrayfields['cp.fk_type']['checked'])) {
338 print_liste_field_titre($arrayfields['cp.fk_type']['label'], $_SERVER["PHP_SELF"], 'cp.fk_type', '', $param, '', $sortfield, $sortorder);
339}
340if (!empty($arrayfields['cp.fk_user']['checked'])) {
341 print_liste_field_titre($arrayfields['cp.fk_user']['label'], $_SERVER["PHP_SELF"], 'u.lastname', '', $param, '', $sortfield, $sortorder);
342}
343if (!empty($arrayfields['ct.label']['checked'])) {
344 print_liste_field_titre($arrayfields['ct.label']['label'], $_SERVER["PHP_SELF"], 'ct.label', '', $param, '', $sortfield, $sortorder);
345}
346if (!empty($arrayfields['cp.date_debut']['checked'])) {
347 print_liste_field_titre($arrayfields['cp.date_debut']['label'], $_SERVER["PHP_SELF"], 'cp.date_debut', '', $param, '', $sortfield, $sortorder, 'center ');
348}
349if (!empty($arrayfields['cp.date_fin']['checked'])) {
350 print_liste_field_titre($arrayfields['cp.date_fin']['label'], $_SERVER["PHP_SELF"], 'cp.date_fin', '', $param, '', $sortfield, $sortorder, 'center ');
351}
352if (!empty($arrayfields['used_days']['checked'])) {
353 print_liste_field_titre($arrayfields['used_days']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'maxwidth125 right ');
354}
355if (!empty($arrayfields['date_start_month']['checked'])) {
356 print_liste_field_titre($arrayfields['date_start_month']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
357}
358if (!empty($arrayfields['date_end_month']['checked'])) {
359 print_liste_field_titre($arrayfields['date_end_month']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
360}
361if (!empty($arrayfields['used_days_month']['checked'])) {
362 print_liste_field_titre($arrayfields['used_days_month']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'maxwidth125 right ');
363}
364if (!empty($arrayfields['cp.description']['checked'])) {
365 print_liste_field_titre($arrayfields['cp.description']['label'], $_SERVER["PHP_SELF"], 'cp.description', '', $param, '', $sortfield, $sortorder);
366}
367// Action column
368if (!$conf->main_checkbox_left_column) {
369 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
370}
371print '</tr>';
372
373if ($num == 0) {
374 print '<tr><td colspan="11"><span class="opacitymedium">'.$langs->trans('None').'</span></td></tr>';
375} else {
376 $tmpuser = new User($db);
377 while ($obj = $db->fetch_object($resql)) {
378 $tmpuser->fetch($obj->fk_user);
379
380 $date_start = $db->jdate($obj->date_debut, true);
381 $date_end = $db->jdate($obj->date_fin, true);
382
383 $tmpstart = dol_getdate($date_start);
384 $tmpend = dol_getdate($date_end);
385
386 $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ? 'afternoon' : 'morning';
387 $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ? 'morning' : 'afternoon';
388
389 $halfdayinmonth = $obj->halfday;
390 $starthalfdayinmonth = $starthalfday;
391 $endhalfdayinmonth = $endhalfday;
392
393 //0:Full days, 2:Start afternoon end morning, -1:Start afternoon end afternoon, 1:Start morning end morning
394
395 // Set date_start_gmt and date_end_gmt that are date to show for the selected month
396 $date_start_inmonth = $db->jdate($obj->date_debut, true);
397 $date_end_inmonth = $db->jdate($obj->date_fin, true);
398 if ($tmpstart['year'] < $search_year || $tmpstart['mon'] < $search_month) {
399 $date_start_inmonth = dol_get_first_day($search_year, $search_month, true);
400 $starthalfdayinmonth = 'morning';
401 if ($halfdayinmonth == 2) {
402 $halfdayinmonth = 1;
403 }
404 if ($halfdayinmonth == -1) {
405 $halfdayinmonth = 0;
406 }
407 }
408 if ($tmpend['year'] > $search_year || $tmpend['mon'] > $search_month) {
409 $date_end_inmonth = dol_get_last_day($search_year, $search_month, true) - ((24 * 3600) - 1);
410 $endhalfdayinmonth = 'afternoon';
411 if ($halfdayinmonth == 2) {
412 $halfdayinmonth = -1;
413 }
414 if ($halfdayinmonth == 1) {
415 $halfdayinmonth = 0;
416 }
417 }
418
419 // Leave request
420 $holidaystatic->id = $obj->rowid;
421 $holidaystatic->ref = $obj->ref;
422 $holidaystatic->status = $obj->status;
423 $holidaystatic->status = $obj->status;
424 $holidaystatic->fk_user = $obj->fk_user;
425 $holidaystatic->fk_type = $obj->fk_type;
426 $holidaystatic->description = $obj->description;
427 $holidaystatic->halfday = $obj->halfday;
428 $holidaystatic->date_debut = $db->jdate($obj->date_debut);
429 $holidaystatic->date_fin = $db->jdate($obj->date_fin);
430
431
432 print '<tr class="oddeven">';
433 // Action column
434 if ($conf->main_checkbox_left_column) {
435 print '<td></td>';
436 }
437
438 if (!empty($arrayfields['cp.ref']['checked'])) {
439 print '<td class="nowraponall">'.$holidaystatic->getNomUrl(1, 1).'</td>';
440 }
441 if (!empty($arrayfields['cp.fk_type']['checked'])) {
442 print '<td>'.$arraytypeleaves[$obj->fk_type].'</td>';
443 }
444 if (!empty($arrayfields['cp.fk_user']['checked'])) {
445 print '<td class="tdoverflowmax150">'.$tmpuser->getNomUrl(-1).'</td>';
446 }
447
448 if (!empty($arrayfields['cp.date_debut']['checked'])) {
449 print '<td class="center">'.dol_print_date($db->jdate($obj->date_debut), 'day');
450 print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$starthalfday]).')</span>';
451 print '</td>';
452 }
453
454 if (!empty($arrayfields['cp.date_fin']['checked'])) {
455 print '<td class="center">'.dol_print_date($db->jdate($obj->date_fin), 'day');
456 print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$endhalfday]).')</span>';
457 print '</td>';
458 }
459
460 if (!empty($arrayfields['used_days']['checked'])) {
461 print '<td class="right">'.num_open_day($date_start, $date_end, 0, 1, $obj->halfday, $tmpuser->country_id, $obj->fk_user).'</td>';
462 }
463
464 if (!empty($arrayfields['date_start_month']['checked'])) {
465 print '<td class="center">'.dol_print_date($date_start_inmonth, 'day');
466 print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$starthalfdayinmonth]).')</span>';
467 print '</td>';
468 }
469
470 if (!empty($arrayfields['date_end_month']['checked'])) {
471 print '<td class="center">'.dol_print_date($date_end_inmonth, 'day');
472 print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$endhalfdayinmonth]).')</span>';
473 print '</td>';
474 }
475
476 if (!empty($arrayfields['used_days_month']['checked'])) {
477 print '<td class="right">'.num_open_day($date_start_inmonth, $date_end_inmonth, 0, 1, $halfdayinmonth, $tmpuser->country_id, $obj->fk_user).'</td>';
478 }
479 if (!empty($arrayfields['cp.description']['checked'])) {
480 print '<td class="maxwidth300 small">';
481 print '<div class="twolinesmax">';
482 print dolGetFirstLineOfText(dol_string_nohtmltag($obj->description, 1));
483 print '</div>';
484 print '</td>';
485 }
486 // Action column
487 if (!$conf->main_checkbox_left_column) {
488 print '<td></td>';
489 }
490 print '</tr>';
491 }
492}
493print '</table>';
494print '</div>';
495print '</form>';
496
497// End of page
498llxFooter();
499$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
Class to manage generation of HTML components Only common components must be here.
Class to help generate other html components Only common components are here.
Class of the module paid holiday.
Class to manage Dolibarr users.
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
Definition date.lib.php:604
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
Definition date.lib.php:623
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
$date_start
Variables from include:
dol_now($mode='gmt')
Return date for now.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
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.