dolibarr  9.0.0
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@inodbox.com>
4  * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
30 class Menubase
31 {
35  public $db;
36 
40  public $error;
41 
45  public $errors = array();
46 
50  public $id;
51 
52  public $menu_handler;
53  public $module;
54  public $type;
55  public $mainmenu;
56 
60  public $fk_menu;
61 
65  public $fk_mainmenu;
66 
70  public $fk_leftmenu;
71 
75  public $position;
76  public $url;
77  public $target;
78  public $titre;
79  public $langs;
80  public $level;
81  public $leftmenu; //<! Not used
82  public $perms;
83  public $enabled;
84  public $user;
85  public $tms;
86 
87 
94  function __construct($db,$menu_handler='')
95  {
96  $this->db = $db;
97  $this->menu_handler = $menu_handler;
98  return 1;
99  }
100 
101 
108  function create($user=null)
109  {
110  global $conf, $langs;
111 
112  // Clean parameters
113  $this->menu_handler=trim($this->menu_handler);
114  $this->module=trim($this->module);
115  $this->type=trim($this->type);
116  $this->mainmenu=trim($this->mainmenu);
117  $this->leftmenu=trim($this->leftmenu);
118  $this->fk_menu = (int) $this->fk_menu; // If -1, fk_mainmenu and fk_leftmenu must be defined
119  $this->fk_mainmenu=trim($this->fk_mainmenu);
120  $this->fk_leftmenu=trim($this->fk_leftmenu);
121  $this->position = (int) $this->position;
122  $this->url=trim($this->url);
123  $this->target=trim($this->target);
124  $this->titre=trim($this->titre);
125  $this->langs=trim($this->langs);
126  $this->perms=trim($this->perms);
127  $this->enabled=trim($this->enabled);
128  $this->user=trim($this->user);
129  if (empty($this->position)) $this->position=0;
130  if (! $this->level) $this->level=0;
131 
132  // Check parameters
133  if (empty($this->menu_handler)) return -1;
134 
135  // For PGSQL, we must first found the max rowid and use it as rowid in insert because postgresql
136  // may use an already used value because its internal cursor does not increase when we do
137  // an insert with a forced id.
138  if (in_array($this->db->type,array('pgsql')))
139  {
140  $sql = "SELECT MAX(rowid) as maxrowid FROM ".MAIN_DB_PREFIX."menu";
141  $resqlrowid=$this->db->query($sql);
142  if ($resqlrowid)
143  {
144  $obj=$this->db->fetch_object($resqlrowid);
145  $maxrowid=$obj->maxrowid;
146 
147  // Max rowid can be empty if there is no record yet
148  if(empty($maxrowid)) $maxrowid=1;
149 
150  $sql = "SELECT setval('".MAIN_DB_PREFIX."menu_rowid_seq', ".($maxrowid).")";
151  //print $sql; exit;
152  $resqlrowidset=$this->db->query($sql);
153  if (! $resqlrowidset) dol_print_error($this->db);
154  }
155  else dol_print_error($this->db);
156  }
157 
158  // Check that entry does not exists yet on key menu_handler-fk_menu-position-url-entity, to avoid errors with postgresql
159  $sql = "SELECT count(*)";
160  $sql.= " FROM ".MAIN_DB_PREFIX."menu";
161  $sql.= " WHERE menu_handler = '".$this->db->escape($this->menu_handler)."'";
162  $sql.= " AND fk_menu = ".((int) $this->fk_menu);
163  $sql.= " AND position = ".((int) $this->position);
164  $sql.= " AND url = '".$this->db->escape($this->url)."'";
165  $sql.= " AND entity = ".$conf->entity;
166 
167  $result=$this->db->query($sql);
168  if ($result)
169  {
170  $row = $this->db->fetch_row($result);
171 
172  if ($row[0] == 0) // If not found
173  {
174  // Insert request
175  $sql = "INSERT INTO ".MAIN_DB_PREFIX."menu(";
176  $sql.= "menu_handler,";
177  $sql.= "entity,";
178  $sql.= "module,";
179  $sql.= "type,";
180  $sql.= "mainmenu,";
181  $sql.= "leftmenu,";
182  $sql.= "fk_menu,";
183  $sql.= "fk_mainmenu,";
184  $sql.= "fk_leftmenu,";
185  $sql.= "position,";
186  $sql.= "url,";
187  $sql.= "target,";
188  $sql.= "titre,";
189  $sql.= "langs,";
190  $sql.= "perms,";
191  $sql.= "enabled,";
192  $sql.= "usertype";
193  $sql.= ") VALUES (";
194  $sql.= " '".$this->db->escape($this->menu_handler)."',";
195  $sql.= " '".$this->db->escape($conf->entity)."',";
196  $sql.= " '".$this->db->escape($this->module)."',";
197  $sql.= " '".$this->db->escape($this->type)."',";
198  $sql.= " ".($this->mainmenu?"'".$this->db->escape($this->mainmenu)."'":"''").","; // Can't be null
199  $sql.= " ".($this->leftmenu?"'".$this->db->escape($this->leftmenu)."'":"null").",";
200  $sql.= " ".((int) $this->fk_menu).",";
201  $sql.= " ".($this->fk_mainmenu?"'".$this->db->escape($this->fk_mainmenu)."'":"null").",";
202  $sql.= " ".($this->fk_leftmenu?"'".$this->db->escape($this->fk_leftmenu)."'":"null").",";
203  $sql.= " ".((int) $this->position).",";
204  $sql.= " '".$this->db->escape($this->url)."',";
205  $sql.= " '".$this->db->escape($this->target)."',";
206  $sql.= " '".$this->db->escape($this->titre)."',";
207  $sql.= " '".$this->db->escape($this->langs)."',";
208  $sql.= " '".$this->db->escape($this->perms)."',";
209  $sql.= " '".$this->db->escape($this->enabled)."',";
210  $sql.= " '".$this->db->escape($this->user)."'";
211  $sql.= ")";
212 
213  dol_syslog(get_class($this)."::create", LOG_DEBUG);
214  $resql=$this->db->query($sql);
215  if ($resql)
216  {
217  $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."menu");
218  dol_syslog(get_class($this)."::create record added has rowid=".$this->id, LOG_DEBUG);
219 
220  return $this->id;
221  }
222  else
223  {
224  $this->error="Error ".$this->db->lasterror();
225  return -1;
226  }
227  }
228  else
229  {
230  dol_syslog(get_class($this)."::create menu entry already exists", LOG_WARNING);
231  $this->error = 'Error Menu entry already exists';
232  return 0;
233  }
234  }
235  else
236  {
237  return -1;
238  }
239  }
240 
248  function update($user=null, $notrigger=0)
249  {
250  global $conf, $langs;
251 
252  // Clean parameters
253  $this->rowid=trim($this->rowid);
254  $this->menu_handler=trim($this->menu_handler);
255  $this->module=trim($this->module);
256  $this->type=trim($this->type);
257  $this->mainmenu=trim($this->mainmenu);
258  $this->leftmenu=trim($this->leftmenu);
259  $this->fk_menu = (int) $this->fk_menu;
260  $this->fk_mainmenu=trim($this->fk_mainmenu);
261  $this->fk_leftmenu=trim($this->fk_leftmenu);
262  $this->position = (int) $this->position;
263  $this->url=trim($this->url);
264  $this->target=trim($this->target);
265  $this->titre=trim($this->titre);
266  $this->langs=trim($this->langs);
267  $this->perms=trim($this->perms);
268  $this->enabled=trim($this->enabled);
269  $this->user=trim($this->user);
270 
271  // Check parameters
272  // Put here code to add control on parameters values
273 
274  // Update request
275  $sql = "UPDATE ".MAIN_DB_PREFIX."menu SET";
276  $sql.= " menu_handler='".$this->db->escape($this->menu_handler)."',";
277  $sql.= " module='".$this->db->escape($this->module)."',";
278  $sql.= " type='".$this->db->escape($this->type)."',";
279  $sql.= " mainmenu='".$this->db->escape($this->mainmenu)."',";
280  $sql.= " leftmenu='".$this->db->escape($this->leftmenu)."',";
281  $sql.= " fk_menu=".$this->fk_menu.",";
282  $sql.= " fk_mainmenu=".($this->fk_mainmenu?"'".$this->db->escape($this->fk_mainmenu)."'":"null").",";
283  $sql.= " fk_leftmenu=".($this->fk_leftmenu?"'".$this->db->escape($this->fk_leftmenu)."'":"null").",";
284  $sql.= " position=".($this->position > 0 ? $this->position : 0).",";
285  $sql.= " url='".$this->db->escape($this->url)."',";
286  $sql.= " target='".$this->db->escape($this->target)."',";
287  $sql.= " titre='".$this->db->escape($this->titre)."',";
288  $sql.= " langs='".$this->db->escape($this->langs)."',";
289  $sql.= " perms='".$this->db->escape($this->perms)."',";
290  $sql.= " enabled='".$this->db->escape($this->enabled)."',";
291  $sql.= " usertype='".$this->db->escape($this->user)."'";
292  $sql.= " WHERE rowid=".$this->id;
293 
294  dol_syslog(get_class($this)."::update", LOG_DEBUG);
295  $resql = $this->db->query($sql);
296  if (! $resql)
297  {
298  $this->error="Error ".$this->db->lasterror();
299  return -1;
300  }
301 
302  return 1;
303  }
304 
305 
313  function fetch($id, $user=null)
314  {
315  global $langs;
316 
317  $sql = "SELECT";
318  $sql.= " t.rowid,";
319  $sql.= " t.menu_handler,";
320  $sql.= " t.entity,";
321  $sql.= " t.module,";
322  $sql.= " t.type,";
323  $sql.= " t.mainmenu,";
324  $sql.= " t.leftmenu,";
325  $sql.= " t.fk_menu,";
326  $sql.= " t.fk_mainmenu,";
327  $sql.= " t.fk_leftmenu,";
328  $sql.= " t.position,";
329  $sql.= " t.url,";
330  $sql.= " t.target,";
331  $sql.= " t.titre,";
332  $sql.= " t.langs,";
333  $sql.= " t.perms,";
334  $sql.= " t.enabled,";
335  $sql.= " t.usertype as user,";
336  $sql.= " t.tms";
337  $sql.= " FROM ".MAIN_DB_PREFIX."menu as t";
338  $sql.= " WHERE t.rowid = ".$id;
339 
340  dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
341  $resql=$this->db->query($sql);
342  if ($resql)
343  {
344  if ($this->db->num_rows($resql))
345  {
346  $obj = $this->db->fetch_object($resql);
347 
348  $this->id = $obj->rowid;
349 
350  $this->menu_handler = $obj->menu_handler;
351  $this->entity = $obj->entity;
352  $this->module = $obj->module;
353  $this->type = $obj->type;
354  $this->mainmenu = $obj->mainmenu;
355  $this->leftmenu = $obj->leftmenu;
356  $this->fk_menu = $obj->fk_menu;
357  $this->fk_mainmenu = $obj->fk_mainmenu;
358  $this->fk_leftmenu = $obj->fk_leftmenu;
359  $this->position = $obj->position;
360  $this->url = $obj->url;
361  $this->target = $obj->target;
362  $this->titre = $obj->titre;
363  $this->langs = $obj->langs;
364  $this->perms = $obj->perms;
365  $this->enabled = str_replace("\"","'",$obj->enabled);
366  $this->user = $obj->user;
367  $this->tms = $this->db->jdate($obj->tms);
368  }
369  $this->db->free($resql);
370 
371  return 1;
372  }
373  else
374  {
375  $this->error="Error ".$this->db->lasterror();
376  return -1;
377  }
378  }
379 
380 
387  function delete($user)
388  {
389  global $conf, $langs;
390 
391  $sql = "DELETE FROM ".MAIN_DB_PREFIX."menu";
392  $sql.= " WHERE rowid=".$this->id;
393 
394  dol_syslog(get_class($this)."::delete", LOG_DEBUG);
395  $resql = $this->db->query($sql);
396  if (! $resql)
397  {
398  $this->error="Error ".$this->db->lasterror();
399  return -1;
400  }
401 
402  return 1;
403  }
404 
405 
413  function initAsSpecimen()
414  {
415  $this->id=0;
416 
417  $this->menu_handler='all';
418  $this->module='specimen';
419  $this->type='top';
420  $this->mainmenu='';
421  $this->fk_menu='0';
422  $this->position='';
423  $this->url='http://dummy';
424  $this->target='';
425  $this->titre='Specimen menu';
426  $this->langs='';
427  $this->level='';
428  $this->leftmenu='';
429  $this->perms='';
430  $this->enabled='';
431  $this->user='';
432  $this->tms='';
433  }
434 
435 
446  function menuTopCharger($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
447  {
448  global $langs, $user, $conf; // To export to dol_eval function
449  global $mainmenu,$leftmenu; // To export to dol_eval function
450 
451  $mainmenu=$mymainmenu; // To export to dol_eval function
452  $leftmenu=$myleftmenu; // To export to dol_eval function
453 
454  $newTabMenu=array();
455  foreach($tabMenu as $val)
456  {
457  if ($val['type']=='top') $newTabMenu[]=$val;
458  }
459 
460  return $newTabMenu;
461  }
462 
475  function menuLeftCharger($newmenu, $mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
476  {
477  global $langs, $user, $conf; // To export to dol_eval function
478  global $mainmenu,$leftmenu; // To export to dol_eval function
479 
480  $mainmenu=$mymainmenu; // To export to dol_eval function
481  $leftmenu=$myleftmenu; // To export to dol_eval function
482 
483  // Detect what is top mainmenu id
484  $menutopid='';
485  foreach($tabMenu as $key => $val)
486  {
487  // Define menutopid of mainmenu
488  if (empty($menutopid) && $val['type'] == 'top' && $val['mainmenu'] == $mainmenu)
489  {
490  $menutopid=$val['rowid'];
491  break;
492  }
493  }
494 
495  // We initialize newmenu with first already found menu entries
496  $this->newmenu = $newmenu;
497 
498  // 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)
499  $this->recur($tabMenu, $menutopid, 1);
500 
501  // Now complete $this->newmenu->list when fk_menu value is -1 (left menu added by modules with no top menu)
502  foreach($tabMenu as $key => $val)
503  {
504  //var_dump($tabMenu);
505  if ($val['fk_menu'] == -1 && $val['fk_mainmenu'] == $mainmenu) // We found a menu entry not linked to parent with good mainmenu
506  {
507  //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>';
508  //var_dump($this->newmenu->liste);exit;
509 
510  if (empty($val['fk_leftmenu']))
511  {
512  $this->newmenu->add($val['url'], $val['titre'], 0, $val['perms'], $val['target'], $val['mainmenu'], $val['leftmenu'], $val['position']);
513  //var_dump($this->newmenu->liste);
514  }
515  else
516  {
517  // Search first menu with this couple (mainmenu,leftmenu)=(fk_mainmenu,fk_leftmenu)
518  $searchlastsub=0;$lastid=0;$nextid=0;$found=0;
519  foreach($this->newmenu->liste as $keyparent => $valparent)
520  {
521  //var_dump($valparent);
522  if ($searchlastsub) // If we started to search for last submenu
523  {
524  if ($valparent['level'] >= $searchlastsub) $lastid=$keyparent;
525  if ($valparent['level'] < $searchlastsub)
526  {
527  $nextid=$keyparent;
528  break;
529  }
530  }
531  if ($valparent['mainmenu'] == $val['fk_mainmenu'] && $valparent['leftmenu'] == $val['fk_leftmenu'])
532  {
533  //print "We found parent: keyparent='.$keyparent.' - level=".$valparent['level'].' - '.join(',',$valparent).'<br>';
534  // Now we look to find last subelement of this parent (we add at end)
535  $searchlastsub=($valparent['level']+1);
536  $lastid=$keyparent;
537  $found=1;
538  }
539  }
540  //print 'We must insert menu entry between entry '.$lastid.' and '.$nextid.'<br>';
541  if ($found) $this->newmenu->insert($lastid, $val['url'], $val['titre'], $searchlastsub, $val['perms'], $val['target'], $val['mainmenu'], $val['leftmenu'], $val['position']);
542  else {
543  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);
544  //print "Parent menu not found !!<br>";
545  }
546  }
547  }
548  }
549 
550  return $this->newmenu;
551  }
552 
553 
564  function menuLoad($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
565  {
566  global $langs, $user, $conf; // To export to dol_eval function
567  global $mainmenu, $leftmenu; // To export to dol_eval function
568 
569  $menutopid=0;
570  $mainmenu=$mymainmenu; // To export to dol_eval function
571  $leftmenu=$myleftmenu; // To export to dol_eval function
572 
573  $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";
574  $sql.= " FROM ".MAIN_DB_PREFIX."menu as m";
575  $sql.= " WHERE m.entity IN (0,".$conf->entity.")";
576  $sql.= " AND m.menu_handler IN ('".$menu_handler."','all')";
577  if ($type_user == 0) $sql.= " AND m.usertype IN (0,2)";
578  if ($type_user == 1) $sql.= " AND m.usertype IN (1,2)";
579  $sql.= " ORDER BY m.position, m.rowid";
580  //print $sql;
581 
582  //$tmp1=microtime(true);
583  //print '>>> 1 0<br>';
584  dol_syslog(get_class($this)."::menuLoad mymainmenu=".$mymainmenu." myleftmenu=".$myleftmenu." type_user=".$type_user." menu_handler=".$menu_handler." tabMenu size=".count($tabMenu)."", LOG_DEBUG);
585  $resql = $this->db->query($sql);
586  if ($resql)
587  {
588  $numa = $this->db->num_rows($resql);
589 
590  $a = 0;
591  $b = 0;
592  while ($a < $numa)
593  {
594  //$objm = $this->db->fetch_object($resql);
595  $menu = $this->db->fetch_array($resql);
596 
597  // Define $right
598  $perms = true;
599  if ($menu['perms'])
600  {
601  $tmpcond=$menu['perms'];
602  if ($leftmenu == 'all') $tmpcond=preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z_]+/','1==1',$tmpcond); // Force part of condition to true
603  $perms = verifCond($tmpcond);
604  //print "verifCond rowid=".$menu['rowid']." ".$tmpcond.":".$perms."<br>\n";
605  }
606 
607  // Define $enabled
608  $enabled = true;
609  if ($menu['enabled'])
610  {
611  $tmpcond=$menu['enabled'];
612  if ($leftmenu == 'all') $tmpcond=preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z_]+/','1==1',$tmpcond); // Force part of condition to true
613  $enabled = verifCond($tmpcond);
614  }
615 
616  // Define $title
617  if ($enabled)
618  {
619  $title = $langs->trans($menu['titre']); // If $menu['titre'] start with $, a dol_eval is done.
620  //var_dump($title.'-'.$menu['titre']);
621  if ($title == $menu['titre']) // Translation not found
622  {
623  if (! empty($menu['langs'])) // If there is a dedicated translation file
624  {
625  //print 'Load file '.$menu['langs'].'<br>';
626  $langs->load($menu['langs']);
627  }
628 
629  $substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
630  $menu['titre'] = make_substitutions($menu['titre'], $substitarray);
631 
632  if (preg_match("/\//",$menu['titre'])) // To manage translation when title is string1/string2
633  {
634  $tab_titre = explode("/",$menu['titre']);
635  $title = $langs->trans($tab_titre[0])."/".$langs->trans($tab_titre[1]);
636  }
637  else if (preg_match('/\|\|/',$menu['titre'])) // To manage different translation (Title||AltTitle@ConditionForAltTitle)
638  {
639  $tab_title = explode("||",$menu['titre']);
640  $alt_title = explode("@",$tab_title[1]);
641  $title_enabled = verifCond($alt_title[1]);
642  $title = ($title_enabled ? $langs->trans($alt_title[0]) : $langs->trans($tab_title[0]));
643  }
644  else
645  {
646  $title = $langs->trans($menu['titre']);
647  }
648  }
649  //$tmp4=microtime(true);
650  //print '>>> 3 '.($tmp4 - $tmp3).'<br>';
651 
652  // We complete tabMenu
653  $tabMenu[$b]['rowid'] = $menu['rowid'];
654  $tabMenu[$b]['module'] = $menu['module'];
655  $tabMenu[$b]['fk_menu'] = $menu['fk_menu'];
656  $tabMenu[$b]['url'] = $menu['url'];
657  if (! preg_match("/^(http:\/\/|https:\/\/)/i",$tabMenu[$b]['url']))
658  {
659  if (preg_match('/\?/',$tabMenu[$b]['url'])) $tabMenu[$b]['url'].='&amp;idmenu='.$menu['rowid'];
660  else $tabMenu[$b]['url'].='?idmenu='.$menu['rowid'];
661  }
662  $tabMenu[$b]['titre'] = $title;
663  $tabMenu[$b]['target'] = $menu['target'];
664  $tabMenu[$b]['mainmenu'] = $menu['mainmenu'];
665  $tabMenu[$b]['leftmenu'] = $menu['leftmenu'];
666  $tabMenu[$b]['perms'] = $perms;
667  $tabMenu[$b]['enabled'] = $enabled;
668  $tabMenu[$b]['type'] = $menu['type'];
669  //$tabMenu[$b]['langs'] = $menu['langs'];
670  $tabMenu[$b]['fk_mainmenu'] = $menu['fk_mainmenu'];
671  $tabMenu[$b]['fk_leftmenu'] = $menu['fk_leftmenu'];
672  $tabMenu[$b]['position'] = (int) $menu['position'];
673 
674  $b++;
675  }
676 
677  $a++;
678  }
679  $this->db->free($resql);
680 
681  // Currently $tabMenu is sorted on position.
682  // 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
683  // into the leftMenuCharger later to avoid useless operations.
684 
685  return 1;
686  }
687  else
688  {
689  dol_print_error($this->db);
690  return -1;
691  }
692  }
693 
702  private function recur($tab, $pere, $level)
703  {
704  // Loop on tab array
705  $num = count($tab);
706  for ($x = 0; $x < $num; $x++)
707  {
708  //si un element a pour pere : $pere
709  if ( (($tab[$x]['fk_menu'] >= 0 && $tab[$x]['fk_menu'] == $pere)) && $tab[$x]['enabled'])
710  {
711  $this->newmenu->add($tab[$x]['url'], $tab[$x]['titre'], ($level-1), $tab[$x]['perms'], $tab[$x]['target'], $tab[$x]['mainmenu'], $tab[$x]['leftmenu']);
712  $this->recur($tab, $tab[$x]['rowid'], ($level+1));
713  }
714  }
715  }
716 }
verifCond($strRights)
Verify if condition in string is ok or not.
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:1053
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.
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.
type
Definition: viewcat.php:284
$conf db user
Definition: repair.php:104
update($user=null, $notrigger=0)
Update menu entry into database.
initAsSpecimen()
Initialise an instance with random values.
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 substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...