dolibarr  19.0.0-dev
customerMargins.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
3  * Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17  */
18 
25 // Load Dolibarr environment
26 require '../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
28 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
29 require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
30 require_once DOL_DOCUMENT_ROOT.'/margin/lib/margins.lib.php';
31 
32 // Load translation files required by the page
33 $langs->loadLangs(array('companies', 'bills', 'products', 'margins'));
34 
35 // Load variable for pagination
36 $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
37 $sortfield = GETPOST('sortfield', 'aZ09comma');
38 $sortorder = GETPOST('sortorder', 'aZ09comma');
39 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
40 if (empty($page) || $page == -1) {
41  $page = 0;
42 } // If $page is not defined, or '' or -1
43 $offset = $limit * $page;
44 $pageprev = $page - 1;
45 $pagenext = $page + 1;
46 if (!$sortfield) {
47  $sortfield = "s.nom"; // Set here default search field
48 }
49 if (!$sortorder) {
50  $sortorder = "ASC";
51 }
52 
53 $startdate = $enddate = '';
54 if (GETPOST('startdatemonth')) {
55  $startdate = dol_mktime(0, 0, 0, GETPOST('startdatemonth', 'int'), GETPOST('startdateday', 'int'), GETPOST('startdateyear', 'int'));
56 }
57 if (GETPOST('enddatemonth')) {
58  $enddate = dol_mktime(23, 59, 59, GETPOST('enddatemonth', 'int'), GETPOST('enddateday', 'int'), GETPOST('enddateyear'));
59 }
60 
61 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
62 $object = new Societe($db);
63 $hookmanager->initHooks(array('margincustomerlist'));
64 
65 // Security check
66 $socid = GETPOST('socid', 'int');
67 $TSelectedProducts = GETPOST('products', 'array');
68 $TSelectedCats = GETPOST('categories', 'array');
69 
70 if (!empty($user->socid)) {
71  $socid = $user->socid;
72 }
73 $result = restrictedArea($user, 'societe', '', '');
74 $result = restrictedArea($user, 'margins');
75 
76 
77 /*
78  * View
79  */
80 
81 $companystatic = new Societe($db);
82 $invoicestatic = new Facture($db);
83 
84 $form = new Form($db);
85 
86 llxHeader('', $langs->trans("Margins").' - '.$langs->trans("Clients"));
87 
88 $text = $langs->trans("Margins");
89 //print load_fiche_titre($text);
90 
91 // Show tabs
92 $head = marges_prepare_head();
93 
94 $titre = $langs->trans("Margins");
95 $picto = 'margin';
96 
97 
98 print '<form method="post" name="sel" action="'.$_SERVER['PHP_SELF'].'">';
99 print '<input type="hidden" name="token" value="'.newToken().'">';
100 
101 print dol_get_fiche_head($head, 'customerMargins', $titre, 0, $picto);
102 
103 print '<table class="border centpercent">';
104 
105 $client = false;
106 if ($socid > 0) {
107  $soc = new Societe($db);
108  $soc->fetch($socid);
109 
110  if ($soc->client) {
111  print '<tr><td class="titlefield">'.$langs->trans('ThirdPartyName').'</td>';
112  print '<td class="maxwidthonsmartphone" colspan="4">';
113  $filter = '(client:IN:1,3)';
114  print img_picto('', 'company').$form->select_company($socid, 'socid', $filter, 1, 0, 0);
115  print '</td></tr>';
116 
117  $client = true;
118  if (!$sortorder) {
119  $sortorder = "DESC";
120  }
121  if (!$sortfield) {
122  $sortfield = "f.datef";
123  }
124  }
125 } else {
126  print '<tr><td class="titlefield">'.$langs->trans('ThirdPartyName').'</td>';
127  print '<td class="maxwidthonsmartphone" colspan="4">';
128  print img_picto('', 'company').$form->select_company(null, 'socid', '((client:=:1) OR (client:=:3))', 1, 0, 0);
129  print '</td></tr>';
130 }
131 
132 $sortfield = GETPOST('sortfield', 'aZ09comma');
133 $sortorder = GETPOST('sortorder', 'aZ09comma');
134 if (!$sortorder) {
135  $sortorder = "ASC";
136 }
137 if (!$sortfield) {
138  if ($client) {
139  $sortfield = "f.datef";
140  $sortorder = "DESC";
141  } else {
142  $sortfield = "s.nom";
143  $sortorder = "ASC";
144  }
145 }
146 
147 // Products
148 $TRes = $form->select_produits_list('', '', '', '', 0, '', 1, 2, 1, 0, '', 1);
149 
150 $TProducts = array();
151 foreach ($TRes as $prod) {
152  $TProducts[$prod['key']] = $prod['label'];
153 }
154 
155 print '<tr><td class="titlefield">'.$langs->trans('ProductOrService').'</td>';
156 print '<td class="maxwidthonsmartpone" colspan="4">';
157 print img_picto('', 'product').$form->multiselectarray('products', $TProducts, $TSelectedProducts, 0, 0, 'minwidth500');
158 print '</td></tr>';
159 
160 // Categories
161 $TCats = $form->select_all_categories('product', array(), '', 64, 0, 1);
162 
163 print '<tr>';
164 print '<td class="titlefield">'.$langs->trans('Category').'</td>';
165 print '<td class="maxwidthonsmartphone" colspan="4">';
166 print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('categories', $TCats, $TSelectedCats, 0, 0, 'quatrevingtpercent widthcentpercentminusx');
167 print '</td>';
168 print '</tr>';
169 
170 // Start date
171 print '<td>'.$langs->trans('DateStart').' ('.$langs->trans("DateValidation").')</td>';
172 print '<td>';
173 print $form->selectDate($startdate, 'startdate', '', '', 1, "sel", 1, 1);
174 print '</td>';
175 print '<td>'.$langs->trans('DateEnd').' ('.$langs->trans("DateValidation").')</td>';
176 print '<td>';
177 print $form->selectDate($enddate, 'enddate', '', '', 1, "sel", 1, 1);
178 print '</td>';
179 print '<td style="text-align: center;">';
180 print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans('Refresh')).'" />';
181 print '</td></tr>';
182 
183 print "</table>";
184 
185 print '<br>';
186 
187 print '<table class="border centpercent">';
188 
189 // Total Margin
190 print '<tr><td class="titlefield">'.$langs->trans("TotalMargin").'</td><td colspan="4">';
191 print '<span id="totalMargin" class="amount"></span> <span class="amount">'.$langs->getCurrencySymbol($conf->currency).'</span>'; // set by jquery (see below)
192 print '</td></tr>';
193 
194 // Margin Rate
195 if (!empty($conf->global->DISPLAY_MARGIN_RATES)) {
196  print '<tr><td>'.$langs->trans("MarginRate").'</td><td colspan="4">';
197  print '<span id="marginRate"></span>'; // set by jquery (see below)
198  print '</td></tr>';
199 }
200 
201 // Mark Rate
202 if (!empty($conf->global->DISPLAY_MARK_RATES)) {
203  print '<tr><td>'.$langs->trans("MarkRate").'</td><td colspan="4">';
204  print '<span id="markRate"></span>'; // set by jquery (see below)
205  print '</td></tr>';
206 }
207 
208 print "</table>";
209 
210 print dol_get_fiche_end();
211 
212 print '</form>';
213 
214 $invoice_status_except_list = array(Facture::STATUS_DRAFT, Facture::STATUS_ABANDONED);
215 
216 $sql = "SELECT";
217 $sql .= " s.rowid as socid, s.nom as name, s.code_client, s.client,";
218 if ($client) {
219  $sql .= " f.rowid as facid, f.ref, f.total_ht, f.datef, f.paye, f.type, f.fk_statut as statut,";
220 }
221 $sql .= " sum(d.total_ht) as selling_price,";
222 // Note: qty and buy_price_ht is always positive (if not, your database may be corrupted, you can update this)
223 
224 $sql .= " sum(".$db->ifsql('(d.total_ht < 0 OR (d.total_ht = 0 AND f.type = 2))', '-1 * d.qty * d.buy_price_ht * (d.situation_percent / 100)', 'd.qty * d.buy_price_ht * (d.situation_percent / 100)').") as buying_price,";
225 $sql .= " sum(".$db->ifsql('(d.total_ht < 0 OR (d.total_ht = 0 AND f.type = 2))', '-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty * (d.situation_percent / 100)))', 'd.total_ht - (d.buy_price_ht * d.qty * (d.situation_percent / 100))').") as marge";
226 
227 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
228 $sql .= ", ".MAIN_DB_PREFIX."facture as f";
229 $sql .= ", ".MAIN_DB_PREFIX."facturedet as d";
230 if (!empty($TSelectedCats)) {
231  $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=d.fk_product';
232 }
233 
234 if (empty($user->rights->societe->client->voir) && !$socid) {
235  $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
236 }
237 $sql .= " WHERE f.fk_soc = s.rowid";
238 if ($socid > 0) {
239  $sql .= ' AND s.rowid = '.((int) $socid);
240 }
241 if (empty($user->rights->societe->client->voir) && !$socid) {
242  $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
243 }
244 $sql .= " AND f.fk_statut NOT IN (".$db->sanitize(implode(', ', $invoice_status_except_list)).")";
245 $sql .= ' AND s.entity IN ('.getEntity('societe').')';
246 $sql .= ' AND f.entity IN ('.getEntity('invoice').')';
247 $sql .= " AND d.fk_facture = f.rowid";
248 $sql .= " AND (d.product_type = 0 OR d.product_type = 1)";
249 if (!empty($TSelectedProducts)) {
250  $sql .= ' AND d.fk_product IN ('.$db->sanitize(implode(',', $TSelectedProducts)).')';
251 }
252 if (!empty($TSelectedCats)) {
253  $sql .= ' AND cp.fk_categorie IN ('.$db->sanitize(implode(',', $TSelectedCats)).')';
254 }
255 if (!empty($startdate)) {
256  $sql .= " AND f.datef >= '".$db->idate($startdate)."'";
257 }
258 if (!empty($enddate)) {
259  $sql .= " AND f.datef <= '".$db->idate($enddate)."'";
260 }
261 $sql .= " AND d.buy_price_ht IS NOT NULL";
262 // We should not use this here. Option ForceBuyingPriceIfNull should have effect only when inserting data. Once data is recorded, it must be used as it is for report.
263 // We keep it with value ForceBuyingPriceIfNull = 2 for retroactive effect but results are unpredicable.
264 if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 2) {
265  $sql .= " AND d.buy_price_ht <> 0";
266 }
267 if ($client) {
268  $sql .= " GROUP BY s.rowid, s.nom, s.code_client, s.client, f.rowid, f.ref, f.total_ht, f.datef, f.paye, f.type, f.fk_statut";
269 } else {
270  $sql .= " GROUP BY s.rowid, s.nom, s.code_client, s.client";
271 }
272 $sql .= $db->order($sortfield, $sortorder);
273 // TODO: calculate total to display then restore pagination
274 //$sql.= $db->plimit($conf->liste_limit +1, $offset);
275 
276 $param = '&socid='.((int) $socid);
277 if (GETPOST('startdatemonth', 'int')) {
278  $param .= '&startdateyear='.GETPOST('startdateyear', 'int');
279  $param .= '&startdatemonth='.GETPOST('startdatemonth', 'int');
280  $param .= '&startdateday='.GETPOST('startdateday', 'int');
281 }
282 if (GETPOST('enddatemonth', 'int')) {
283  $param .= '&enddateyear='.GETPOST('enddateyear', 'int');
284  $param .= '&enddatemonth='.GETPOST('enddatemonth', 'int');
285  $param .= '&enddateday='.GETPOST('enddateday', 'int');
286 }
287 $listofproducts = GETPOST('products', 'array:int');
288 if (is_array($listofproducts)) {
289  foreach ($listofproducts as $val) {
290  $param .= '&products[]='.$val;
291  }
292 }
293 $listofcateg = GETPOST('categories', 'array:int');
294 if (is_array($listofcateg)) {
295  foreach ($listofcateg as $val) {
296  $param .= '&categories[]='.$val;
297  }
298 }
299 
300 dol_syslog('margin::customerMargins.php', LOG_DEBUG);
301 $result = $db->query($sql);
302 if ($result) {
303  $num = $db->num_rows($result);
304 
305  print '<br>';
306  print_barre_liste($langs->trans("MarginDetails"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num, $num, '', 0, '', '', 0, 1);
307 
308  if ($conf->global->MARGIN_TYPE == "1") {
309  $labelcostprice = 'BuyingPrice';
310  } else { // value is 'costprice' or 'pmp'
311  $labelcostprice = 'CostPrice';
312  }
313 
314  $moreforfilter = '';
315 
316  $i = 0;
317  print '<div class="div-table-responsive">';
318  print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
319 
320  print '<tr class="liste_titre">';
321  if (!empty($client)) {
322  print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
323  print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", $param, 'align="center"', $sortfield, $sortorder);
324  } else {
325  print_liste_field_titre("Customer", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
326  }
327  print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", $param, 'align="right"', $sortfield, $sortorder);
328  print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "buying_price", "", $param, 'align="right"', $sortfield, $sortorder);
329  print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", $param, 'align="right"', $sortfield, $sortorder);
330  if (!empty($conf->global->DISPLAY_MARGIN_RATES)) {
331  print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", $param, 'align="right"', $sortfield, $sortorder);
332  }
333  if (!empty($conf->global->DISPLAY_MARK_RATES)) {
334  print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", $param, 'align="right"', $sortfield, $sortorder);
335  }
336  print "</tr>\n";
337 
338  $cumul_achat = 0;
339  $cumul_vente = 0;
340 
341  if ($num > 0) {
342  while ($i < $num /*&& $i < $conf->liste_limit*/) {
343  $objp = $db->fetch_object($result);
344 
345  $pa = $objp->buying_price;
346  $pv = $objp->selling_price;
347  $marge = $objp->marge;
348 
349  if ($marge < 0) {
350  $marginRate = ($pa != 0) ?-1 * (100 * $marge / $pa) : '';
351  $markRate = ($pv != 0) ?-1 * (100 * $marge / $pv) : '';
352  } else {
353  $marginRate = ($pa != 0) ? (100 * $marge / $pa) : '';
354  $markRate = ($pv != 0) ? (100 * $marge / $pv) : '';
355  }
356 
357  print '<tr class="oddeven">';
358  if ($client) {
359  $invoicestatic->id = $objp->facid;
360  $invoicestatic->ref = $objp->ref;
361  $invoicestatic->statut = $objp->statut;
362  $invoicestatic->type = $objp->type;
363 
364  print '<td>';
365  print $invoicestatic->getNomUrl(1);
366  print '</td>';
367  print '<td class="center">';
368  print dol_print_date($db->jdate($objp->datef), 'day').'</td>';
369  } else {
370  $companystatic->id = $objp->socid;
371  $companystatic->name = $objp->name;
372  $companystatic->client = $objp->client;
373 
374  print '<td>'.$companystatic->getNomUrl(1, 'margin').'</td>';
375  }
376 
377  print '<td class="nowrap right"><span class="amount">'.price(price2num($pv, 'MT')).'</span></td>';
378  print '<td class="nowrap right"><span class="amount">'.price(price2num($pa, 'MT')).'</span></td>';
379  print '<td class="nowrap right"><span class="amount">'.price(price2num($marge, 'MT')).'</span></td>';
380  if (!empty($conf->global->DISPLAY_MARGIN_RATES)) {
381  print '<td class="nowrap right">'.(($marginRate === '') ? 'n/a' : price(price2num($marginRate, 'MT'))."%").'</td>';
382  }
383  if (!empty($conf->global->DISPLAY_MARK_RATES)) {
384  print '<td class="nowrap right">'.(($markRate === '') ? 'n/a' : price(price2num($markRate, 'MT'))."%").'</td>';
385  }
386  print "</tr>\n";
387 
388  $i++;
389  $cumul_achat += $objp->buying_price;
390  $cumul_vente += $objp->selling_price;
391  }
392  }
393 
394  // affichage totaux marges
395 
396  $totalMargin = $cumul_vente - $cumul_achat;
397  /*if ($totalMargin < 0)
398  {
399  $marginRate = ($cumul_achat != 0)?-1*(100 * $totalMargin / $cumul_achat):'';
400  $markRate = ($cumul_vente != 0)?-1*(100 * $totalMargin / $cumul_vente):'';
401  }
402  else
403  {*/
404  $marginRate = ($cumul_achat != 0) ? (100 * $totalMargin / $cumul_achat) : '';
405  $markRate = ($cumul_vente != 0) ? (100 * $totalMargin / $cumul_vente) : '';
406  //}
407 
408  print '<tr class="liste_total">';
409  if ($client) {
410  print '<td colspan="2">';
411  } else {
412  print '<td>';
413  }
414  print $langs->trans('TotalMargin')."</td>";
415  print '<td class="nowrap right">'.price(price2num($cumul_vente, 'MT')).'</td>';
416  print '<td class="nowrap right">'.price(price2num($cumul_achat, 'MT')).'</td>';
417  print '<td class="nowrap right">'.price(price2num($totalMargin, 'MT')).'</td>';
418  if (!empty($conf->global->DISPLAY_MARGIN_RATES)) {
419  print '<td class="nowrap right">'.(($marginRate === '') ? 'n/a' : price(price2num($marginRate, 'MT'))."%").'</td>';
420  }
421  if (!empty($conf->global->DISPLAY_MARK_RATES)) {
422  print '<td class="nowrap right">'.(($markRate === '') ? 'n/a' : price(price2num($markRate, 'MT'))."%").'</td>';
423  }
424  print '</tr>';
425 
426  print '</table>';
427  print '</div>';
428 } else {
429  dol_print_error($db);
430 }
431 $db->free($result);
432 
433 print '<script type="text/javascript">
434 $(document).ready(function() {
435  console.log("Init some values");
436  $("#totalMargin").html("'.price(price2num($totalMargin, 'MT')).'");
437  $("#marginRate").html("'.(($marginRate === '') ? 'n/a' : price(price2num($marginRate, 'MT'))."%").'");
438  $("#markRate").html("'.(($markRate === '') ? 'n/a' : price(price2num($markRate, 'MT'))."%").'");
439 });
440 </script>
441 ';
442 
443 // End of page
444 llxFooter();
445 $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 invoices.
const STATUS_DRAFT
Draft status.
const STATUS_ABANDONED
Classified abandoned and no payment done.
Class to manage generation of HTML components Only common components must be here.
Class to manage third parties objects (customers, suppliers, prospects...)
if(isModEnabled('facture') && $user->hasRight('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') && $user->hasRight('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)) $sql
Social contributions to pay.
Definition: index.php:746
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
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_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
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...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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).
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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
marges_prepare_head()
Return array of tabs to used on pages for third parties cards.
Definition: margins.lib.php:59
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.