mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-17 23:11:29 +01:00
Fix: Pb menu internes/externes visibles ou non selon type user
This commit is contained in:
@@ -73,6 +73,8 @@ class modMyModule extends DolibarrModules
|
||||
|
||||
// Data directories to create when module is enabled
|
||||
$this->dirs = array();
|
||||
//$this->dirs[0] = DOL_DATA_ROOT.'/mymodule;
|
||||
//$this->dirs[1] = DOL_DATA_ROOT.'/mymodule/temp;
|
||||
|
||||
// Config pages. Put here list of php page names stored in admmin directory used to setup module
|
||||
$this->config_page_url = array("mymodulesetuppage.php");
|
||||
@@ -114,17 +116,7 @@ class modMyModule extends DolibarrModules
|
||||
|
||||
// Example:
|
||||
// $r++;
|
||||
// type 'top' // Menu top or left
|
||||
// `mainmenu`, 'mymodule' // Name family/module (home, companies, ...)
|
||||
// `fk_menu`, 0 // 0 or Id of mother menu line
|
||||
// `position` 100 // Order of entry
|
||||
// `url`, '/myurl' // Relative (or absolute) url to go
|
||||
// `target`, '' // Target of Url link
|
||||
// `titre`, 'MyMenu' // Key for menu translation
|
||||
// `langs`, 'other' // Lang file to load for translation
|
||||
// `leftmenu`, '' // Condition to compare to $_REQUEST["leftmenu"] to show or hide menu entry
|
||||
// `right`, '' // Condition to show enabled or disabled menu entry
|
||||
// `user`, 0 // 0 if menu for all users, 1 for external only, 2 for internal only
|
||||
// $this->menu[$r]=array('fk_menu'=>0,'type'=>'top','titre'=>'Agenda','mainmenu'=>'agenda','leftmenu'=>'agenda','url'=>'/comm/action/index.php','langs'=>'commercial','position'=>100,'perms'=>'$user->rights->agenda->myactions->read','target'=>'','user'=>0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ class MenuTop {
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/menubase.class.php");
|
||||
|
||||
$menuArbo = new Menubase($this->db,'eldy','top');
|
||||
$tabMenu = $menuArbo->menutopCharger(0,$_SESSION['mainmenu'],'');
|
||||
$tabMenu = $menuArbo->menutopCharger(2,$_SESSION['mainmenu'],'');
|
||||
for($i=0;$i<count($tabMenu);$i++)
|
||||
{
|
||||
if ($tabMenu[$i]['right'] == true)
|
||||
|
||||
@@ -371,7 +371,7 @@ class MenuTop {
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/menubase.class.php");
|
||||
|
||||
$menuArbo = new Menubase($this->db,'rodolphe','top');
|
||||
$tabMenu = $menuArbo->menutopCharger(1,$_SESSION['mainmenu'],'rodolphe');
|
||||
$tabMenu = $menuArbo->menutopCharger(2,$_SESSION['mainmenu'],'rodolphe');
|
||||
for($i=0;$i<count($tabMenu);$i++)
|
||||
{
|
||||
if ($tabMenu[$i]['right'] == true)
|
||||
|
||||
@@ -218,9 +218,6 @@ class modAdherent extends DolibarrModules
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// Permissions
|
||||
$this->remove();
|
||||
|
||||
// Dir
|
||||
$this->dirs[0] = $conf->adherent->dir_output;
|
||||
$this->dirs[1] = $conf->adherent->dir_output."/photos";
|
||||
|
||||
@@ -63,6 +63,8 @@ class modAgenda extends DolibarrModules
|
||||
// Dir
|
||||
//----
|
||||
$this->dirs = array();
|
||||
//$this->dirs[0] = DOL_DATA_ROOT.'/mymodule;
|
||||
//$this->dirs[1] = DOL_DATA_ROOT.'/mymodule/temp;
|
||||
|
||||
// Config pages
|
||||
//-------------
|
||||
@@ -155,16 +157,6 @@ class modAgenda extends DolibarrModules
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// Permissions
|
||||
$this->remove();
|
||||
|
||||
// Dir
|
||||
$this->dirs[0] = $conf->adherent->dir_output;
|
||||
$this->dirs[1] = $conf->adherent->dir_output."/photos";
|
||||
$this->dirs[2] = $conf->adherent->dir_export;
|
||||
|
||||
$sql = array();
|
||||
|
||||
return $this->_init($sql);
|
||||
|
||||
@@ -105,30 +105,10 @@ class modWebcalendar extends DolibarrModules
|
||||
// $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||
// $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||
|
||||
$this->rights_class = 'webcal'; // Permission key
|
||||
$this->rights = array(); // Permission array used by this module
|
||||
|
||||
// Main menu entries
|
||||
$this->menus = array(); // List of menus to add
|
||||
$r=0;
|
||||
|
||||
// Example:
|
||||
// $r++;
|
||||
// insert into `llx_menu` (
|
||||
// menu_handler 'all' // Menu handler name (all to add with all menu handlers)
|
||||
// type 'top' // Menu top or left
|
||||
// `mainmenu`, 'webcal' // Name family/module (home, companies, ...)
|
||||
// `fk_menu`, 0 // 0 or Id of mother menu line
|
||||
// `order` 10 // Order of entry
|
||||
// `url`, '/webcal/webcal.php?mainmenu=webcal&leftmenu=' // Relative (or absolute) url to go
|
||||
// `target`, '' // Target of Url link
|
||||
// `titre`, 'Calendar' // Key for menu translation
|
||||
// `langs`, other // Lang file to load for translation
|
||||
// `level`, -1 // deprecated
|
||||
// `leftmenu`, '' // Condition to compare to $_REQUEST["leftmenu"] to show or hide menu entry
|
||||
// `right`, '' // Condition to show enabled or disabled menu entry
|
||||
// `user`, 0 // 0 if menu for all users, 1 for external only, 2 for internal only
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,6 +33,7 @@ require_once($dolibarr_main_document_root . '/propal.class.php');
|
||||
require_once($dolibarr_main_document_root . '/contrat/contrat.class.php');
|
||||
require_once($dolibarr_main_document_root . '/commande/commande.class.php');
|
||||
require_once($dolibarr_main_document_root . '/lib/price.lib.php');
|
||||
require_once($dolibarr_main_document_root . '/lib/menubase.class.php');
|
||||
|
||||
$grant_query='';
|
||||
$etape = 2;
|
||||
@@ -1440,6 +1441,18 @@ function migrate_delete_old_files($db,$langs,$conf)
|
||||
return $result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Supprime fichiers obsoletes
|
||||
*/
|
||||
function migrate_module_menus($db,$langs,$conf)
|
||||
{
|
||||
if ($conf->global->MAIN_MODULE_AGENDA)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT.'/includes/modules/modAgenda.class.php');
|
||||
$mod=new modAgenda($db);
|
||||
$mod->init();
|
||||
}
|
||||
}
|
||||
|
||||
/* A faire egalement: Modif statut paye et fk_facture des factures payés completement
|
||||
|
||||
|
||||
@@ -518,7 +518,9 @@ class Menubase
|
||||
return $overwritemenufor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* brief type_user 0=Internal,1=External,2=All
|
||||
*/
|
||||
function menutopCharger($type_user, $mainmenu, $menu_handler)
|
||||
{
|
||||
global $langs, $user, $conf;
|
||||
@@ -527,10 +529,11 @@ class Menubase
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."menu as m";
|
||||
$sql.= " WHERE m.type = 'top'";
|
||||
$sql.= " AND m.menu_handler in('".$menu_handler."','all')";
|
||||
if($type_user == 0) $sql.= " AND m.user <> 1";
|
||||
else $sql.= " AND m.user > 0";
|
||||
if ($type_user == 0) $sql.= " AND m.user in (0,2)";
|
||||
if ($type_user == 1) $sql.= " AND m.user in (1,2)";
|
||||
$sql.= " ORDER BY m.position";
|
||||
|
||||
//print "x".$sql;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user