dolibarr  13.0.2
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-2019 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 <https://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 
55  public $menu_handler;
56 
60  public $module;
61 
65  public $type;
66 
70  public $mainmenu;
71 
75  public $fk_menu;
76 
80  public $fk_mainmenu;
81 
85  public $fk_leftmenu;
86 
90  public $position;
91 
95  public $url;
96 
100  public $target;
101 
107  public $titre;
108 
112  public $title;
113 
117  public $langs;
118 
123  public $level;
124 
128  public $leftmenu;
129 
133  public $perms;
134 
138  public $enabled;
139 
143  public $user;
144 
148  public $tms;
149 
150 
157  public function __construct($db, $menu_handler = '')
158  {
159  $this->db = $db;
160  $this->menu_handler = $menu_handler;
161  return 1;
162  }
163 
164 
171  public function create($user = null)
172  {
173  global $conf, $langs;
174 
175  // Clean parameters
176  if (!isset($this->enabled)) $this->enabled = '1';
177  $this->menu_handler = trim($this->menu_handler);
178  $this->module = trim($this->module);
179  $this->type = trim($this->type);
180  $this->mainmenu = trim($this->mainmenu);
181  $this->leftmenu = trim($this->leftmenu);
182  $this->fk_menu = (int) $this->fk_menu; // If -1, fk_mainmenu and fk_leftmenu must be defined
183  $this->fk_mainmenu = trim($this->fk_mainmenu);
184  $this->fk_leftmenu = trim($this->fk_leftmenu);
185  $this->position = (int) $this->position;
186  $this->url = trim($this->url);
187  $this->target = trim($this->target);
188  $this->title = trim($this->title);
189  $this->langs = trim($this->langs);
190  $this->perms = trim($this->perms);
191  $this->enabled = trim($this->enabled);
192  $this->user = (int) $this->user;
193  if (empty($this->position)) $this->position = 0;
194  if (!$this->level) $this->level = 0;
195 
196  // Check parameters
197  if (empty($this->menu_handler)) return -1;
198 
199  // For PGSQL, we must first found the max rowid and use it as rowid in insert because postgresql
200  // may use an already used value because its internal cursor does not increase when we do
201  // an insert with a forced id.
202  if (in_array($this->db->type, array('pgsql')))
203  {
204  $sql = "SELECT MAX(rowid) as maxrowid FROM ".MAIN_DB_PREFIX."menu";
205  $resqlrowid = $this->db->query($sql);
206  if ($resqlrowid) {
207  $obj = $this->db->fetch_object($resqlrowid);
208  $maxrowid = $obj->maxrowid;
209 
210  // Max rowid can be empty if there is no record yet
211  if (empty($maxrowid)) $maxrowid = 1;
212 
213  $sql = "SELECT setval('".MAIN_DB_PREFIX."menu_rowid_seq', ".($maxrowid).")";
214  //print $sql; exit;
215  $resqlrowidset = $this->db->query($sql);
216  if (!$resqlrowidset) dol_print_error($this->db);
217  } else dol_print_error($this->db);
218  }
219 
220  // Check that entry does not exists yet on key menu_handler-fk_menu-position-url-entity, to avoid errors with postgresql
221  $sql = "SELECT count(*)";
222  $sql .= " FROM ".MAIN_DB_PREFIX."menu";
223  $sql .= " WHERE menu_handler = '".$this->db->escape($this->menu_handler)."'";
224  $sql .= " AND fk_menu = ".((int) $this->fk_menu);
225  $sql .= " AND position = ".((int) $this->position);
226  $sql .= " AND url = '".$this->db->escape($this->url)."'";
227  $sql .= " AND entity = ".$conf->entity;
228 
229  $result = $this->db->query($sql);
230  if ($result)
231  {
232  $row = $this->db->fetch_row($result);
233 
234  if ($row[0] == 0) // If not found
235  {
236  // Insert request
237  $sql = "INSERT INTO ".MAIN_DB_PREFIX."menu(";
238  $sql .= "menu_handler,";
239  $sql .= "entity,";
240  $sql .= "module,";
241  $sql .= "type,";
242  $sql .= "mainmenu,";
243  $sql .= "leftmenu,";
244  $sql .= "fk_menu,";
245  $sql .= "fk_mainmenu,";
246  $sql .= "fk_leftmenu,";
247  $sql .= "position,";
248  $sql .= "url,";
249  $sql .= "target,";
250  $sql .= "titre,";
251  $sql .= "langs,";
252  $sql .= "perms,";
253  $sql .= "enabled,";
254  $sql .= "usertype";
255  $sql .= ") VALUES (";
256  $sql .= " '".$this->db->escape($this->menu_handler)."',";
257  $sql .= " '".$this->db->escape($conf->entity)."',";
258  $sql .= " '".$this->db->escape($this->module)."',";
259  $sql .= " '".$this->db->escape($this->type)."',";
260  $sql .= " ".($this->mainmenu ? "'".$this->db->escape($this->mainmenu)."'" : "''").","; // Can't be null
261  $sql .= " ".($this->leftmenu ? "'".$this->db->escape($this->leftmenu)."'" : "null").",";
262  $sql .= " ".((int) $this->fk_menu).",";
263  $sql .= " ".($this->fk_mainmenu ? "'".$this->db->escape($this->fk_mainmenu)."'" : "null").",";
264  $sql .= " ".($this->fk_leftmenu ? "'".$this->db->escape($this->fk_leftmenu)."'" : "null").",";
265  $sql .= " ".((int) $this->position).",";
266  $sql .= " '".$this->db->escape($this->url)."',";
267  $sql .= " '".$this->db->escape($this->target)."',";
268  $sql .= " '".$this->db->escape($this->title)."',";
269  $sql .= " '".$this->db->escape($this->langs)."',";
270  $sql .= " '".$this->db->escape($this->perms)."',";
271  $sql .= " '".$this->db->escape($this->enabled)."',";
272  $sql .= " '".$this->db->escape($this->user)."'";
273  $sql .= ")";
274 
275  dol_syslog(get_class($this)."::create", LOG_DEBUG);
276  $resql = $this->db->query($sql);
277  if ($resql)
278  {
279  $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."menu");
280  dol_syslog(get_class($this)."::create record added has rowid=".$this->id, LOG_DEBUG);
281 
282  return $this->id;
283  } else {
284  $this->error = "Error ".$this->db->lasterror();
285  return -1;
286  }
287  } else {
288  dol_syslog(get_class($this)."::create menu entry already exists", LOG_WARNING);
289  $this->error = 'Error Menu entry already exists';
290  return 0;
291  }
292  } else {
293  return -1;
294  }
295  }
296 
304  public function update($user = null, $notrigger = 0)
305  {
306  //global $conf, $langs;
307 
308  // Clean parameters
309  $this->rowid = trim($this->rowid);
310  $this->menu_handler = trim($this->menu_handler);
311  $this->module = trim($this->module);
312  $this->type = trim($this->type);
313  $this->mainmenu = trim($this->mainmenu);
314  $this->leftmenu = trim($this->leftmenu);
315  $this->fk_menu = (int) $this->fk_menu;
316  $this->fk_mainmenu = trim($this->fk_mainmenu);
317  $this->fk_leftmenu = trim($this->fk_leftmenu);
318  $this->position = (int) $this->position;
319  $this->url = trim($this->url);
320  $this->target = trim($this->target);
321  $this->title = trim($this->title);
322  $this->langs = trim($this->langs);
323  $this->perms = trim($this->perms);
324  $this->enabled = trim($this->enabled);
325  $this->user = (int) $this->user;
326 
327  // Check parameters
328  // Put here code to add control on parameters values
329 
330  // Update request
331  $sql = "UPDATE ".MAIN_DB_PREFIX."menu SET";
332  $sql .= " menu_handler='".$this->db->escape($this->menu_handler)."',";
333  $sql .= " module='".$this->db->escape($this->module)."',";
334  $sql .= " type='".$this->db->escape($this->type)."',";
335  $sql .= " mainmenu='".$this->db->escape($this->mainmenu)."',";
336  $sql .= " leftmenu='".$this->db->escape($this->leftmenu)."',";
337  $sql .= " fk_menu=".$this->fk_menu.",";
338  $sql .= " fk_mainmenu=".($this->fk_mainmenu ? "'".$this->db->escape($this->fk_mainmenu)."'" : "null").",";
339  $sql .= " fk_leftmenu=".($this->fk_leftmenu ? "'".$this->db->escape($this->fk_leftmenu)."'" : "null").",";
340  $sql .= " position=".($this->position > 0 ? $this->position : 0).",";
341  $sql .= " url='".$this->db->escape($this->url)."',";
342  $sql .= " target='".$this->db->escape($this->target)."',";
343  $sql .= " titre='".$this->db->escape($this->title)."',";
344  $sql .= " langs='".$this->db->escape($this->langs)."',";
345  $sql .= " perms='".$this->db->escape($this->perms)."',";
346  $sql .= " enabled='".$this->db->escape($this->enabled)."',";
347  $sql .= " usertype='".$this->db->escape($this->user)."'";
348  $sql .= " WHERE rowid=".$this->id;
349 
350  dol_syslog(get_class($this)."::update", LOG_DEBUG);
351  $resql = $this->db->query($sql);
352  if (!$resql)
353  {
354  $this->error = "Error ".$this->db->lasterror();
355  return -1;
356  }
357 
358  return 1;
359  }
360 
361 
369  public function fetch($id, $user = null)
370  {
371  //global $langs;
372 
373  $sql = "SELECT";
374  $sql .= " t.rowid,";
375  $sql .= " t.menu_handler,";
376  $sql .= " t.entity,";
377  $sql .= " t.module,";
378  $sql .= " t.type,";
379  $sql .= " t.mainmenu,";
380  $sql .= " t.leftmenu,";
381  $sql .= " t.fk_menu,";
382  $sql .= " t.fk_mainmenu,";
383  $sql .= " t.fk_leftmenu,";
384  $sql .= " t.position,";
385  $sql .= " t.url,";
386  $sql .= " t.target,";
387  $sql .= " t.titre as title,";
388  $sql .= " t.langs,";
389  $sql .= " t.perms,";
390  $sql .= " t.enabled,";
391  $sql .= " t.usertype as user,";
392  $sql .= " t.tms";
393  $sql .= " FROM ".MAIN_DB_PREFIX."menu as t";
394  $sql .= " WHERE t.rowid = ".$id;
395 
396  dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
397  $resql = $this->db->query($sql);
398  if ($resql)
399  {
400  if ($this->db->num_rows($resql))
401  {
402  $obj = $this->db->fetch_object($resql);
403 
404  $this->id = $obj->rowid;
405 
406  $this->menu_handler = $obj->menu_handler;
407  $this->entity = $obj->entity;
408  $this->module = $obj->module;
409  $this->type = $obj->type;
410  $this->mainmenu = $obj->mainmenu;
411  $this->leftmenu = $obj->leftmenu;
412  $this->fk_menu = $obj->fk_menu;
413  $this->fk_mainmenu = $obj->fk_mainmenu;
414  $this->fk_leftmenu = $obj->fk_leftmenu;
415  $this->position = $obj->position;
416  $this->url = $obj->url;
417  $this->target = $obj->target;
418  $this->title = $obj->title;
419  $this->langs = $obj->langs;
420  $this->perms = $obj->perms;
421  $this->enabled = str_replace("\"", "'", $obj->enabled);
422  $this->user = $obj->user;
423  $this->tms = $this->db->jdate($obj->tms);
424  }
425  $this->db->free($resql);
426 
427  return 1;
428  } else {
429  $this->error = "Error ".$this->db->lasterror();
430  return -1;
431  }
432  }
433 
434 
441  public function delete($user)
442  {
443  //global $conf, $langs;
444 
445  $sql = "DELETE FROM ".MAIN_DB_PREFIX."menu";
446  $sql .= " WHERE rowid=".$this->id;
447 
448  dol_syslog(get_class($this)."::delete", LOG_DEBUG);
449  $resql = $this->db->query($sql);
450  if (!$resql)
451  {
452  $this->error = "Error ".$this->db->lasterror();
453  return -1;
454  }
455 
456  return 1;
457  }
458 
459 
467  public function initAsSpecimen()
468  {
469  $this->id = 0;
470 
471  $this->menu_handler = 'all';
472  $this->module = 'specimen';
473  $this->type = 'top';
474  $this->mainmenu = '';
475  $this->fk_menu = '0';
476  $this->position = '';
477  $this->url = 'http://dummy';
478  $this->target = '';
479  $this->title = 'Specimen menu';
480  $this->langs = '';
481  $this->leftmenu = '';
482  $this->perms = '';
483  $this->enabled = '';
484  $this->user = '';
485  $this->tms = '';
486  }
487 
488 
499  public function menuTopCharger($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
500  {
501  global $langs, $user, $conf; // To export to dol_eval function
502  global $mainmenu, $leftmenu; // To export to dol_eval function
503 
504  $mainmenu = $mymainmenu; // To export to dol_eval function
505  $leftmenu = $myleftmenu; // To export to dol_eval function
506 
507  $newTabMenu = array();
508  foreach ($tabMenu as $val)
509  {
510  if ($val['type'] == 'top') $newTabMenu[] = $val;
511  }
512 
513  return $newTabMenu;
514  }
515 
528  public function menuLeftCharger($newmenu, $mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
529  {
530  global $langs, $user, $conf; // To export to dol_eval function
531  global $mainmenu, $leftmenu; // To export to dol_eval function
532 
533  $mainmenu = $mymainmenu; // To export to dol_eval function
534  $leftmenu = $myleftmenu; // To export to dol_eval function
535 
536  // Detect what is top mainmenu id
537  $menutopid = '';
538  foreach ($tabMenu as $key => $val)
539  {
540  // Define menutopid of mainmenu
541  if (empty($menutopid) && $val['type'] == 'top' && $val['mainmenu'] == $mainmenu)
542  {
543  $menutopid = $val['rowid'];
544  break;
545  }
546  }
547 
548  // We initialize newmenu with first already found menu entries
549  $this->newmenu = $newmenu;
550 
551  // 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)
552  $this->recur($tabMenu, $menutopid, 1);
553 
554  // Now complete $this->newmenu->list when fk_menu value is -1 (left menu added by modules with no top menu)
555  foreach ($tabMenu as $key => $val)
556  {
557  //var_dump($tabMenu);
558  if ($val['fk_menu'] == -1 && $val['fk_mainmenu'] == $mainmenu) // We found a menu entry not linked to parent with good mainmenu
559  {
560  //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>';
561  //var_dump($this->newmenu->liste);exit;
562 
563  if (empty($val['fk_leftmenu']))
564  {
565  $this->newmenu->add($val['url'], $val['titre'], 0, $val['perms'], $val['target'], $val['mainmenu'], $val['leftmenu'], $val['position']);
566  //var_dump($this->newmenu->liste);
567  } else {
568  // Search first menu with this couple (mainmenu,leftmenu)=(fk_mainmenu,fk_leftmenu)
569  $searchlastsub = 0; $lastid = 0; $nextid = 0; $found = 0;
570  foreach ($this->newmenu->liste as $keyparent => $valparent)
571  {
572  //var_dump($valparent);
573  if ($searchlastsub) // If we started to search for last submenu
574  {
575  if ($valparent['level'] >= $searchlastsub) $lastid = $keyparent;
576  if ($valparent['level'] < $searchlastsub)
577  {
578  $nextid = $keyparent;
579  break;
580  }
581  }
582  if ($valparent['mainmenu'] == $val['fk_mainmenu'] && $valparent['leftmenu'] == $val['fk_leftmenu'])
583  {
584  //print "We found parent: keyparent='.$keyparent.' - level=".$valparent['level'].' - '.join(',',$valparent).'<br>';
585  // Now we look to find last subelement of this parent (we add at end)
586  $searchlastsub = ($valparent['level'] + 1);
587  $lastid = $keyparent;
588  $found = 1;
589  }
590  }
591  //print 'We must insert menu entry between entry '.$lastid.' and '.$nextid.'<br>';
592  if ($found) $this->newmenu->insert($lastid, $val['url'], $val['titre'], $searchlastsub, $val['perms'], $val['target'], $val['mainmenu'], $val['leftmenu'], $val['position']);
593  else {
594  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);
595  //print "Parent menu not found !!<br>";
596  }
597  }
598  }
599  }
600 
601  return $this->newmenu;
602  }
603 
604 
615  public function menuLoad($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
616  {
617  global $langs, $user, $conf; // To export to dol_eval function
618  global $mainmenu, $leftmenu; // To export to dol_eval function
619 
620  $mainmenu = $mymainmenu; // To export to dol_eval function
621  $leftmenu = $myleftmenu; // To export to dol_eval function
622 
623  $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";
624  $sql .= " FROM ".MAIN_DB_PREFIX."menu as m";
625  $sql .= " WHERE m.entity IN (0,".$conf->entity.")";
626  $sql .= " AND m.menu_handler IN ('".$this->db->escape($menu_handler)."','all')";
627  if ($type_user == 0) $sql .= " AND m.usertype IN (0,2)";
628  if ($type_user == 1) $sql .= " AND m.usertype IN (1,2)";
629  $sql .= " ORDER BY m.position, m.rowid";
630  //print $sql;
631 
632  //dol_syslog(get_class($this)."::menuLoad mymainmenu=".$mymainmenu." myleftmenu=".$myleftmenu." type_user=".$type_user." menu_handler=".$menu_handler." tabMenu size=".count($tabMenu)."", LOG_DEBUG);
633  $resql = $this->db->query($sql);
634  if ($resql)
635  {
636  $numa = $this->db->num_rows($resql);
637 
638  $a = 0;
639  $b = 0;
640  while ($a < $numa)
641  {
642  //$objm = $this->db->fetch_object($resql);
643  $menu = $this->db->fetch_array($resql);
644 
645  // Define $right
646  $perms = true;
647  if (isset($menu['perms']))
648  {
649  $tmpcond = $menu['perms'];
650  if ($leftmenu == 'all') $tmpcond = preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z_]+/', '1==1', $tmpcond); // Force part of condition to true
651  $perms = verifCond($tmpcond);
652  //print "verifCond rowid=".$menu['rowid']." ".$tmpcond.":".$perms."<br>\n";
653  }
654 
655  // Define $enabled
656  $enabled = true;
657  if (isset($menu['enabled']))
658  {
659  $tmpcond = $menu['enabled'];
660  if ($leftmenu == 'all') $tmpcond = preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z_]+/', '1==1', $tmpcond); // Force part of condition to true
661  $enabled = verifCond($tmpcond);
662  }
663 
664  // Define $title
665  if ($enabled)
666  {
667  $title = $langs->trans($menu['titre']); // If $menu['titre'] start with $, a dol_eval is done.
668  //var_dump($title.'-'.$menu['titre']);
669  if ($title == $menu['titre']) // Translation not found
670  {
671  if (!empty($menu['langs'])) // If there is a dedicated translation file
672  {
673  //print 'Load file '.$menu['langs'].'<br>';
674  $langs->load($menu['langs']);
675  }
676 
677  $substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
678  $menu['titre'] = make_substitutions($menu['titre'], $substitarray);
679 
680  if (preg_match("/\//", $menu['titre'])) // To manage translation when title is string1/string2
681  {
682  $tab_titre = explode("/", $menu['titre']);
683  $title = $langs->trans($tab_titre[0])."/".$langs->trans($tab_titre[1]);
684  } elseif (preg_match('/\|\|/', $menu['titre']))
685  {
686  // To manage different translation (Title||AltTitle@ConditionForAltTitle)
687  $tab_title = explode("||", $menu['titre']);
688  $alt_title = explode("@", $tab_title[1]);
689  $title_enabled = verifCond($alt_title[1]);
690  $title = ($title_enabled ? $langs->trans($alt_title[0]) : $langs->trans($tab_title[0]));
691  } else {
692  $title = $langs->trans($menu['titre']);
693  }
694  }
695  //$tmp4=microtime(true);
696  //print '>>> 3 '.($tmp4 - $tmp3).'<br>';
697 
698  // We complete tabMenu
699  $tabMenu[$b]['rowid'] = $menu['rowid'];
700  $tabMenu[$b]['module'] = $menu['module'];
701  $tabMenu[$b]['fk_menu'] = $menu['fk_menu'];
702  $tabMenu[$b]['url'] = $menu['url'];
703  if (!preg_match("/^(http:\/\/|https:\/\/)/i", $tabMenu[$b]['url']))
704  {
705  if (preg_match('/\?/', $tabMenu[$b]['url'])) $tabMenu[$b]['url'] .= '&amp;idmenu='.$menu['rowid'];
706  else $tabMenu[$b]['url'] .= '?idmenu='.$menu['rowid'];
707  }
708  $tabMenu[$b]['titre'] = $title;
709  $tabMenu[$b]['target'] = $menu['target'];
710  $tabMenu[$b]['mainmenu'] = $menu['mainmenu'];
711  $tabMenu[$b]['leftmenu'] = $menu['leftmenu'];
712  $tabMenu[$b]['perms'] = $perms;
713  $tabMenu[$b]['langs'] = $menu['langs']; // Note that this should not be used, lang file should be already loaded.
714  $tabMenu[$b]['enabled'] = $enabled;
715  $tabMenu[$b]['type'] = $menu['type'];
716  $tabMenu[$b]['fk_mainmenu'] = $menu['fk_mainmenu'];
717  $tabMenu[$b]['fk_leftmenu'] = $menu['fk_leftmenu'];
718  $tabMenu[$b]['position'] = (int) $menu['position'];
719 
720  $b++;
721  }
722 
723  $a++;
724  }
725  $this->db->free($resql);
726 
727  // Currently $tabMenu is sorted on position.
728  // 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
729  // into the leftMenuCharger later to avoid useless operations.
730 
731  return 1;
732  } else {
733  dol_print_error($this->db);
734  return -1;
735  }
736  }
737 
746  private function recur($tab, $pere, $level)
747  {
748  // Loop on tab array
749  $num = count($tab);
750  for ($x = 0; $x < $num; $x++)
751  {
752  //si un element a pour pere : $pere
753  if ((($tab[$x]['fk_menu'] >= 0 && $tab[$x]['fk_menu'] == $pere)) && $tab[$x]['enabled'])
754  {
755  $this->newmenu->add($tab[$x]['url'], $tab[$x]['titre'], ($level - 1), $tab[$x]['perms'], $tab[$x]['target'], $tab[$x]['mainmenu'], $tab[$x]['leftmenu']);
756  $this->recur($tab, $tab[$x]['rowid'], ($level + 1));
757  }
758  }
759  }
760 }
verifCond($strRights)
Verify if condition in string is ok or not.
__construct($db, $menu_handler= '')
Constructor.
create($user=null)
Create menu entry into database.
recur($tab, $pere, $level)
Complete this-&gt;newmenu with menu entry found in $tab.
</td >< tdcolspan="3">< spanclass="opacitymedium"></span ></td ></tr >< trclass="liste_total"> CREANCES DETTES< tdcolspan="3"class="right"></td >< tdcolspan="3"class="right"></td ></tr > CREANCES DETTES RECETTES DEPENSES trips CREANCES DETTES Y m expensereport p date_valid Y m expensereport pe datep $db idate($date_start)."' AND $column < p rowid
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-&gt;newmenu array.
$conf db
API class for accounts.
Definition: inc.php:54
$conf db user
Definition: repair.php:109
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
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)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->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)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1232
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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=&gt;newva...
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition: repair.php:105