Fix: dynamic menu does not works with auguria. Add a temporary fix.

This commit is contained in:
Laurent Destailleur 2012-12-17 23:19:48 +01:00
parent 515f30591d
commit 752aabfc86
3 changed files with 19 additions and 7 deletions

View File

@ -412,7 +412,7 @@ class Menubase
}
/**
* Load entries found in database in a menu array.
* Load entries found from database in this->newmenu array.
*
* @param array $newmenu Menu array to complete (in most cases, it's empty, may be already initialized with some menu manager like eldy)
* @param string $mymainmenu Value for mainmenu to filter menu to load (often $_SESSION["mainmenu"])
@ -433,7 +433,7 @@ class Menubase
// We initialize newmenu with first already found menu entries
$this->newmenu = $newmenu;
// Load datas from database into $tabMenu, then we will complete this->newmenu with values into $tabMenu
// Load datas from database into $tabMenu, later we will complete this->newmenu with values into $tabMenu
if (count($tabMenu) == 0)
{
$this->menuLoad($mainmenu, $leftmenu, $type_user, $menu_handler, $tabMenu);
@ -526,7 +526,7 @@ class Menubase
$mainmenu=$mymainmenu; // To export to dol_eval function
$leftmenu=$myleftmenu; // To export to dol_eval function
$sql = "SELECT m.rowid, m.type, 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";
$sql = "SELECT m.rowid, m.type, 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";
$sql.= " FROM ".MAIN_DB_PREFIX."menu as m";
$sql.= " WHERE m.entity IN (0,".(! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)?"1,":"").$conf->entity.")";
$sql.= " AND m.menu_handler IN ('".$menu_handler."','all')";
@ -614,7 +614,7 @@ class Menubase
//$tabMenu[$b]['langs'] = $menu['langs'];
$tabMenu[$b]['fk_mainmenu'] = $menu['fk_mainmenu'];
$tabMenu[$b]['fk_leftmenu'] = $menu['fk_leftmenu'];
//$tabMenu[$b]['position'] = $menu['position'];
$tabMenu[$b]['position'] = $menu['position'];
$b++;
}

View File

@ -236,9 +236,21 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after)
}
}
// Modules system tools
// TODO Find a way to add parent menu only if child menu exists. For the moment, no ther method than hard coded methods.
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled) || ! empty($conf->global->MAIN_MENU_ENABLE_MODULETOOLS))
{
$langs->load("products");
$newmenu->add("/admin/tools/index.php?mainmenu=home&leftmenu=modulesadmintools", $langs->trans("ModulesSystemTools"), 0, 1, '', $mainmenu, 'modulesadmintools');
if ($leftmenu=="modulesadmintools")
{
$newmenu->add("/product/admin/product_tools.php?mainmenu=home&leftmenu=modulesadmintools",$langs->trans("ProductVatMassChange"),1);
}
}
/**
* On definit newmenu en fonction de mainmenu et leftmenu
* ------------------------------------------------------
* We update newmenu with entries found into database
* --------------------------------------------------
*/
if ($mainmenu)
{

View File

@ -710,7 +710,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
$newmenu->add("/support/index.php?mainmenu=home&leftmenu=admintools", $langs->trans("HelpCenter"),1,1,'targethelp');
}
// Modules system tools
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled) || ! empty($conf->global->MAIN_MENU_ENABLE_MODULETOOLS))
{
$langs->load("products");
$newmenu->add("/admin/tools/index.php?mainmenu=home&leftmenu=modulesadmintools", $langs->trans("ModulesSystemTools"), 0, 1, '', $mainmenu, 'modulesadmintools');