dolibarr  7.0.0-beta
menubase.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2007-2009 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
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 <http://www.gnu.org/licenses/>.
17  */
18 
29 class Menubase
30 {
31  public $db; // To store db handler
32  public $error; // To return error code (or message)
33  public $errors=array(); // To return several error codes (or messages)
34 
35  public $id;
36 
37  public $menu_handler;
38  public $module;
39  public $type;
40  public $mainmenu;
41  public $fk_menu;
42  public $fk_mainmenu;
43  public $fk_leftmenu;
44  public $position;
45  public $url;
46  public $target;
47  public $titre;
48  public $langs;
49  public $level;
50  public $leftmenu; //<! Not used
51  public $perms;
52  public $enabled;
53  public $user;
54  public $tms;
55 
56 
63  function __construct($db,$menu_handler='')
64  {
65  $this->db = $db;
66  $this->menu_handler = $menu_handler;
67  return 1;
68  }
69 
70 
77  function create($user=null)
78  {
79  global $conf, $langs;
80 
81  // Clean parameters
82  $this->menu_handler=trim($this->menu_handler);
83  $this->module=trim($this->module);
84  $this->type=trim($this->type);
85  $this->mainmenu=trim($this->mainmenu);
86  $this->leftmenu=trim($this->leftmenu);
87  $this->fk_menu=trim($this->fk_menu); // If -1, fk_mainmenu and fk_leftmenu must be defined
88  $this->fk_mainmenu=trim($this->fk_mainmenu);
89  $this->fk_leftmenu=trim($this->fk_leftmenu);
90  $this->position=trim($this->position);
91  $this->url=trim($this->url);
92  $this->target=trim($this->target);
93  $this->titre=trim($this->titre);
94  $this->langs=trim($this->langs);
95  $this->perms=trim($this->perms);
96  $this->enabled=trim($this->enabled);
97  $this->user=trim($this->user);
98  $this->position=trim($this->position);
99  if (! $this->level) $this->level=0;
100 
101  // Check parameters
102  if (empty($this->menu_handler)) return -1;
103 
104  // For PGSQL, we must first found the max rowid and use it as rowid in insert because postgresql
105  // may use an already used value because its internal cursor does not increase when we do
106  // an insert with a forced id.
107  if (in_array($this->db->type,array('pgsql')))
108  {
109  $sql = "SELECT MAX(rowid) as maxrowid FROM ".MAIN_DB_PREFIX."menu";
110  $resqlrowid=$this->db->query($sql);
111  if ($resqlrowid)
112  {
113  $obj=$this->db->fetch_object($resqlrowid);
114  $maxrowid=$obj->maxrowid;
115 
116  // Max rowid can be empty if there is no record yet
117  if(empty($maxrowid)) $maxrowid=1;
118 
119  $sql = "SELECT setval('".MAIN_DB_PREFIX."menu_rowid_seq', ".($maxrowid).")";
120  //print $sql; exit;
121  $resqlrowidset=$this->db->query($sql);
122  if (! $resqlrowidset) dol_print_error($this->db);
123  }
124  else dol_print_error($this->db);
125  }
126 
127  // Insert request
128  $sql = "INSERT INTO ".MAIN_DB_PREFIX."menu(";
129  $sql.= "menu_handler,";
130  $sql.= "entity,";
131  $sql.= "module,";
132  $sql.= "type,";
133  $sql.= "mainmenu,";
134  $sql.= "leftmenu,";
135  $sql.= "fk_menu,";
136  $sql.= "fk_mainmenu,";
137  $sql.= "fk_leftmenu,";
138  $sql.= "position,";
139  $sql.= "url,";
140  $sql.= "target,";
141  $sql.= "titre,";
142  $sql.= "langs,";
143  $sql.= "perms,";
144  $sql.= "enabled,";
145  $sql.= "usertype";
146  $sql.= ") VALUES (";
147  $sql.= " '".$this->db->escape($this->menu_handler)."',";
148  $sql.= " '".$this->db->escape($conf->entity)."',";
149  $sql.= " '".$this->db->escape($this->module)."',";
150  $sql.= " '".$this->db->escape($this->type)."',";
151  $sql.= " ".($this->mainmenu?"'".$this->db->escape($this->mainmenu)."'":"''").","; // Can't be null
152  $sql.= " ".($this->leftmenu?"'".$this->db->escape($this->leftmenu)."'":"null").",";
153  $sql.= " '".$this->db->escape($this->fk_menu)."',";
154  $sql.= " ".($this->fk_mainmenu?"'".$this->db->escape($this->fk_mainmenu)."'":"null").",";
155  $sql.= " ".($this->fk_leftmenu?"'".$this->db->escape($this->fk_leftmenu)."'":"null").",";
156  $sql.= " '".(int) $this->position."',";
157  $sql.= " '".$this->db->escape($this->url)."',";
158  $sql.= " '".$this->db->escape($this->target)."',";
159  $sql.= " '".$this->db->escape($this->titre)."',";
160  $sql.= " '".$this->db->escape($this->langs)."',";
161  $sql.= " '".$this->db->escape($this->perms)."',";
162  $sql.= " '".$this->db->escape($this->enabled)."',";
163  $sql.= " '".$this->db->escape($this->user)."'";
164  $sql.= ")";
165 
166  dol_syslog(get_class($this)."::create", LOG_DEBUG);
167  $resql=$this->db->query($sql);
168  if ($resql)
169  {
170  $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."menu");
171  dol_syslog(get_class($this)."::create record added has rowid=".$this->id, LOG_DEBUG);
172 
173  return $this->id;
174  }
175  else
176  {
177  $this->error="Error ".$this->db->lasterror();
178  return -1;
179  }
180  }
181 
189  function update($user=null, $notrigger=0)
190  {
191  global $conf, $langs;
192 
193  // Clean parameters
194  $this->rowid=trim($this->rowid);
195  $this->menu_handler=trim($this->menu_handler);
196  $this->module=trim($this->module);
197  $this->type=trim($this->type);
198  $this->mainmenu=trim($this->mainmenu);
199  $this->leftmenu=trim($this->leftmenu);
200  $this->fk_menu=trim($this->fk_menu);
201  $this->fk_mainmenu=trim($this->fk_mainmenu);
202  $this->fk_leftmenu=trim($this->fk_leftmenu);
203  $this->position=trim($this->position);
204  $this->url=trim($this->url);
205  $this->target=trim($this->target);
206  $this->titre=trim($this->titre);
207  $this->langs=trim($this->langs);
208  $this->perms=trim($this->perms);
209  $this->enabled=trim($this->enabled);
210  $this->user=trim($this->user);
211 
212  // Check parameters
213  // Put here code to add control on parameters values
214 
215  // Update request
216  $sql = "UPDATE ".MAIN_DB_PREFIX."menu SET";
217  $sql.= " menu_handler='".$this->db->escape($this->menu_handler)."',";
218  $sql.= " module='".$this->db->escape($this->module)."',";
219  $sql.= " type='".$this->db->escape($this->type)."',";
220  $sql.= " mainmenu='".$this->db->escape($this->mainmenu)."',";
221  $sql.= " leftmenu='".$this->db->escape($this->leftmenu)."',";
222  $sql.= " fk_menu='".$this->db->escape($this->fk_menu)."',";
223  $sql.= " fk_mainmenu=".($this->fk_mainmenu?"'".$this->db->escape($this->fk_mainmenu)."'":"null").",";
224  $sql.= " fk_leftmenu=".($this->fk_leftmenu?"'".$this->db->escape($this->fk_leftmenu)."'":"null").",";
225  $sql.= " position=".($this->position > 0 ? $this->position : 0).",";
226  $sql.= " url='".$this->db->escape($this->url)."',";
227  $sql.= " target='".$this->db->escape($this->target)."',";
228  $sql.= " titre='".$this->db->escape($this->titre)."',";
229  $sql.= " langs='".$this->db->escape($this->langs)."',";
230  $sql.= " perms='".$this->db->escape($this->perms)."',";
231  $sql.= " enabled='".$this->db->escape($this->enabled)."',";
232  $sql.= " usertype='".$this->db->escape($this->user)."'";
233  $sql.= " WHERE rowid=".$this->id;
234 
235  dol_syslog(get_class($this)."::update", LOG_DEBUG);
236  $resql = $this->db->query($sql);
237  if (! $resql)
238  {
239  $this->error="Error ".$this->db->lasterror();
240  return -1;
241  }
242 
243  return 1;
244  }
245 
246 
254  function fetch($id, $user=null)
255  {
256  global $langs;
257 
258  $sql = "SELECT";
259  $sql.= " t.rowid,";
260  $sql.= " t.menu_handler,";
261  $sql.= " t.entity,";
262  $sql.= " t.module,";
263  $sql.= " t.type,";
264  $sql.= " t.mainmenu,";
265  $sql.= " t.leftmenu,";
266  $sql.= " t.fk_menu,";
267  $sql.= " t.fk_mainmenu,";
268  $sql.= " t.fk_leftmenu,";
269  $sql.= " t.position,";
270  $sql.= " t.url,";
271  $sql.= " t.target,";
272  $sql.= " t.titre,";
273  $sql.= " t.langs,";
274  $sql.= " t.perms,";
275  $sql.= " t.enabled,";
276  $sql.= " t.usertype as user,";
277  $sql.= " t.tms";
278  $sql.= " FROM ".MAIN_DB_PREFIX."menu as t";
279  $sql.= " WHERE t.rowid = ".$id;
280 
281  dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
282  $resql=$this->db->query($sql);
283  if ($resql)
284  {
285  if ($this->db->num_rows($resql))
286  {
287  $obj = $this->db->fetch_object($resql);
288 
289  $this->id = $obj->rowid;
290 
291  $this->menu_handler = $obj->menu_handler;
292  $this->entity = $obj->entity;
293  $this->module = $obj->module;
294  $this->type = $obj->type;
295  $this->mainmenu = $obj->mainmenu;
296  $this->leftmenu = $obj->leftmenu;
297  $this->fk_menu = $obj->fk_menu;
298  $this->fk_mainmenu = $obj->fk_mainmenu;
299  $this->fk_leftmenu = $obj->fk_leftmenu;
300  $this->position = $obj->position;
301  $this->url = $obj->url;
302  $this->target = $obj->target;
303  $this->titre = $obj->titre;
304  $this->langs = $obj->langs;
305  $this->perms = $obj->perms;
306  $this->enabled = str_replace("\"","'",$obj->enabled);
307  $this->user = $obj->user;
308  $this->tms = $this->db->jdate($obj->tms);
309  }
310  $this->db->free($resql);
311 
312  return 1;
313  }
314  else
315  {
316  $this->error="Error ".$this->db->lasterror();
317  return -1;
318  }
319  }
320 
321 
328  function delete($user)
329  {
330  global $conf, $langs;
331 
332  $sql = "DELETE FROM ".MAIN_DB_PREFIX."menu";
333  $sql.= " WHERE rowid=".$this->id;
334 
335  dol_syslog(get_class($this)."::delete", LOG_DEBUG);
336  $resql = $this->db->query($sql);
337  if (! $resql)
338  {
339  $this->error="Error ".$this->db->lasterror();
340  return -1;
341  }
342 
343  return 1;
344  }
345 
346 
354  function initAsSpecimen()
355  {
356  $this->id=0;
357 
358  $this->menu_handler='all';
359  $this->module='specimen';
360  $this->type='top';
361  $this->mainmenu='';
362  $this->fk_menu='0';
363  $this->position='';
364  $this->url='http://dummy';
365  $this->target='';
366  $this->titre='Specimen menu';
367  $this->langs='';
368  $this->level='';
369  $this->leftmenu='';
370  $this->perms='';
371  $this->enabled='';
372  $this->user='';
373  $this->tms='';
374  }
375 
376 
387  function menuTopCharger($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
388  {
389  global $langs, $user, $conf; // To export to dol_eval function
390  global $mainmenu,$leftmenu; // To export to dol_eval function
391 
392  $mainmenu=$mymainmenu; // To export to dol_eval function
393  $leftmenu=$myleftmenu; // To export to dol_eval function
394 
395  $newTabMenu=array();
396  foreach($tabMenu as $val)
397  {
398  if ($val['type']=='top') $newTabMenu[]=$val;
399  }
400 
401  return $newTabMenu;
402  }
403 
416  function menuLeftCharger($newmenu, $mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
417  {
418  global $langs, $user, $conf; // To export to dol_eval function
419  global $mainmenu,$leftmenu; // To export to dol_eval function
420 
421  $mainmenu=$mymainmenu; // To export to dol_eval function
422  $leftmenu=$myleftmenu; // To export to dol_eval function
423 
424  // Detect what is top mainmenu id
425  $menutopid='';
426  foreach($tabMenu as $key => $val)
427  {
428  // Define menutopid of mainmenu
429  if (empty($menutopid) && $val['type'] == 'top' && $val['mainmenu'] == $mainmenu)
430  {
431  $menutopid=$val['rowid'];
432  break;
433  }
434  }
435 
436  // We initialize newmenu with first already found menu entries
437  $this->newmenu = $newmenu;
438 
439  // Now complete $this->newmenu->list to add entries found into $tabMenu that are childs of mainmenu=$menutopid, using the fk_menu link that is int (old method)
440  $this->recur($tabMenu, $menutopid, 1);
441 
442  // Now complete $this->newmenu->list when fk_menu value is -1 (left menu added by modules with no top menu)
443  foreach($tabMenu as $key => $val)
444  {
445  //var_dump($tabMenu);
446  if ($val['fk_menu'] == -1 && $val['fk_mainmenu'] == $mainmenu) // We found a menu entry not linked to parent with good mainmenu
447  {
448  //print 'Try to add menu (current is mainmenu='.$mainmenu.' leftmenu='.$leftmenu.') for '.join(',',$val).' fk_mainmenu='.$val['fk_mainmenu'].' fk_leftmenu='.$val['fk_leftmenu'].'<br>';
449  //var_dump($this->newmenu->liste);exit;
450 
451  if (empty($val['fk_leftmenu']))
452  {
453  $this->newmenu->add($val['url'], $val['titre'], 0, $val['perms'], $val['target'], $val['mainmenu'], $val['leftmenu'], $val['position']);
454  //var_dump($this->newmenu->liste);
455  }
456  else
457  {
458  // Search first menu with this couple (mainmenu,leftmenu)=(fk_mainmenu,fk_leftmenu)
459  $searchlastsub=0;$lastid=0;$nextid=0;$found=0;
460  foreach($this->newmenu->liste as $keyparent => $valparent)
461  {
462  //var_dump($valparent);
463  if ($searchlastsub) // If we started to search for last submenu
464  {
465  if ($valparent['level'] >= $searchlastsub) $lastid=$keyparent;
466  if ($valparent['level'] < $searchlastsub)
467  {
468  $nextid=$keyparent;
469  break;
470  }
471  }
472  if ($valparent['mainmenu'] == $val['fk_mainmenu'] && $valparent['leftmenu'] == $val['fk_leftmenu'])
473  {
474  //print "We found parent: keyparent='.$keyparent.' - level=".$valparent['level'].' - '.join(',',$valparent).'<br>';
475  // Now we look to find last subelement of this parent (we add at end)
476  $searchlastsub=($valparent['level']+1);
477  $lastid=$keyparent;
478  $found=1;
479  }
480  }
481  //print 'We must insert menu entry between entry '.$lastid.' and '.$nextid.'<br>';
482  if ($found) $this->newmenu->insert($lastid, $val['url'], $val['titre'], $searchlastsub, $val['perms'], $val['target'], $val['mainmenu'], $val['leftmenu'], $val['position']);
483  else {
484  dol_syslog("Error. Modules ".$val['module']." has defined a menu entry with a parent='fk_mainmenu=".$val['fk_leftmenu'].",fk_leftmenu=".$val['fk_leftmenu']."' and position=".$val['position'].'. The parent was not found. May be you forget it into your definition of menu, or may be the parent has a "position" that is after the child (fix field "position" of parent or child in this case).', LOG_WARNING);
485  //print "Parent menu not found !!<br>";
486  }
487  }
488  }
489  }
490 
491  return $this->newmenu;
492  }
493 
494 
505  function menuLoad($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
506  {
507  global $langs, $user, $conf; // To export to dol_eval function
508  global $mainmenu, $leftmenu; // To export to dol_eval function
509 
510  $menutopid=0;
511  $mainmenu=$mymainmenu; // To export to dol_eval function
512  $leftmenu=$myleftmenu; // To export to dol_eval function
513 
514  $sql = "SELECT m.rowid, m.type, m.module, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu, m.url, m.titre, m.langs, m.perms, m.enabled, m.target, m.mainmenu, m.leftmenu, m.position";
515  $sql.= " FROM ".MAIN_DB_PREFIX."menu as m";
516  $sql.= " WHERE m.entity IN (0,".$conf->entity.")";
517  $sql.= " AND m.menu_handler IN ('".$menu_handler."','all')";
518  if ($type_user == 0) $sql.= " AND m.usertype IN (0,2)";
519  if ($type_user == 1) $sql.= " AND m.usertype IN (1,2)";
520  $sql.= " ORDER BY m.position, m.rowid";
521  //print $sql;
522 
523  //$tmp1=microtime(true);
524  //print '>>> 1 0<br>';
525  dol_syslog(get_class($this)."::menuLoad mymainmenu=".$mymainmenu." myleftmenu=".$myleftmenu." type_user=".$type_user." menu_handler=".$menu_handler." tabMenu size=".count($tabMenu)."", LOG_DEBUG);
526  $resql = $this->db->query($sql);
527  if ($resql)
528  {
529  $numa = $this->db->num_rows($resql);
530 
531  $a = 0;
532  $b = 0;
533  $oldrowid=0;
534  while ($a < $numa)
535  {
536  //$objm = $this->db->fetch_object($resql);
537  $menu = $this->db->fetch_array($resql);
538 
539  // Define $right
540  $perms = true;
541  if ($menu['perms'])
542  {
543  $tmpcond=$menu['perms'];
544  if ($leftmenu == 'all') $tmpcond=preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z_]+/','1==1',$tmpcond); // Force part of condition to true
545  $perms = verifCond($tmpcond);
546  //print "verifCond rowid=".$menu['rowid']." ".$tmpcond.":".$perms."<br>\n";
547  }
548 
549  // Define $enabled
550  $enabled = true;
551  if ($menu['enabled'])
552  {
553  $tmpcond=$menu['enabled'];
554  if ($leftmenu == 'all') $tmpcond=preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z_]+/','1==1',$tmpcond); // Force part of condition to true
555  $enabled = verifCond($tmpcond);
556  }
557 
558  // Define $title
559  if ($enabled)
560  {
561  $title = $langs->trans($menu['titre']); // If $menu['titre'] start with $, a dol_eval is done.
562  //var_dump($title.'-'.$menu['titre']);
563  if ($title == $menu['titre']) // Translation not found
564  {
565  if (! empty($menu['langs'])) // If there is a dedicated translation file
566  {
567  //print 'Load file '.$menu['langs'].'<br>';
568  $langs->load($menu['langs']);
569  }
570 
571  $substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
572  $menu['titre'] = make_substitutions($menu['titre'], $substitarray);
573 
574  if (preg_match("/\//",$menu['titre'])) // To manage translation when title is string1/string2
575  {
576  $tab_titre = explode("/",$menu['titre']);
577  $title = $langs->trans($tab_titre[0])."/".$langs->trans($tab_titre[1]);
578  }
579  else if (preg_match('/\|\|/',$menu['titre'])) // To manage different translation (Title||AltTitle@ConditionForAltTitle)
580  {
581  $tab_title = explode("||",$menu['titre']);
582  $alt_title = explode("@",$tab_title[1]);
583  $title_enabled = verifCond($alt_title[1]);
584  $title = ($title_enabled ? $langs->trans($alt_title[0]) : $langs->trans($tab_title[0]));
585  }
586  else
587  {
588  $title = $langs->trans($menu['titre']);
589  }
590  }
591  //$tmp4=microtime(true);
592  //print '>>> 3 '.($tmp4 - $tmp3).'<br>';
593 
594  // We complete tabMenu
595  $tabMenu[$b]['rowid'] = $menu['rowid'];
596  $tabMenu[$b]['module'] = $menu['module'];
597  $tabMenu[$b]['fk_menu'] = $menu['fk_menu'];
598  $tabMenu[$b]['url'] = $menu['url'];
599  if (! preg_match("/^(http:\/\/|https:\/\/)/i",$tabMenu[$b]['url']))
600  {
601  if (preg_match('/\?/',$tabMenu[$b]['url'])) $tabMenu[$b]['url'].='&amp;idmenu='.$menu['rowid'];
602  else $tabMenu[$b]['url'].='?idmenu='.$menu['rowid'];
603  }
604  $tabMenu[$b]['titre'] = $title;
605  $tabMenu[$b]['target'] = $menu['target'];
606  $tabMenu[$b]['mainmenu'] = $menu['mainmenu'];
607  $tabMenu[$b]['leftmenu'] = $menu['leftmenu'];
608  $tabMenu[$b]['perms'] = $perms;
609  $tabMenu[$b]['enabled'] = $enabled;
610  $tabMenu[$b]['type'] = $menu['type'];
611  //$tabMenu[$b]['langs'] = $menu['langs'];
612  $tabMenu[$b]['fk_mainmenu'] = $menu['fk_mainmenu'];
613  $tabMenu[$b]['fk_leftmenu'] = $menu['fk_leftmenu'];
614  $tabMenu[$b]['position'] = (int) $menu['position'];
615 
616  $b++;
617  }
618 
619  $a++;
620  }
621  $this->db->free($resql);
622 
623  // Currently $tabMenu is sorted on position.
624  // If a child have a position lower that its parent, we can make a loop to fix this here, but we prefer to show a warning
625  // into the leftMenuCharger later to avoid useless operations.
626 
627  return 1;
628  }
629  else
630  {
631  dol_print_error($this->db);
632  return -1;
633  }
634  }
635 
644  private function recur($tab, $pere, $level)
645  {
646  // Loop on tab array
647  $num = count($tab);
648  for ($x = 0; $x < $num; $x++)
649  {
650  //si un element a pour pere : $pere
651  if ( (($tab[$x]['fk_menu'] >= 0 && $tab[$x]['fk_menu'] == $pere)) && $tab[$x]['enabled'])
652  {
653  $this->newmenu->add($tab[$x]['url'], $tab[$x]['titre'], ($level-1), $tab[$x]['perms'], $tab[$x]['target'], $tab[$x]['mainmenu'], $tab[$x]['leftmenu']);
654  $this->recur($tab, $tab[$x]['rowid'], ($level+1));
655  }
656  }
657  }
658 
659 }
660 
verifCond($strRights)
Verify if condition in string is ok or not.
create($user=null)
Create menu entry into database.
recur($tab, $pere, $level)
Complete this->newmenu with menu entry found in $tab.
fetch($id, $user=null)
Load object in memory from database.
Class to manage menu entries.
menuLoad($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
Load entries found in database into variable $tabMenu.
menuLeftCharger($newmenu, $mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
Load entries found from database (and stored into $tabMenu) in $this->newmenu array.
__construct($db, $menu_handler='')
Constructor.
background position
Definition: style.css.php:368
dol_print_error($db='', $error='', $errors=null)
Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remonte...
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='')
Write log message into outputs.
if($_POST["cancel"]==$langs->trans("Cancel")&&!$id) if($action== 'setdatev'&&$user->rights->tax->charges->creer) if($action== 'add'&&$_POST["cancel"]<> $langs->trans("Cancel")) if($action== 'delete') $title
Actions.
Definition: card.php:183
$conf db user
Definition: repair.php:105
update($user=null, $notrigger=0)
Update menu entry into database.
initAsSpecimen()
Initialise an instance with random values.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if(!empty($conf->fournisseur->enabled)&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->societe->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if(!empty($conf->fournisseur->enabled)&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1013
menuTopCharger($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
Load tabMenu array with top menu entries found into database.
make_substitutions($text, $substitutionarray, $outputlangs=null)
Make substition into a text string, replacing keys with vals from $substitutionarray (oldval=>newval)...
type
Definition: viewcat.php:283