|
|
|
|
@ -48,7 +48,7 @@ function print_eldy_menu($db,$atarget,$type_user)
|
|
|
|
|
|
|
|
|
|
// Home
|
|
|
|
|
$classname="";
|
|
|
|
|
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "home")
|
|
|
|
|
if (isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "home")
|
|
|
|
|
{
|
|
|
|
|
$classname='class="tmenusel"'; $_SESSION['idmenu']='';
|
|
|
|
|
}
|
|
|
|
|
@ -76,7 +76,7 @@ function print_eldy_menu($db,$atarget,$type_user)
|
|
|
|
|
$langs->load("suppliers");
|
|
|
|
|
|
|
|
|
|
$classname="";
|
|
|
|
|
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "companies")
|
|
|
|
|
if (isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "companies")
|
|
|
|
|
{
|
|
|
|
|
$classname='class="tmenusel"'; $_SESSION['idmenu']='';
|
|
|
|
|
}
|
|
|
|
|
@ -110,14 +110,14 @@ function print_eldy_menu($db,$atarget,$type_user)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Products-Services
|
|
|
|
|
$tmpentry=array('enabled'=>($conf->product->enabled || $conf->service->enabled), 'perms'=>($user->rights->produit->lire || $user->rights->service->lire), 'module'=>'product|service');
|
|
|
|
|
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
|
|
|
|
|
if ($showmode)
|
|
|
|
|
{
|
|
|
|
|
$tmpentry=array('enabled'=>($conf->product->enabled || $conf->service->enabled), 'perms'=>($user->rights->produit->lire || $user->rights->service->lire), 'module'=>'product|service');
|
|
|
|
|
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
|
|
|
|
|
if ($showmode)
|
|
|
|
|
{
|
|
|
|
|
$langs->load("products");
|
|
|
|
|
|
|
|
|
|
$classname="";
|
|
|
|
|
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "products")
|
|
|
|
|
if (isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "products")
|
|
|
|
|
{
|
|
|
|
|
$classname='class="tmenusel"'; $_SESSION['idmenu']='';
|
|
|
|
|
}
|
|
|
|
|
@ -167,7 +167,7 @@ function print_eldy_menu($db,$atarget,$type_user)
|
|
|
|
|
$langs->load("commercial");
|
|
|
|
|
|
|
|
|
|
$classname="";
|
|
|
|
|
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "commercial")
|
|
|
|
|
if (isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "commercial")
|
|
|
|
|
{
|
|
|
|
|
$classname='class="tmenusel"'; $_SESSION['idmenu']='';
|
|
|
|
|
}
|
|
|
|
|
@ -209,7 +209,7 @@ function print_eldy_menu($db,$atarget,$type_user)
|
|
|
|
|
$langs->load("compta");
|
|
|
|
|
|
|
|
|
|
$classname="";
|
|
|
|
|
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "accountancy")
|
|
|
|
|
if (isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "accountancy")
|
|
|
|
|
{
|
|
|
|
|
$classname='class="tmenusel"'; $_SESSION['idmenu']='';
|
|
|
|
|
}
|
|
|
|
|
@ -252,7 +252,7 @@ function print_eldy_menu($db,$atarget,$type_user)
|
|
|
|
|
$langs->load("banks");
|
|
|
|
|
|
|
|
|
|
$classname="";
|
|
|
|
|
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "bank")
|
|
|
|
|
if (isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "bank")
|
|
|
|
|
{
|
|
|
|
|
$classname='class="tmenusel"'; $_SESSION['idmenu']='';
|
|
|
|
|
}
|
|
|
|
|
@ -294,7 +294,7 @@ function print_eldy_menu($db,$atarget,$type_user)
|
|
|
|
|
$langs->load("projects");
|
|
|
|
|
|
|
|
|
|
$classname="";
|
|
|
|
|
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "project")
|
|
|
|
|
if (isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "project")
|
|
|
|
|
{
|
|
|
|
|
$classname='class="tmenusel"'; $_SESSION['idmenu']='';
|
|
|
|
|
}
|
|
|
|
|
@ -336,7 +336,7 @@ function print_eldy_menu($db,$atarget,$type_user)
|
|
|
|
|
$langs->load("other");
|
|
|
|
|
|
|
|
|
|
$classname="";
|
|
|
|
|
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "tools")
|
|
|
|
|
if (isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "tools")
|
|
|
|
|
{
|
|
|
|
|
$classname='class="tmenusel"'; $_SESSION['idmenu']='';
|
|
|
|
|
}
|
|
|
|
|
@ -378,7 +378,7 @@ function print_eldy_menu($db,$atarget,$type_user)
|
|
|
|
|
$langs->load("shop");
|
|
|
|
|
|
|
|
|
|
$classname="";
|
|
|
|
|
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "shop")
|
|
|
|
|
if (isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "shop")
|
|
|
|
|
{
|
|
|
|
|
$classname='class="tmenusel"'; $_SESSION['idmenu']='';
|
|
|
|
|
}
|
|
|
|
|
@ -406,7 +406,7 @@ function print_eldy_menu($db,$atarget,$type_user)
|
|
|
|
|
if ($showmode)
|
|
|
|
|
{
|
|
|
|
|
$classname="";
|
|
|
|
|
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "members")
|
|
|
|
|
if (isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "members")
|
|
|
|
|
{
|
|
|
|
|
$classname='class="tmenusel"'; $_SESSION['idmenu']='';
|
|
|
|
|
}
|
|
|
|
|
@ -451,10 +451,10 @@ function print_eldy_menu($db,$atarget,$type_user)
|
|
|
|
|
{
|
|
|
|
|
$idsel=(empty($newTabMenu[$i]['mainmenu'])?'none':$newTabMenu[$i]['mainmenu']);
|
|
|
|
|
|
|
|
|
|
$showmode=dol_eldy_showmenu($type_user,$newTabMenu[$i],$listofmodulesforexternal);
|
|
|
|
|
$showmode=dol_eldy_showmenu($type_user,$newTabMenu[$i],$listofmodulesforexternal);
|
|
|
|
|
|
|
|
|
|
if ($showmode == 1)
|
|
|
|
|
{
|
|
|
|
|
if ($showmode == 1)
|
|
|
|
|
{
|
|
|
|
|
if (preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url']))
|
|
|
|
|
{
|
|
|
|
|
$url = $newTabMenu[$i]['url'];
|
|
|
|
|
@ -1462,36 +1462,36 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Function to test if an entry is enabled or not
|
|
|
|
|
*
|
|
|
|
|
* @param string $type_user 0=We need backoffice menu, 1=We need frontoffice menu
|
|
|
|
|
* @param array &$menuentry Array for menu entry
|
|
|
|
|
* @param array &$listofmodulesforexternal Array with list of modules allowed to external users
|
|
|
|
|
* @return int 0=Hide, 1=Show, 2=Show gray
|
|
|
|
|
*/
|
|
|
|
|
function dol_eldy_showmenu($type_user, &$menuentry, &$listofmodulesforexternal)
|
|
|
|
|
{
|
|
|
|
|
//print 'type_user='.$type_user.' module='.$menuentry['module'].' enabled='.$menuentry['enabled'].' perms='.$menuentry['perms'];
|
|
|
|
|
//print 'ok='.in_array($menuentry['module'], $listofmodulesforexternal);
|
|
|
|
|
|
|
|
|
|
if (empty($menuentry['enabled'])) return 0; // Entry disabled by condition
|
|
|
|
|
if ($type_user && $menuentry['module'])
|
|
|
|
|
{
|
|
|
|
|
$tmploops=explode('|',$menuentry['module']);
|
|
|
|
|
$found=0;
|
|
|
|
|
foreach($tmploops as $tmploop)
|
|
|
|
|
{
|
|
|
|
|
if (in_array($tmploop, $listofmodulesforexternal)) {
|
|
|
|
|
$found++; break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (! $found) return 0; // Entry is for menus all excluded to external users
|
|
|
|
|
}
|
|
|
|
|
if (! $menuentry['perms'] && $type_user) return 0; // No permissions and user is external
|
|
|
|
|
if (! $menuentry['perms'] && ! empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED)) return 0; // No permissions and option to hide when not allowed, even for internal user, is on
|
|
|
|
|
if (! $menuentry['perms']) return 2; // No permissions and user is external
|
|
|
|
|
return 1;
|
|
|
|
|
/**
|
|
|
|
|
* Function to test if an entry is enabled or not
|
|
|
|
|
*
|
|
|
|
|
* @param string $type_user 0=We need backoffice menu, 1=We need frontoffice menu
|
|
|
|
|
* @param array &$menuentry Array for menu entry
|
|
|
|
|
* @param array &$listofmodulesforexternal Array with list of modules allowed to external users
|
|
|
|
|
* @return int 0=Hide, 1=Show, 2=Show gray
|
|
|
|
|
*/
|
|
|
|
|
function dol_eldy_showmenu($type_user, &$menuentry, &$listofmodulesforexternal)
|
|
|
|
|
{
|
|
|
|
|
//print 'type_user='.$type_user.' module='.$menuentry['module'].' enabled='.$menuentry['enabled'].' perms='.$menuentry['perms'];
|
|
|
|
|
//print 'ok='.in_array($menuentry['module'], $listofmodulesforexternal);
|
|
|
|
|
|
|
|
|
|
if (empty($menuentry['enabled'])) return 0; // Entry disabled by condition
|
|
|
|
|
if ($type_user && $menuentry['module'])
|
|
|
|
|
{
|
|
|
|
|
$tmploops=explode('|',$menuentry['module']);
|
|
|
|
|
$found=0;
|
|
|
|
|
foreach($tmploops as $tmploop)
|
|
|
|
|
{
|
|
|
|
|
if (in_array($tmploop, $listofmodulesforexternal)) {
|
|
|
|
|
$found++; break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (! $found) return 0; // Entry is for menus all excluded to external users
|
|
|
|
|
}
|
|
|
|
|
if (! $menuentry['perms'] && $type_user) return 0; // No permissions and user is external
|
|
|
|
|
if (! $menuentry['perms'] && ! empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED)) return 0; // No permissions and option to hide when not allowed, even for internal user, is on
|
|
|
|
|
if (! $menuentry['perms']) return 2; // No permissions and user is external
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|