dolibarr  17.0.4
cabyprodserv.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2013 Antoine Iauch <aiauch@gpcsolutions.fr>
3  * Copyright (C) 2013-2016 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
5  * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
6  * Copyright (C) 2022 Alexandre Spangaro <aspangaro@open-dsi.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 
27 // Load Dolibarr environment
28 require '../../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
33 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
34 
35 // Load translation files required by the page
36 $langs->loadLangs(array("products", "categories", "errors", 'accountancy'));
37 
38 // Security pack (data & check)
39 $socid = GETPOST('socid', 'int');
40 
41 if ($user->socid > 0) {
42  $socid = $user->socid;
43 }
44 if (isModEnabled('comptabilite')) {
45  $result = restrictedArea($user, 'compta', '', '', 'resultat');
46 }
47 if (isModEnabled('accounting')) {
48  $result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
49 }
50 
51 // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES')
52 $modecompta = $conf->global->ACCOUNTING_MODE;
53 if (GETPOST("modecompta")) {
54  $modecompta = GETPOST("modecompta");
55 }
56 
57 $sortorder = GETPOST("sortorder", 'aZ09comma');
58 $sortfield = GETPOST("sortfield", 'aZ09comma');
59 if (!$sortorder) {
60  $sortorder = "asc";
61 }
62 if (!$sortfield) {
63  $sortfield = "ref";
64 }
65 
66 // Category
67 $selected_cat = (int) GETPOST('search_categ', 'int');
68 $selected_soc = (int) GETPOST('search_soc', 'int');
69 $subcat = false;
70 if (GETPOST('subcat', 'alpha') === 'yes') {
71  $subcat = true;
72 }
73 $categorie = new Categorie($db);
74 
75 // product/service
76 $selected_type = GETPOST('search_type', 'int');
77 if ($selected_type == '') {
78  $selected_type = -1;
79 }
80 
81 // Hook
82 $hookmanager->initHooks(array('cabyprodservlist'));
83 
84 // Date range
85 $year = GETPOST("year");
86 $month = GETPOST("month");
87 $date_startyear = GETPOST("date_startyear");
88 $date_startmonth = GETPOST("date_startmonth");
89 $date_startday = GETPOST("date_startday");
90 $date_endyear = GETPOST("date_endyear");
91 $date_endmonth = GETPOST("date_endmonth");
92 $date_endday = GETPOST("date_endday");
93 if (empty($year)) {
94  $year_current = dol_print_date(dol_now(), '%Y');
95  $month_current = dol_print_date(dol_now(), '%m');
96  $year_start = $year_current;
97 } else {
98  $year_current = $year;
99  $month_current = dol_print_date(dol_now(), '%m');
100  $year_start = $year;
101 }
102 $date_start = dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear"), 'tzserver'); // We use timezone of server so report is same from everywhere
103 $date_end = dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear"), 'tzserver'); // We use timezone of server so report is same from everywhere
104 // Quarter
105 if (empty($date_start) || empty($date_end)) { // We define date_start and date_end
106  $q = GETPOST("q", "int");
107  if (empty($q)) {
108  // We define date_start and date_end
109  $month_start = GETPOST("month") ?GETPOST("month") : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
110  $year_end = $year_start;
111  $month_end = $month_start;
112  if (!GETPOST("month")) { // If month not forced
113  if (!GETPOST('year') && $month_start > $month_current) {
114  $year_start--;
115  $year_end--;
116  }
117  $month_end = $month_start - 1;
118  if ($month_end < 1) {
119  $month_end = 12;
120  } else {
121  $year_end++;
122  }
123  }
124  $date_start = dol_get_first_day($year_start, $month_start, false);
125  $date_end = dol_get_last_day($year_end, $month_end, false);
126  } else {
127  if ($q == 1) {
128  $date_start = dol_get_first_day($year_start, 1, false);
129  $date_end = dol_get_last_day($year_start, 3, false);
130  }
131  if ($q == 2) {
132  $date_start = dol_get_first_day($year_start, 4, false);
133  $date_end = dol_get_last_day($year_start, 6, false);
134  }
135  if ($q == 3) {
136  $date_start = dol_get_first_day($year_start, 7, false);
137  $date_end = dol_get_last_day($year_start, 9, false);
138  }
139  if ($q == 4) {
140  $date_start = dol_get_first_day($year_start, 10, false);
141  $date_end = dol_get_last_day($year_start, 12, false);
142  }
143  }
144 } else {
145  // TODO We define q
146 }
147 
148 // $date_start and $date_end are defined. We force $year_start and $nbofyear
149 $tmps = dol_getdate($date_start);
150 $year_start = $tmps['year'];
151 $tmpe = dol_getdate($date_end);
152 $year_end = $tmpe['year'];
153 $nbofyear = ($year_end - $year_start) + 1;
154 
155 $commonparams = array();
156 if (!empty($modecompta)) {
157  $commonparams['modecompta'] = $modecompta;
158 }
159 if (!empty($sortorder)) {
160  $commonparams['sortorder'] = $sortorder;
161 }
162 if (!empty($sortfield)) {
163  $commonparams['sortfield'] = $sortfield;
164 }
165 
166 $headerparams = array();
167 if (!empty($date_startyear)) {
168  $headerparams['date_startyear'] = $date_startyear;
169 }
170 if (!empty($date_startmonth)) {
171  $headerparams['date_startmonth'] = $date_startmonth;
172 }
173 if (!empty($date_startday)) {
174  $headerparams['date_startday'] = $date_startday;
175 }
176 if (!empty($date_endyear)) {
177  $headerparams['date_endyear'] = $date_endyear;
178 }
179 if (!empty($date_endmonth)) {
180  $headerparams['date_endmonth'] = $date_endmonth;
181 }
182 if (!empty($date_endday)) {
183  $headerparams['date_endday'] = $date_endday;
184 }
185 if (!empty($year)) {
186  $headerparams['year'] = $year;
187 }
188 if (!empty($month)) {
189  $headerparams['month'] = $month;
190 }
191 if (!empty($q)) {
192  $headerparams['q'] = $q;
193 }
194 
195 $tableparams = array();
196 if (!empty($selected_cat)) {
197  $tableparams['search_categ'] = $selected_cat;
198 }
199 if (!empty($selected_soc)) {
200  $tableparams['search_soc'] = $selected_soc;
201 }
202 if (!empty($selected_type)) {
203  $tableparams['search_type'] = $selected_type;
204 }
205 $tableparams['subcat'] = ($subcat === true) ? 'yes' : '';
206 
207 // Adding common parameters
208 $allparams = array_merge($commonparams, $headerparams, $tableparams);
209 $headerparams = array_merge($commonparams, $headerparams);
210 $tableparams = array_merge($commonparams, $tableparams);
211 
212 $paramslink="";
213 foreach ($allparams as $key => $value) {
214  $paramslink .= '&'.$key.'='.$value;
215 }
216 
217 
218 /*
219  * View
220  */
221 
222 llxHeader();
223 
224 $form = new Form($db);
225 $formother = new FormOther($db);
226 
227 // TODO Report from bookkeeping not yet available, so we switch on report on business events
228 if ($modecompta == "BOOKKEEPING") {
229  $modecompta = "CREANCES-DETTES";
230 }
231 if ($modecompta == "BOOKKEEPINGCOLLECTED") {
232  $modecompta = "RECETTES-DEPENSES";
233 }
234 
235 $exportlink="";
236 $namelink="";
237 
238 // Show report header
239 if ($modecompta == "CREANCES-DETTES") {
240  $name = $langs->trans("Turnover").', '.$langs->trans("ByProductsAndServices");
241  $calcmode = $langs->trans("CalcModeDebt");
242  //$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
243 
244  $description = $langs->trans("RulesCADue");
245  if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
246  $description .= $langs->trans("DepositsAreNotIncluded");
247  } else {
248  $description .= $langs->trans("DepositsAreIncluded");
249  }
250  $builddate = dol_now();
251 } elseif ($modecompta == "RECETTES-DEPENSES") {
252  $name = $langs->trans("TurnoverCollected").', '.$langs->trans("ByProductsAndServices");
253  $calcmode = $langs->trans("CalcModeEngagement");
254  //$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
255 
256  $description = $langs->trans("RulesCAIn");
257  $description .= $langs->trans("DepositsAreIncluded");
258 
259  $builddate = dol_now();
260 } elseif ($modecompta == "BOOKKEEPING") {
261 } elseif ($modecompta == "BOOKKEEPINGCOLLECTED") {
262 }
263 
264 $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver');
265 $period .= ' - ';
266 $period .= $form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver');
267 if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) {
268  $periodlink = '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start - 1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start + 1).'&modecompta='.$modecompta.'">'.img_next().'</a>';
269 } else {
270  $periodlink = '';
271 }
272 
273 report_header($name, $namelink, $period, $periodlink, $description, $builddate, $exportlink, $tableparams, $calcmode);
274 
275 if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') {
276  print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
277 }
278 
279 
280 
281 $name = array();
282 
283 // SQL request
284 $catotal = 0;
285 $catotal_ht = 0;
286 $qtytotal = 0;
287 
288 if ($modecompta == 'CREANCES-DETTES') {
289  $sql = "SELECT DISTINCT p.rowid as rowid, p.ref as ref, p.label as label, p.fk_product_type as product_type,";
290  $sql .= " SUM(l.total_ht) as amount, SUM(l.total_ttc) as amount_ttc,";
291  $sql .= " SUM(CASE WHEN f.type = 2 THEN -l.qty ELSE l.qty END) as qty";
292 
293  $parameters = array();
294  $hookmanager->executeHooks('printFieldListSelect', $parameters);
295  $sql .= $hookmanager->resPrint;
296 
297  $sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
298  if ($selected_soc > 0) {
299  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as soc ON (soc.rowid = f.fk_soc)";
300  }
301  $sql .= ",".MAIN_DB_PREFIX."facturedet as l";
302  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON l.fk_product = p.rowid";
303  if ($selected_cat === -2) { // Without any category
304  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product";
305  }
306 
307  $parameters = array();
308  $hookmanager->executeHooks('printFieldListFrom', $parameters);
309  $sql .= $hookmanager->resPrint;
310 
311  $sql .= " WHERE l.fk_facture = f.rowid";
312  $sql .= " AND f.fk_statut in (1,2)";
313  $sql .= " AND l.product_type in (0,1)";
314  if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
315  $sql .= " AND f.type IN (0,1,2,5)";
316  } else {
317  $sql .= " AND f.type IN (0,1,2,3,5)";
318  }
319  if ($date_start && $date_end) {
320  $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
321  }
322  if ($selected_type >= 0) {
323  $sql .= " AND l.product_type = ".((int) $selected_type);
324  }
325  if ($selected_cat === -2) { // Without any category
326  $sql .= " AND cp.fk_product is null";
327  } elseif ($selected_cat > 0) { // Into a specific category
328  if ($subcat) {
329  $TListOfCats = $categorie->get_full_arbo('product', $selected_cat, 1);
330 
331  $listofcatsql = "";
332  foreach ($TListOfCats as $key => $cat) {
333  if ($key !== 0) {
334  $listofcatsql .= ",";
335  }
336  $listofcatsql .= $cat['rowid'];
337  }
338  }
339 
340  $sql .= " AND (p.rowid IN ";
341  $sql .= " (SELECT fk_product FROM ".MAIN_DB_PREFIX."categorie_product cp WHERE ";
342  if ($subcat) {
343  $sql .= "cp.fk_categorie IN (".$db->sanitize($listofcatsql).")";
344  } else {
345  $sql .= "cp.fk_categorie = ".((int) $selected_cat);
346  }
347  $sql .= "))";
348  }
349  if ($selected_soc > 0) {
350  $sql .= " AND soc.rowid=".((int) $selected_soc);
351  }
352  $sql .= " AND f.entity IN (".getEntity('invoice').")";
353 
354  $parameters = array();
355  $hookmanager->executeHooks('printFieldListWhere', $parameters);
356  $sql .= $hookmanager->resPrint;
357 
358  $sql .= " GROUP BY p.rowid, p.ref, p.label, p.fk_product_type";
359  $sql .= $db->order($sortfield, $sortorder);
360 
361  dol_syslog("cabyprodserv", LOG_DEBUG);
362  $result = $db->query($sql);
363  if ($result) {
364  $num = $db->num_rows($result);
365  $i = 0;
366  while ($i < $num) {
367  $obj = $db->fetch_object($result);
368  $amount_ht[$obj->rowid] = $obj->amount;
369  $amount[$obj->rowid] = $obj->amount_ttc;
370  $qty[$obj->rowid] = $obj->qty;
371  $name[$obj->rowid] = $obj->ref.'&nbsp;-&nbsp;'.$obj->label;
372  $type[$obj->rowid] = $obj->product_type;
373  $catotal_ht += $obj->amount;
374  $catotal += $obj->amount_ttc;
375  $qtytotal += $obj->qty;
376  $i++;
377  }
378  } else {
379  dol_print_error($db);
380  }
381 
382  // Show Array
383  $i = 0;
384  print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
385  print '<input type="hidden" name="token" value="'.newToken().'">'."\n";
386  // Extra parameters management
387  foreach ($headerparams as $key => $value) {
388  print '<input type="hidden" name="'.$key.'" value="'.$value.'">';
389  }
390 
391  $moreforfilter = '';
392 
393  print '<div class="div-table-responsive">';
394  print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
395 
396  // Category filter
397  print '<tr class="liste_titre">';
398  print '<td>';
399  print img_picto('', 'category', 'class="paddingrightonly"');
400  print $formother->select_categories(Categorie::TYPE_PRODUCT, $selected_cat, 'search_categ', 0, $langs->trans("Category"));
401  print ' ';
402  print $langs->trans("SubCats").'? ';
403  print '<input type="checkbox" name="subcat" value="yes"';
404  if ($subcat) {
405  print ' checked';
406  }
407  print '>';
408  // type filter (produit/service)
409  print ' ';
410  print $langs->trans("Type").': ';
411  $form->select_type_of_lines(isset($selected_type) ? $selected_type : -1, 'search_type', 1, 1, 1);
412 
413  //select thirdparty
414  print '</br>';
415  print img_picto('', 'company', 'class="paddingrightonly"');
416  print $form->select_thirdparty_list($selected_soc, 'search_soc', '', $langs->trans("ThirdParty"));
417  print '</td>';
418 
419  print '<td colspan="5" class="right">';
420  print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"), 'search.png', '', '', 1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
421 
422  $parameters = array();
423  $reshook = $hookmanager->executeHooks('printFieldListeTitle', $parameters);
424  print $hookmanager->resPrint;
425 
426  print '</td></tr>';
427 
428  // Array header
429  print "<tr class=\"liste_titre\">";
431  $langs->trans("Product"),
432  $_SERVER["PHP_SELF"],
433  "ref",
434  "",
435  $paramslink,
436  "",
437  $sortfield,
438  $sortorder
439  );
441  $langs->trans('Quantity'),
442  $_SERVER["PHP_SELF"],
443  "qty",
444  "",
445  $paramslink,
446  'class="right"',
447  $sortfield,
448  $sortorder
449  );
451  $langs->trans("Percentage"),
452  $_SERVER["PHP_SELF"],
453  "qty",
454  "",
455  $paramslink,
456  'class="right"',
457  $sortfield,
458  $sortorder
459  );
461  $langs->trans('AmountHT'),
462  $_SERVER["PHP_SELF"],
463  "amount",
464  "",
465  $paramslink,
466  'class="right"',
467  $sortfield,
468  $sortorder
469  );
471  $langs->trans("AmountTTC"),
472  $_SERVER["PHP_SELF"],
473  "amount_ttc",
474  "",
475  $paramslink,
476  'class="right"',
477  $sortfield,
478  $sortorder
479  );
481  $langs->trans("Percentage"),
482  $_SERVER["PHP_SELF"],
483  "amount_ttc",
484  "",
485  $paramslink,
486  'class="right"',
487  $sortfield,
488  $sortorder
489  );
490  print "</tr>\n";
491 
492  if (count($name)) {
493  foreach ($name as $key => $value) {
494  print '<tr class="oddeven">';
495 
496  // Product
497  print "<td>";
498  $fullname = $name[$key];
499  if ($key > 0) {
500  $linkname = '<a href="'.DOL_URL_ROOT.'/product/card.php?id='.$key.'">'.img_object($langs->trans("ShowProduct"), $type[$key] == 0 ? 'product' : 'service').' '.$fullname.'</a>';
501  } else {
502  $linkname = $langs->trans("PaymentsNotLinkedToProduct");
503  }
504  print $linkname;
505  print "</td>\n";
506 
507  // Quantity
508  print '<td class="right">';
509  print $qty[$key];
510  print '</td>';
511 
512  // Percent;
513  print '<td class="right">'.($qtytotal > 0 ? round(100 * $qty[$key] / $qtytotal, 2).'%' : '&nbsp;').'</td>';
514 
515  // Amount w/o VAT
516  print '<td class="right">';
517  /*if ($key > 0) {
518  print '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?productid='.$key.'">';
519  } else {
520  print '<a href="#">';
521  }*/
522  print price($amount_ht[$key]);
523  //print '</a>';
524  print '</td>';
525 
526  // Amount with VAT
527  print '<td class="right">';
528  /*if ($key > 0) {
529  print '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?productid='.$key.'">';
530  } else {
531  print '<a href="#">';
532  }*/
533  print price($amount[$key]);
534  //print '</a>';
535  print '</td>';
536 
537  // Percent;
538  print '<td class="right">'.($catotal > 0 ? round(100 * $amount[$key] / $catotal, 2).'%' : '&nbsp;').'</td>';
539 
540  // TODO: statistics?
541 
542  print "</tr>\n";
543  $i++;
544  }
545 
546  // Total
547  print '<tr class="liste_total">';
548  print '<td>'.$langs->trans("Total").'</td>';
549  print '<td class="right">'.$qtytotal.'</td>';
550  print '<td class="right">100%</td>';
551  print '<td class="right">'.price($catotal_ht).'</td>';
552  print '<td class="right">'.price($catotal).'</td>';
553  print '<td class="right">100%</td>';
554  print '</tr>';
555 
556  $db->free($result);
557  }
558  print "</table>";
559  print '</div>';
560 
561  print '</form>';
562 } else {
563  // $modecompta != 'CREANCES-DETTES'
564  // "Calculation of part of each product for accountancy in this mode is not possible. When a partial payment (for example 5 euros) is done on an
565  // invoice with 2 product (product A for 10 euros and product B for 20 euros), what is part of paiment for product A and part of paiment for product B ?
566  // Because there is no way to know this, this report is not relevant.
567  print '<br>'.$langs->trans("TurnoverPerProductInCommitmentAccountingNotRelevant").'<br>';
568 }
569 
570 // End of page
571 llxFooter();
572 $db->close();
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 categories.
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.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
Definition: date.lib.php:575
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
Definition: date.lib.php:121
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
Definition: date.lib.php:594
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
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.
img_previous($titlealt='default', $moreatt='')
Show previous logo.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
img_next($titlealt='default', $moreatt='')
Show next logo.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
report_header($reportname, $notused, $period, $periodlink, $description, $builddate, $exportlink='', $moreparam=array(), $calcmode='', $varlink='')
Show header of a report.
Definition: report.lib.php:41
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.