Fix: Do not load menu when not required.
This commit is contained in:
parent
50de5a944a
commit
08bde6faa5
@ -494,7 +494,7 @@ class Menubase
|
|||||||
/**
|
/**
|
||||||
* Load entries found in database into variable $tabMenu. Note that only "database menu entries" are loaded here, hardcoded will not be present into output.
|
* Load entries found in database into variable $tabMenu. Note that only "database menu entries" are loaded here, hardcoded will not be present into output.
|
||||||
*
|
*
|
||||||
* @param string $mymainmenu Value for left that defined mainmenu
|
* @param string $mymainmenu Value for mainmenu that defined mainmenu
|
||||||
* @param string $myleftmenu Value for left that defined leftmenu
|
* @param string $myleftmenu Value for left that defined leftmenu
|
||||||
* @param int $type_user Looks for menu entry for 0=Internal users, 1=External users
|
* @param int $type_user Looks for menu entry for 0=Internal users, 1=External users
|
||||||
* @param string $menu_handler Name of menu_handler used ('auguria', 'eldy'...)
|
* @param string $menu_handler Name of menu_handler used ('auguria', 'eldy'...)
|
||||||
|
|||||||
@ -768,41 +768,42 @@ if (! empty($conf->multicompany->enabled) && GETPOST('action') == 'switchentity'
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//print 'eee'.$conf->standard_menu;
|
|
||||||
|
|
||||||
// Init menu manager
|
// Init menu manager
|
||||||
if (empty($user->societe_id)) // If internal user or not defined
|
if (! defined('NOREQUIREMENU'))
|
||||||
{
|
{
|
||||||
$conf->standard_menu=(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?(empty($conf->global->MAIN_MENU_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENU_STANDARD):$conf->global->MAIN_MENU_STANDARD_FORCED);
|
if (empty($user->societe_id)) // If internal user or not defined
|
||||||
$conf->smart_menu=(empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?(empty($conf->global->MAIN_MENU_SMARTPHONE)?'smartphone_menu.php':$conf->global->MAIN_MENU_SMARTPHONE):$conf->global->MAIN_MENU_SMARTPHONE_FORCED);
|
|
||||||
}
|
|
||||||
else // If external user
|
|
||||||
{
|
|
||||||
$conf->standard_menu=(empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?(empty($conf->global->MAIN_MENUFRONT_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENUFRONT_STANDARD):$conf->global->MAIN_MENUFRONT_STANDARD_FORCED);
|
|
||||||
$conf->smart_menu=(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE)?'smartphone_menu.php':$conf->global->MAIN_MENUFRONT_SMARTPHONE):$conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load the menu manager (only if not already done)
|
|
||||||
$file_menu=empty($conf->browser->phone)?$conf->standard_menu:$conf->smart_menu;
|
|
||||||
if (GETPOST('menu')) $file_menu=GETPOST('menu'); // example: menu=eldy_menu.php
|
|
||||||
if (! class_exists('MenuManager'))
|
|
||||||
{
|
|
||||||
$menufound=0;
|
|
||||||
$dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']);
|
|
||||||
foreach($dirmenus as $dirmenu)
|
|
||||||
{
|
{
|
||||||
$menufound=dol_include_once($dirmenu."standard/".$file_menu);
|
$conf->standard_menu=(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?(empty($conf->global->MAIN_MENU_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENU_STANDARD):$conf->global->MAIN_MENU_STANDARD_FORCED);
|
||||||
if ($menufound) break;
|
$conf->smart_menu=(empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?(empty($conf->global->MAIN_MENU_SMARTPHONE)?'smartphone_menu.php':$conf->global->MAIN_MENU_SMARTPHONE):$conf->global->MAIN_MENU_SMARTPHONE_FORCED);
|
||||||
}
|
}
|
||||||
if (! $menufound) // If failed to include, we try with standard
|
else // If external user
|
||||||
{
|
{
|
||||||
dol_syslog("You define a menu manager '".$file_menu."' that can not be loaded.", LOG_WARNING);
|
$conf->standard_menu=(empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?(empty($conf->global->MAIN_MENUFRONT_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENUFRONT_STANDARD):$conf->global->MAIN_MENUFRONT_STANDARD_FORCED);
|
||||||
$file_menu='eldy_menu.php';
|
$conf->smart_menu=(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE)?'smartphone_menu.php':$conf->global->MAIN_MENUFRONT_SMARTPHONE):$conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED);
|
||||||
include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
$menumanager = new MenuManager($db, empty($user->societe_id)?0:1);
|
|
||||||
|
|
||||||
|
// Load the menu manager (only if not already done)
|
||||||
|
$file_menu=empty($conf->browser->phone)?$conf->standard_menu:$conf->smart_menu;
|
||||||
|
if (GETPOST('menu')) $file_menu=GETPOST('menu'); // example: menu=eldy_menu.php
|
||||||
|
if (! class_exists('MenuManager'))
|
||||||
|
{
|
||||||
|
$menufound=0;
|
||||||
|
$dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']);
|
||||||
|
foreach($dirmenus as $dirmenu)
|
||||||
|
{
|
||||||
|
$menufound=dol_include_once($dirmenu."standard/".$file_menu);
|
||||||
|
if ($menufound) break;
|
||||||
|
}
|
||||||
|
if (! $menufound) // If failed to include, we try with standard
|
||||||
|
{
|
||||||
|
dol_syslog("You define a menu manager '".$file_menu."' that can not be loaded.", LOG_WARNING);
|
||||||
|
$file_menu='eldy_menu.php';
|
||||||
|
include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$menumanager = new MenuManager($db, empty($user->societe_id)?0:1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user