forked from Wavyzz/dolibarr
Qual: Fix phan notices wrt main.inc.php, menus (#30633)
* Qual: Fix phan notices wrt main.inc.php, menus # Qual: Fix phan notices wrt main.inc.php, menus This fixes phan notices stemming from main.inc.php and the menu classes. * Qual: Fix phpstan notice that dol_authmode always set # Qual: Fix phpstan notice that dol_authmode always set dol_authmode is always set because it is now initialised.
This commit is contained in:
@@ -540,7 +540,6 @@ return [
|
||||
'htdocs/core/extrafieldsinimport.inc.php' => ['PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'],
|
||||
'htdocs/core/filemanagerdol/connectors/php/connector.lib.php' => ['PhanPluginConstantVariableNull', 'PhanPluginUnknownArrayFunctionParamType'],
|
||||
'htdocs/core/get_info.php' => ['PhanPluginSuspiciousParamPosition'],
|
||||
'htdocs/core/get_menudiv.php' => ['PhanRedefinedClassReference'],
|
||||
'htdocs/core/lib/accounting.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanTypeInvalidLeftOperandOfNumericOp'],
|
||||
'htdocs/core/lib/admin.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/core/lib/agenda.lib.php' => ['PhanPluginConstantVariableNull', 'PhanPluginUnknownArrayFunctionParamType', 'PhanTypeMismatchArgumentProbablyReal'],
|
||||
@@ -581,11 +580,6 @@ return [
|
||||
'htdocs/core/lib/usergroups.lib.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/core/lib/website.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentNullableInternal'],
|
||||
'htdocs/core/lib/xcal.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'],
|
||||
'htdocs/core/menus/standard/auguria.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanUndeclaredProperty'],
|
||||
'htdocs/core/menus/standard/auguria_menu.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanRedefineClass'],
|
||||
'htdocs/core/menus/standard/eldy.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredVariable'],
|
||||
'htdocs/core/menus/standard/eldy_menu.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanRedefineClass', 'PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/core/menus/standard/empty.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanRedefineClass'],
|
||||
'htdocs/core/modules/DolibarrModules.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/core/modules/action/doc/pdf_standard_actions.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredMethod'],
|
||||
'htdocs/core/modules/action/modules_action.php' => ['PhanPluginUnknownArrayMethodReturnType'],
|
||||
@@ -776,7 +770,6 @@ return [
|
||||
'htdocs/datapolicy/class/datapolicycron.class.php' => ['PhanPluginUnknownPropertyType'],
|
||||
'htdocs/debugbar/class/DataCollector/DolConfigCollector.php' => ['PhanPluginUnknownArrayMethodReturnType'],
|
||||
'htdocs/debugbar/class/DataCollector/DolExceptionsCollector.php' => ['PhanPluginUnknownArrayMethodReturnType'],
|
||||
'htdocs/debugbar/class/DataCollector/DolLogsCollector.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanRedefinedClassReference'],
|
||||
'htdocs/debugbar/class/DataCollector/DolMemoryCollector.php' => ['PhanPluginUnknownArrayMethodReturnType'],
|
||||
'htdocs/debugbar/class/DataCollector/DolPhpCollector.php' => ['PhanPluginUnknownArrayMethodReturnType'],
|
||||
'htdocs/debugbar/class/DataCollector/DolQueryCollector.php' => ['PhanPluginUnknownArrayMethodReturnType'],
|
||||
@@ -957,7 +950,6 @@ return [
|
||||
'htdocs/loan/note.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
|
||||
'htdocs/loan/payment/payment.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
|
||||
'htdocs/loan/schedule.php' => ['PhanTypeInvalidLeftOperandOfNumericOp', 'PhanUndeclaredGlobalVariable'],
|
||||
'htdocs/main.inc.php' => ['PhanEmptyForeach', 'PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanPossiblyUndeclaredVariable', 'PhanRedefineFunction', 'PhanRedefinedClassReference', 'PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/margin/customerMargins.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/margin/productMargins.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/master.inc.php' => ['PhanUndeclaredGlobalVariable'],
|
||||
|
||||
@@ -285,9 +285,12 @@ if (!class_exists('MenuManager')) {
|
||||
include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu;
|
||||
}
|
||||
}
|
||||
// @phan-suppress-next-line PhanRedefinedClassReference
|
||||
$menumanager = new MenuManager($db, empty($user->socid) ? 0 : 1);
|
||||
// @phan-suppress-next-line PhanRedefinedClassReference
|
||||
$menumanager->loadMenu('all', 'all'); // Load this->tabMenu with sql menu entries
|
||||
//var_dump($menumanager);exit;
|
||||
// @phan-suppress-next-line PhanRedefinedClassReference
|
||||
$menumanager->showmenu('jmobile');
|
||||
|
||||
print '</body>';
|
||||
|
||||
@@ -29,13 +29,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
|
||||
/**
|
||||
* Core function to output top menu auguria
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $atarget Target (Example: '' or '_top')
|
||||
* @param int $type_user 0=Menu for backoffice, 1=Menu for front office
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $atarget Target (Example: '' or '_top')
|
||||
* @param int $type_user 0=Menu for backoffice, 1=Menu for front office
|
||||
* @param array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}> $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
|
||||
* @param Menu $menu Object Menu to return back list of menu entries
|
||||
* @param int $noout 1=Disable output (Initialise &$menu only).
|
||||
* @param string $mode 'top', 'topnb', 'left', 'jmobile'
|
||||
* @param Menu $menu Object Menu to return back list of menu entries
|
||||
* @param int<0,1> $noout 1=Disable output (Initialise &$menu only).
|
||||
* @param string $mode 'top', 'topnb', 'left', 'jmobile'
|
||||
* @return int 0
|
||||
*/
|
||||
function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 0, $mode = '')
|
||||
@@ -220,14 +220,14 @@ function print_start_menu_entry_auguria($idsel, $classname, $showmode)
|
||||
/**
|
||||
* Output menu entry
|
||||
*
|
||||
* @param string $text Text
|
||||
* @param int $showmode 0 = hide, 1 = allowed or 2 = not allowed
|
||||
* @param string $url Url
|
||||
* @param string $id Id
|
||||
* @param string $idsel Id sel
|
||||
* @param string $classname Class name
|
||||
* @param string $atarget Target
|
||||
* @param array $menuval All the $menuval array
|
||||
* @param string $text Text
|
||||
* @param int<0,2> $showmode 0 = hide, 1 = allowed or 2 = not allowed
|
||||
* @param string $url Url
|
||||
* @param string $id Id
|
||||
* @param string $idsel Id sel
|
||||
* @param string $classname Class name
|
||||
* @param string $atarget Target
|
||||
* @param array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}|array{} $menuval The full $menuval array
|
||||
* @return void
|
||||
*/
|
||||
function print_text_menu_entry_auguria($text, $showmode, $url, $id, $idsel, $classname, $atarget, $menuval = array())
|
||||
@@ -314,11 +314,11 @@ function print_end_menu_array_auguria()
|
||||
* @param array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}> $menu_array_after Table of menu entries to show after entries of menu handler (menu->liste filled with menu->add)
|
||||
* @param array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}> $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
|
||||
* @param Menu $menu Object Menu to return back list of menu entries
|
||||
* @param int $noout Disable output (Initialise &$menu only).
|
||||
* @param int<0,1> $noout Disable output (Initialise &$menu only).
|
||||
* @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x'
|
||||
* @param string $forceleftmenu 'all'=Force leftmenu to '' (= all). If value come being '', we change it to value in session and 'none' if not defined in session.
|
||||
* @param array $moredata An array with more data to output
|
||||
* @param int $type_user 0=Menu for backoffice, 1=Menu for front office
|
||||
* @param ?array<string,string> $moredata An array with more data to output
|
||||
* @param int<0,1> $type_user 0=Menu for backoffice, 1=Menu for front office
|
||||
* @return int Nb of menu entries
|
||||
*/
|
||||
function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null, $type_user = 0)
|
||||
@@ -500,10 +500,10 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t
|
||||
$reshook = $hookmanager->executeHooks('menuLeftMenuItems', $parameters, $hook_items); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if (is_numeric($reshook)) {
|
||||
if ($reshook == 0 && !empty($hookmanager->results)) {
|
||||
$menu_array[] = $hookmanager->results; // add
|
||||
if ($reshook == 0 && !empty($hookmanager->resArray)) {
|
||||
$menu_array[] = $hookmanager->resArray; // add
|
||||
} elseif ($reshook == 1) {
|
||||
$menu_array = $hookmanager->results; // replace
|
||||
$menu_array = $hookmanager->resArray; // replace
|
||||
}
|
||||
|
||||
// @todo Sort menu items by 'position' value
|
||||
@@ -689,9 +689,9 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t
|
||||
* 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
|
||||
* @param array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string} $menuentry Array for menu entry
|
||||
* @param string[] $listofmodulesforexternal Array with list of modules allowed to external users
|
||||
* @return int<0,2> 0=Hide, 1=Show, 2=Show gray
|
||||
*/
|
||||
function dol_auguria_showmenu($type_user, &$menuentry, &$listofmodulesforexternal)
|
||||
{
|
||||
@@ -703,7 +703,7 @@ function dol_auguria_showmenu($type_user, &$menuentry, &$listofmodulesforexterna
|
||||
return 0; // Entry disabled by condition
|
||||
}
|
||||
if ($type_user && $menuentry['module']) {
|
||||
$tmploops = explode('|', $menuentry['module']);
|
||||
$tmploops = explode('|', (string) $menuentry['module']);
|
||||
$found = 0;
|
||||
foreach ($tmploops as $tmploop) {
|
||||
if (in_array($tmploop, $listofmodulesforexternal)) {
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
/**
|
||||
* Class to manage menu Auguria
|
||||
*
|
||||
* @phan-suppress PhanRedefineClass
|
||||
*/
|
||||
class MenuManager
|
||||
{
|
||||
@@ -36,12 +38,12 @@ class MenuManager
|
||||
public $db;
|
||||
|
||||
/**
|
||||
* @var int Put 0 for internal users, 1 for external users
|
||||
* @var int<0,1> 0 for internal users, 1 for external users
|
||||
*/
|
||||
public $type_user;
|
||||
|
||||
/**
|
||||
* @var string To store default target to use onto links
|
||||
* @var string Default target to use for links
|
||||
*/
|
||||
public $atarget = "";
|
||||
|
||||
@@ -55,9 +57,18 @@ class MenuManager
|
||||
*/
|
||||
public $menu;
|
||||
|
||||
/**
|
||||
* @var array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}>
|
||||
*/
|
||||
public $menu_array;
|
||||
/**
|
||||
* @var array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}>
|
||||
*/
|
||||
public $menu_array_after;
|
||||
|
||||
/**
|
||||
* @var array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}>
|
||||
*/
|
||||
public $tabMenu;
|
||||
|
||||
|
||||
@@ -65,7 +76,7 @@ class MenuManager
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param int $type_user Type of user
|
||||
* @param int<0,1> $type_user Type of user
|
||||
*/
|
||||
public function __construct($db, $type_user)
|
||||
{
|
||||
@@ -141,9 +152,9 @@ class MenuManager
|
||||
* Show menu.
|
||||
* Menu defined in sql tables were stored into $this->tabMenu BEFORE this is called.
|
||||
*
|
||||
* @param string $mode 'top', 'topnb', 'left', 'jmobile' (used to get full xml ul/li menu)
|
||||
* @param array $moredata An array with more data to output
|
||||
* @return int 0 or nb of top menu entries if $mode = 'topnb'
|
||||
* @param string $mode 'top', 'topnb', 'left', 'jmobile' (used to get full xml ul/li menu)
|
||||
* @param ?array<string,string> $moredata An array with more data to output
|
||||
* @return int<0,max> 0 or nb of top menu entries if $mode = 'topnb'
|
||||
*/
|
||||
public function showmenu($mode, $moredata = null)
|
||||
{
|
||||
|
||||
@@ -726,11 +726,11 @@ function print_end_menu_array()
|
||||
* @param array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level?:int,prefix:string}> $menu_array_after Table of menu entries to show after entries of menu handler (menu->liste filled with menu->add)
|
||||
* @param array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level?:int,prefix:string}> $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
|
||||
* @param Menu $menu Object Menu to return back list of menu entries
|
||||
* @param int $noout Disable output (Initialise &$menu only).
|
||||
* @param int<0,1> $noout Disable output (Initialise &$menu only).
|
||||
* @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x'
|
||||
* @param string $forceleftmenu 'all'=Force leftmenu to '' (= all). If value come being '', we change it to value in session and 'none' if not defined in session.
|
||||
* @param array $moredata An array with more data to output
|
||||
* @param int $type_user 0=Menu for backoffice, 1=Menu for front office
|
||||
* @param ?array<string,string> $moredata An array with more data to output
|
||||
* @param int<0,1> $type_user 0=Menu for backoffice, 1=Menu for front office
|
||||
* @return int Nb of menu entries
|
||||
*/
|
||||
function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null, $type_user = 0)
|
||||
@@ -1777,6 +1777,7 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef
|
||||
if ($nature) {
|
||||
$langs->load('accountancy');
|
||||
$journallabel = '';
|
||||
$journallabelwithoutspan = '';
|
||||
if ($objp->label) {
|
||||
$journallabelwithoutspan = $langs->trans($objp->label);
|
||||
$journallabel = '<span class="opacitymedium">('.$langs->trans($objp->label).')</span>'; // Label of bank account in llx_accounting_journal
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
|
||||
/**
|
||||
* Class to manage menu Eldy
|
||||
*
|
||||
* @phan-suppress PhanRedefineClass
|
||||
*/
|
||||
class MenuManager
|
||||
{
|
||||
@@ -54,9 +56,18 @@ class MenuManager
|
||||
*/
|
||||
public $menu;
|
||||
|
||||
/**
|
||||
* @var array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}>
|
||||
*/
|
||||
public $menu_array;
|
||||
/**
|
||||
* @var array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}>
|
||||
*/
|
||||
public $menu_array_after;
|
||||
|
||||
/**
|
||||
* @var array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}>
|
||||
*/
|
||||
public $tabMenu;
|
||||
|
||||
|
||||
@@ -64,7 +75,7 @@ class MenuManager
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param int $type_user Type of user
|
||||
* @param int<0,1> $type_user Type of user
|
||||
*/
|
||||
public function __construct($db, $type_user)
|
||||
{
|
||||
@@ -137,9 +148,9 @@ class MenuManager
|
||||
* Show menu.
|
||||
* Menu defined in sql tables were stored into $this->tabMenu BEFORE this is called.
|
||||
*
|
||||
* @param string $mode 'top', 'topnb', 'left', 'leftdropdown', 'jmobile' (used to get full xml ul/li menu)
|
||||
* @param array $moredata An array with more data to output
|
||||
* @return int 0 or nb of top menu entries if $mode = 'topnb'
|
||||
* @param string $mode 'top', 'topnb', 'left', 'leftdropdown', 'jmobile' (used to get full xml ul/li menu)
|
||||
* @param ?array<string,mixed> $moredata An array with more data to output
|
||||
* @return int 0 or nb of top menu entries if $mode = 'topnb'
|
||||
*/
|
||||
public function showmenu($mode, $moredata = null)
|
||||
{
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
/**
|
||||
* Class to manage empty menu
|
||||
*
|
||||
* @phan-suppress PhanRedefineClass
|
||||
*/
|
||||
class MenuManager
|
||||
{
|
||||
@@ -31,26 +33,47 @@ class MenuManager
|
||||
*/
|
||||
public $db;
|
||||
|
||||
public $type_user = 0; // Put 0 for internal users, 1 for external users
|
||||
public $atarget = ""; // To store default target to use onto links
|
||||
/**
|
||||
* @var int<0,1> 0 for internal users, 1 for external users
|
||||
*/
|
||||
public $type_user = 0;
|
||||
/**
|
||||
* @var string Default target to use in links
|
||||
*/
|
||||
public $atarget = "";
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $name = "empty";
|
||||
|
||||
/**
|
||||
* @var Menu
|
||||
*/
|
||||
public $menu;
|
||||
/**
|
||||
* @var array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}>
|
||||
*/
|
||||
public $menu_array_after;
|
||||
|
||||
/**
|
||||
* @var array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level:int,prefix:string}>
|
||||
*/
|
||||
public $tabMenu;
|
||||
|
||||
/**
|
||||
* @var Menu
|
||||
*/
|
||||
public $topmenu;
|
||||
/**
|
||||
* @var Menu
|
||||
*/
|
||||
public $leftmenu;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param int $type_user Type of user
|
||||
* @param int<0,1> $type_user Type of user
|
||||
*/
|
||||
public function __construct($db, $type_user)
|
||||
{
|
||||
@@ -76,9 +99,9 @@ class MenuManager
|
||||
/**
|
||||
* Show menu
|
||||
*
|
||||
* @param string $mode 'top', 'left', 'jmobile'
|
||||
* @param array $moredata An array with more data to output
|
||||
* @return int|string 0 or nb of top menu entries if $mode = 'topnb', string inc ase of bad parameter
|
||||
* @param string $mode 'top', 'left', 'jmobile'
|
||||
* @param ?array<string,mixed> $moredata An array with more data to output
|
||||
* @return int<0,max>|string 0 or nb of top menu entries if $mode = 'topnb', string inc ase of bad parameter
|
||||
*/
|
||||
public function showmenu($mode, $moredata = null)
|
||||
{
|
||||
@@ -508,7 +531,7 @@ function print_start_menu_entry_empty($idsel, $classname, $showmode)
|
||||
* @param string $idsel Id sel
|
||||
* @param string $classname Class name
|
||||
* @param string $atarget Target
|
||||
* @param array $menuval All the $menuval array
|
||||
* @param array{}|array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level?:int,prefix:string} $menuval All the $menuval array
|
||||
* @return void
|
||||
*/
|
||||
function print_text_menu_entry_empty($text, $showmode, $url, $id, $idsel, $classname, $atarget, $menuval = array())
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -65,7 +66,7 @@ class DolLogsCollector extends MessagesCollector
|
||||
/**
|
||||
* Return widget settings
|
||||
*
|
||||
* @return array Array
|
||||
* @return array<string,array{icon?:string,widget?:string,map:string,default:string}> Array
|
||||
*/
|
||||
public function getWidgets()
|
||||
{
|
||||
@@ -91,7 +92,7 @@ class DolLogsCollector extends MessagesCollector
|
||||
/**
|
||||
* Return collected data
|
||||
*
|
||||
* @return array Array of collected data
|
||||
* @return array{count:int,messages:string[]} Array of collected data
|
||||
*/
|
||||
public function collect()
|
||||
{
|
||||
@@ -111,6 +112,7 @@ class DolLogsCollector extends MessagesCollector
|
||||
foreach ($log_levels as $level_key => $level) {
|
||||
if (strpos(strtolower($line), strtolower($level_key)) == 20) {
|
||||
$this->nboflines++;
|
||||
// Use parent method to add the message
|
||||
$this->addMessage($line, $level, false);
|
||||
}
|
||||
}
|
||||
@@ -155,9 +157,9 @@ class DolLogsCollector extends MessagesCollector
|
||||
/**
|
||||
* Get latest file lines
|
||||
*
|
||||
* @param string $file File
|
||||
* @param int $lines Lines
|
||||
* @return array Array
|
||||
* @param string $file File
|
||||
* @param int $lines Lines
|
||||
* @return string[] Array
|
||||
*/
|
||||
protected function tailFile($file, $lines)
|
||||
{
|
||||
@@ -192,8 +194,8 @@ class DolLogsCollector extends MessagesCollector
|
||||
/**
|
||||
* Search a string for log entries into the log file. Used when debug bar scan log file (very slow).
|
||||
*
|
||||
* @param string $file File
|
||||
* @return array Lines of logs
|
||||
* @param string $file File
|
||||
* @return list<array{level:string,line:string}> Lines of log entries
|
||||
*/
|
||||
public function getLogs($file)
|
||||
{
|
||||
@@ -218,10 +220,11 @@ class DolLogsCollector extends MessagesCollector
|
||||
/**
|
||||
* Get the log levels from psr/log.
|
||||
*
|
||||
* @return array Array of log level
|
||||
* @return array<string,string> Array of log level
|
||||
*/
|
||||
public function getLevels()
|
||||
{
|
||||
// @phan-suppress-next-line PhanRedefinedClassReference // Psr/LogLevel also provided by Sabre setup
|
||||
$class = new ReflectionClass(new LogLevel());
|
||||
$levels = $class->getConstants();
|
||||
$levels['ERR'] = 'error';
|
||||
|
||||
@@ -485,6 +485,7 @@ if (isModEnabled('debugbar') && !GETPOST('dol_use_jmobile') && empty($_SESSION['
|
||||
}
|
||||
$conf->global->MAIN_HTML_HEADER .= $renderer->renderHead();
|
||||
|
||||
'@phan-var-force array{time:DebugBar\DataCollector\TimeDataCollector} $debugbar';
|
||||
$debugbar['time']->startMeasure('pageaftermaster', 'Page generation (after environment init)');
|
||||
}
|
||||
|
||||
@@ -791,6 +792,8 @@ if (!defined('NOLOGIN')) {
|
||||
// At the end of this phase, the variable $login is defined.
|
||||
$resultFetchUser = '';
|
||||
$test = true;
|
||||
$dol_authmode = null;
|
||||
|
||||
if (!isset($_SESSION["dol_login"])) {
|
||||
// It is not already authenticated and it requests the login / password
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||
@@ -939,10 +942,8 @@ if (!defined('NOLOGIN')) {
|
||||
$login = '';
|
||||
}
|
||||
|
||||
$dol_authmode = '';
|
||||
|
||||
if ($login) {
|
||||
$dol_authmode = $conf->authmode; // This properties is defined only when logged, to say what mode was successfully used
|
||||
$dol_authmode = $conf->authmode; // This property is defined only when logged, to say what mode was successfully used
|
||||
$dol_tz = empty($_POST["tz"]) ? (empty($_SESSION["tz"]) ? '' : $_SESSION["tz"]) : $_POST["tz"];
|
||||
$dol_tz_string = empty($_POST["tz_string"]) ? (empty($_SESSION["tz_string"]) ? '' : $_SESSION["tz_string"]) : $_POST["tz_string"];
|
||||
$dol_tz_string = preg_replace('/\s*\(.+\)$/', '', $dol_tz_string);
|
||||
@@ -1019,7 +1020,7 @@ if (!defined('NOLOGIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$resultFetchUser = $user->fetch('', $login, '', 1, ($entitytotest > 0 ? $entitytotest : -1)); // value for $login was retrieved previously when checking password.
|
||||
$resultFetchUser = $user->fetch(0, $login, '', 1, ($entitytotest > 0 ? $entitytotest : -1)); // value for $login was retrieved previously when checking password.
|
||||
if ($resultFetchUser <= 0 || $user->isNotIntoValidityDateRange()) {
|
||||
dol_syslog('User not found or not valid, connection refused');
|
||||
session_destroy();
|
||||
@@ -1088,7 +1089,7 @@ if (!defined('NOLOGIN')) {
|
||||
$entity = isset($_SESSION["dol_entity"]) ? $_SESSION["dol_entity"] : 0;
|
||||
dol_syslog("- This is an already logged session. _SESSION['dol_login']=".$login." _SESSION['dol_entity']=".$entity, LOG_DEBUG);
|
||||
|
||||
$resultFetchUser = $user->fetch('', $login, '', 1, ($entity > 0 ? $entity : -1));
|
||||
$resultFetchUser = $user->fetch(0, $login, '', 1, ($entity > 0 ? $entity : -1));
|
||||
|
||||
//var_dump(dol_print_date($user->flagdelsessionsbefore, 'dayhour', 'gmt')." ".dol_print_date($_SESSION["dol_logindate"], 'dayhour', 'gmt'));
|
||||
|
||||
@@ -1142,7 +1143,7 @@ if (!defined('NOLOGIN')) {
|
||||
// Hooks on failed login
|
||||
$action = '';
|
||||
$hookmanager->initHooks(array('login'));
|
||||
$parameters = array('dol_authmode' => (isset($dol_authmode) ? $dol_authmode : ''), 'dol_loginmesg' => $_SESSION["dol_loginmesg"]);
|
||||
$parameters = array('dol_authmode' => (string) $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]);
|
||||
$reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
$error++;
|
||||
@@ -1538,6 +1539,7 @@ if (!defined('NOREQUIREMENU')) {
|
||||
if (GETPOST('menu', 'alpha')) {
|
||||
$file_menu = GETPOST('menu', 'alpha'); // example: menu=eldy_menu.php
|
||||
}
|
||||
|
||||
if (!class_exists('MenuManager')) {
|
||||
$menufound = 0;
|
||||
$dirmenus = array_merge(array("/core/menus/"), (array) $conf->modules_parts['menus']);
|
||||
@@ -1553,7 +1555,9 @@ if (!defined('NOREQUIREMENU')) {
|
||||
include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu;
|
||||
}
|
||||
}
|
||||
// @phan-suppress-next-line PhanRedefinedClassReference
|
||||
$menumanager = new MenuManager($db, empty($user->socid) ? 0 : 1);
|
||||
// @phan-suppress-next-line PhanRedefinedClassReference
|
||||
$menumanager->loadMenu();
|
||||
}
|
||||
|
||||
@@ -1580,14 +1584,15 @@ if (!function_exists("llxHeader")) {
|
||||
* @param string $target Target to use on links
|
||||
* @param int<0,1> $disablejs More content into html header
|
||||
* @param int<0,1> $disablehead More content into html header
|
||||
* @param array|string $arrayofjs Array of complementary js files
|
||||
* @param array|string $arrayofcss Array of complementary css files
|
||||
* @param string[]|string $arrayofjs Array of complementary js files
|
||||
* @param string[]|string $arrayofcss Array of complementary css files
|
||||
* @param string $morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails)
|
||||
* @param string $morecssonbody More CSS on body tag. For example 'classforhorizontalscrolloftabs'.
|
||||
* @param string $replacemainareaby Replace call to main_area() by a print of this string
|
||||
* @param int $disablenofollow Disable the "nofollow" on meta robot header
|
||||
* @param int $disablenoindex Disable the "noindex" on meta robot header
|
||||
* @return void
|
||||
* @phan-suppress PhanRedefineFunction (Also defined in htdocs/asterisk/wrapper)
|
||||
*/
|
||||
function llxHeader($head = '', $title = '', $help_url = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '', $morecssonbody = '', $replacemainareaby = '', $disablenofollow = 0, $disablenoindex = 0)
|
||||
{
|
||||
@@ -1639,7 +1644,7 @@ if (!function_exists("llxHeader")) {
|
||||
}
|
||||
|
||||
if (empty($conf->dol_hide_leftmenu) && !GETPOST('dol_openinpopup', 'aZ09')) {
|
||||
left_menu(array(), $help_url, '', array(), 1, $title, 1); // $menumanager is retrieved with a global $menumanager inside this function
|
||||
left_menu('', $help_url, '', array(), 1, $title, 1); // $menumanager is retrieved with a global $menumanager inside this function
|
||||
}
|
||||
|
||||
// main area
|
||||
@@ -2262,7 +2267,9 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
|
||||
|
||||
// Show menu entries
|
||||
print '<div id="tmenu_tooltip'.(!getDolGlobalString('MAIN_MENU_INVERT') ? '' : 'invert').'" class="tmenu">'."\n";
|
||||
// @phan-suppress-next-line PhanRedefinedClassReference
|
||||
$menumanager->atarget = $target;
|
||||
// @phan-suppress-next-line PhanRedefinedClassReference
|
||||
$menumanager->showmenu('top', array('searchform' => $searchform)); // This contains a \n
|
||||
print "</div>\n";
|
||||
|
||||
@@ -2556,7 +2563,8 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
|
||||
if (!empty($user->admin)) {
|
||||
$dropdownBody .= '<br><b>'.$langs->trans("Administrator").'</b>: '.yn($user->admin);
|
||||
}
|
||||
if (!empty($user->socid)) { // Add thirdparty for external users
|
||||
$company = '';
|
||||
if (!empty($user->socid)) { // Add third party for external users
|
||||
$thirdpartystatic = new Societe($db);
|
||||
$thirdpartystatic->fetch($user->socid);
|
||||
$companylink = ' '.$thirdpartystatic->getNomUrl(2); // picto only of company
|
||||
@@ -2576,6 +2584,7 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
|
||||
$dropdownBody .= '<br><b>'.$langs->trans("ConnectedSince").':</b> '.dol_print_date($user->datelastlogin, "dayhour", 'tzuser');
|
||||
$dropdownBody .= '<br><b>'.$langs->trans("PreviousConnexion").':</b> '.dol_print_date($user->datepreviouslogin, "dayhour", 'tzuser');
|
||||
$dropdownBody .= '<br><b>'.$langs->trans("CurrentTheme").':</b> '.$conf->theme;
|
||||
// @phan-suppress-next-line PhanRedefinedClassReference
|
||||
$dropdownBody .= '<br><b>'.$langs->trans("CurrentMenuManager").':</b> '.(isset($menumanager) ? $menumanager->name : 'unknown');
|
||||
$langFlag = picto_from_langcode($langs->getDefaultLang());
|
||||
$dropdownBody .= '<br><b>'.$langs->trans("CurrentUserLanguage").':</b> '.($langFlag ? $langFlag.' ' : '').$langs->getDefaultLang();
|
||||
@@ -2662,6 +2671,7 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
|
||||
'.$userDropDownImage.'
|
||||
<p>
|
||||
'.$profilName.'<br>';
|
||||
$title = '';
|
||||
if ($user->datelastlogin) {
|
||||
$title = $langs->trans("ConnectedSince").' : '.dol_print_date($user->datelastlogin, "dayhour", 'tzuser');
|
||||
if ($user->datepreviouslogin) {
|
||||
@@ -3141,6 +3151,7 @@ function top_menu_search()
|
||||
$defaultAction = '';
|
||||
$buttonList = '<div class="dropdown-global-search-button-list" >';
|
||||
// Menu with all searchable items
|
||||
// @phan-suppress-next-line PhanEmptyForeach // array is really empty
|
||||
foreach ($arrayresult as $keyItem => $item) {
|
||||
if (empty($defaultAction)) {
|
||||
$defaultAction = $item['url'];
|
||||
@@ -3280,12 +3291,12 @@ function top_menu_search()
|
||||
/**
|
||||
* Show left menu bar
|
||||
*
|
||||
* @param string $menu_array_before Table of menu entries to show before entries of menu handler. This param is deprecated and must be provided to ''.
|
||||
* @param '' $menu_array_before Table of menu entries to show before entries of menu handler. This param is deprecated and must be provided to ''.
|
||||
* @param string $helppagename Name of wiki page for help ('' by default).
|
||||
* Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage|DE:GermanPage
|
||||
* For other external page: http://server/url
|
||||
* @param string $notused Deprecated. Used in past to add content into left menu. Hooks can be used now.
|
||||
* @param array $menu_array_after Table of menu entries to show after entries of menu handler
|
||||
* @param array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,level?:int,prefix:string}> $menu_array_after Table of menu entries to show after entries of menu handler
|
||||
* @param int $leftmenuwithoutmainarea Must be set to 1. 0 by default for backward compatibility with old modules.
|
||||
* @param string $title Title of web page
|
||||
* @param int<0,1> $acceptdelayedhtml 1 if caller request to have html delayed content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect)
|
||||
@@ -3340,6 +3351,7 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_
|
||||
$searchform .= $form->selectArrayFilter('searchselectcombo', $arrayresult, $selected, 'accesskey="s"', 1, 0, (!getDolGlobalString('MAIN_SEARCHBOX_CONTENT_LOADED_BEFORE_KEY') ? 1 : 0), 'vmenusearchselectcombo', 1, $textsearch, 1, $stringforfirstkey.' s');
|
||||
} else {
|
||||
if (is_array($arrayresult)) {
|
||||
// @phan-suppress-next-line PhanEmptyForeach // array is really empty in else case.
|
||||
foreach ($arrayresult as $key => $val) {
|
||||
$searchform .= printSearchForm($val['url'], $val['url'], $val['label'], 'maxwidth125', 'search_all', (empty($val['shortcut']) ? '' : $val['shortcut']), 'searchleft'.$key, $val['img']);
|
||||
}
|
||||
@@ -3396,11 +3408,15 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_
|
||||
print '<div class="vmenu"'.(getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') ? ' alt="Left menu"' : '').'>'."\n\n";
|
||||
|
||||
// Show left menu with other forms
|
||||
// @phan-suppress-next-line PhanRedefinedClassReference
|
||||
$menumanager->menu_array = $menu_array_before;
|
||||
// @phan-suppress-next-line PhanRedefinedClassReference
|
||||
$menumanager->menu_array_after = $menu_array_after;
|
||||
if (getDolGlobalInt('MAIN_MENU_LEFT_DROPDOWN')) {
|
||||
// @phan-suppress-next-line PhanRedefinedClassReference
|
||||
$menumanager->showmenu('leftdropdown', array('searchform' => $searchform)); // output menu_array and menu found in database
|
||||
} else {
|
||||
// @phan-suppress-next-line PhanRedefinedClassReference
|
||||
$menumanager->showmenu('left', array('searchform' => $searchform)); // output menu_array and menu found in database
|
||||
}
|
||||
|
||||
@@ -3708,6 +3724,7 @@ if (!function_exists("llxFooter")) {
|
||||
* @param string $zone 'private' (for private pages) or 'public' (for public pages)
|
||||
* @param int $disabledoutputofmessages Clear all messages stored into session without displaying them
|
||||
* @return void
|
||||
* @phan-suppress PhanRedefineFunction // Also defined at asterisk/wrapper.php
|
||||
*/
|
||||
function llxFooter($comment = '', $zone = 'private', $disabledoutputofmessages = 0)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2018 Andreu Bisquerra <jove@bisquerra.com>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -123,7 +124,7 @@ if (getDolGlobalString('MAIN_APPLICATION_TITLE')) {
|
||||
}
|
||||
$arrayofcss = array('/takepos/css/pos.css.php?a=xxx');
|
||||
|
||||
top_htmlhead($head, $title, 0, 0, '', $arrayofcss);
|
||||
top_htmlhead($head, $title, 0, 0, array(), $arrayofcss);
|
||||
|
||||
?>
|
||||
<body style="overflow: hidden">
|
||||
|
||||
@@ -72,7 +72,9 @@ if (empty($user->id) && !empty($_SESSION['dol_login'])) {
|
||||
$user->loadRights();
|
||||
|
||||
// Reload menu now we have the good user (and we need the good menu to have ->showmenu('topnb') correct.
|
||||
// @phan-suppress-next-line PhanRedefinedClassReference
|
||||
$menumanager = new MenuManager($db, empty($user->socid) ? 0 : 1);
|
||||
// @phan-suppress-next-line PhanRedefinedClassReference
|
||||
$menumanager->loadMenu();
|
||||
}
|
||||
|
||||
@@ -275,6 +277,7 @@ $colortexttitle = implode(',', colorStringToArray($colortexttitle));
|
||||
$colortext = implode(',', colorStringToArray($colortext));
|
||||
$colortextlink = implode(',', colorStringToArray($colortextlink));
|
||||
|
||||
// @phan-suppress-next-line PhanRedefinedClassReference
|
||||
$nbtopmenuentries = $menumanager->showmenu('topnb');
|
||||
$nbtopmenuentriesreal = $nbtopmenuentries;
|
||||
if ($conf->browser->layout == 'phone') {
|
||||
|
||||
@@ -75,7 +75,9 @@ if (empty($user->id) && !empty($_SESSION['dol_login'])) {
|
||||
//$user->loadPersonalConf();
|
||||
|
||||
// Reload menu now we have the good user (and we need the good menu to have ->showmenu('topnb') correct.
|
||||
// @phan-suppress-next-line PhanRedefinedClassReference
|
||||
$menumanager = new MenuManager($db, empty($user->socid) ? 0 : 1);
|
||||
// @phan-suppress-next-line PhanRedefinedClassReference
|
||||
$menumanager->loadMenu();
|
||||
}
|
||||
|
||||
@@ -281,6 +283,7 @@ $colortexttitle = implode(',', colorStringToArray($colortexttitle));
|
||||
$colortext = implode(',', colorStringToArray($colortext));
|
||||
$colortextlink = implode(',', colorStringToArray($colortextlink));
|
||||
|
||||
// @phan-suppress-next-line PhanRedefinedClassReference
|
||||
$nbtopmenuentries = $menumanager->showmenu('topnb');
|
||||
$nbtopmenuentriesreal = $nbtopmenuentries;
|
||||
if ($conf->browser->layout == 'phone') {
|
||||
@@ -3153,78 +3156,78 @@ li.tmenu:hover .tmenuimage:not(.menuhider), li.tmenu:hover .tmenuimage:not(.menu
|
||||
<?php include dol_buildpath($path.'/theme/'.$theme.'/main_menu_fa_icons.inc.php', 0); ?>
|
||||
|
||||
<?php
|
||||
// Add here more div for other menu entries. moduletomainmenu=array('module name'=>'name of class for div')
|
||||
// Add here more div for other menu entries. moduletomainmenu=array('module name'=>'name of class for div')
|
||||
|
||||
$moduletomainmenu = array(
|
||||
'user' => '', 'syslog' => '', 'societe' => 'companies', 'projet' => 'project', 'propale' => 'commercial', 'commande' => 'commercial',
|
||||
'produit' => 'products', 'service' => 'products', 'stock' => 'products',
|
||||
'don' => 'accountancy', 'tax' => 'accountancy', 'banque' => 'accountancy', 'facture' => 'accountancy', 'compta' => 'accountancy', 'accounting' => 'accountancy', 'adherent' => 'members', 'import' => 'tools', 'export' => 'tools', 'mailing' => 'tools',
|
||||
'contrat' => 'commercial', 'ficheinter' => 'commercial', 'ticket' => 'ticket', 'deplacement' => 'commercial',
|
||||
'fournisseur' => 'companies',
|
||||
'barcode' => '', 'fckeditor' => '', 'categorie' => '',
|
||||
);
|
||||
$mainmenuused = 'home';
|
||||
foreach ($conf->modules as $val) {
|
||||
$mainmenuused .= ','.(isset($moduletomainmenu[$val]) ? $moduletomainmenu[$val] : $val);
|
||||
}
|
||||
$mainmenuusedarray = array_unique(explode(',', $mainmenuused));
|
||||
|
||||
$generic = 1;
|
||||
// Put here list of menu entries when the div.mainmenu.menuentry was previously defined
|
||||
$divalreadydefined = array('home', 'companies', 'products', 'mrp', 'commercial', 'externalsite', 'accountancy', 'project', 'tools', 'members', 'agenda', 'ftp', 'holiday', 'hrm', 'bookmark', 'cashdesk', 'takepos', 'ecm', 'geoipmaxmind', 'gravatar', 'clicktodial', 'paypal', 'stripe', 'webservices', 'website');
|
||||
// Put here list of menu entries we are sure we don't want
|
||||
$divnotrequired = array('multicurrency', 'salaries', 'ticket', 'margin', 'opensurvey', 'paybox', 'expensereport', 'incoterm', 'prelevement', 'propal', 'workflow', 'notification', 'supplier_proposal', 'cron', 'product', 'productbatch', 'expedition');
|
||||
foreach ($mainmenuusedarray as $val) {
|
||||
if (empty($val) || in_array($val, $divalreadydefined)) {
|
||||
continue;
|
||||
}
|
||||
if (in_array($val, $divnotrequired)) {
|
||||
continue;
|
||||
}
|
||||
//print "XXX".$val;
|
||||
|
||||
$found = 0;
|
||||
$url = '';
|
||||
$constformoduleicon = 'MAIN_MODULE_'.strtoupper($val).'_ICON';
|
||||
$iconformodule = getDolGlobalString($constformoduleicon);
|
||||
if ($iconformodule) {
|
||||
if (preg_match('/^fa\-/', $iconformodule)) {
|
||||
// This is a fa icon
|
||||
} else {
|
||||
$url = dol_buildpath('/'.$val.'/img/'.$iconformodule.'.png', 1);
|
||||
}
|
||||
$found = 1;
|
||||
} else {
|
||||
// Search img file in module dir
|
||||
foreach ($conf->file->dol_document_root as $dirroot) {
|
||||
if (file_exists($dirroot."/".$val."/img/".$val.".png")) {
|
||||
$url = dol_buildpath('/'.$val.'/img/'.$val.'.png', 1);
|
||||
$found = 1;
|
||||
break;
|
||||
$moduletomainmenu = array(
|
||||
'user' => '', 'syslog' => '', 'societe' => 'companies', 'projet' => 'project', 'propale' => 'commercial', 'commande' => 'commercial',
|
||||
'produit' => 'products', 'service' => 'products', 'stock' => 'products',
|
||||
'don' => 'accountancy', 'tax' => 'accountancy', 'banque' => 'accountancy', 'facture' => 'accountancy', 'compta' => 'accountancy', 'accounting' => 'accountancy', 'adherent' => 'members', 'import' => 'tools', 'export' => 'tools', 'mailing' => 'tools',
|
||||
'contrat' => 'commercial', 'ficheinter' => 'commercial', 'ticket' => 'ticket', 'deplacement' => 'commercial',
|
||||
'fournisseur' => 'companies',
|
||||
'barcode' => '', 'fckeditor' => '', 'categorie' => '',
|
||||
);
|
||||
$mainmenuused = 'home';
|
||||
foreach ($conf->modules as $val) {
|
||||
$mainmenuused .= ','.(isset($moduletomainmenu[$val]) ? $moduletomainmenu[$val] : $val);
|
||||
}
|
||||
}
|
||||
}
|
||||
$mainmenuusedarray = array_unique(explode(',', $mainmenuused));
|
||||
|
||||
// Output entry for menu icon in CSS
|
||||
if (!$found) {
|
||||
print "/* A mainmenu entry was found but img file ".$val.".png not found (check /".$val."/img/".$val.".png), so we use a generic one */\n";
|
||||
print 'div.mainmenu.'.$val.' span::before {'."\n";
|
||||
print 'content: "\f249";'."\n";
|
||||
print '}'."\n";
|
||||
$generic++;
|
||||
} else {
|
||||
if ($url) {
|
||||
print "div.mainmenu.".$val." {\n";
|
||||
print " background-image: url(".$url.");\n";
|
||||
print " background-position-y: 3px;\n";
|
||||
print " filter: saturate(0);\n";
|
||||
print "}\n";
|
||||
} else {
|
||||
print '/* icon for module '.$val.' is a fa icon */'."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
// End of part to add more div class css
|
||||
$generic = 1;
|
||||
// Put here list of menu entries when the div.mainmenu.menuentry was previously defined
|
||||
$divalreadydefined = array('home', 'companies', 'products', 'mrp', 'commercial', 'externalsite', 'accountancy', 'project', 'tools', 'members', 'agenda', 'ftp', 'holiday', 'hrm', 'bookmark', 'cashdesk', 'takepos', 'ecm', 'geoipmaxmind', 'gravatar', 'clicktodial', 'paypal', 'stripe', 'webservices', 'website');
|
||||
// Put here list of menu entries we are sure we don't want
|
||||
$divnotrequired = array('multicurrency', 'salaries', 'ticket', 'margin', 'opensurvey', 'paybox', 'expensereport', 'incoterm', 'prelevement', 'propal', 'workflow', 'notification', 'supplier_proposal', 'cron', 'product', 'productbatch', 'expedition');
|
||||
foreach ($mainmenuusedarray as $val) {
|
||||
if (empty($val) || in_array($val, $divalreadydefined)) {
|
||||
continue;
|
||||
}
|
||||
if (in_array($val, $divnotrequired)) {
|
||||
continue;
|
||||
}
|
||||
//print "XXX".$val;
|
||||
|
||||
$found = 0;
|
||||
$url = '';
|
||||
$constformoduleicon = 'MAIN_MODULE_'.strtoupper($val).'_ICON';
|
||||
$iconformodule = getDolGlobalString($constformoduleicon);
|
||||
if ($iconformodule) {
|
||||
if (preg_match('/^fa\-/', $iconformodule)) {
|
||||
// This is a fa icon
|
||||
} else {
|
||||
$url = dol_buildpath('/'.$val.'/img/'.$iconformodule.'.png', 1);
|
||||
}
|
||||
$found = 1;
|
||||
} else {
|
||||
// Search img file in module dir
|
||||
foreach ($conf->file->dol_document_root as $dirroot) {
|
||||
if (file_exists($dirroot."/".$val."/img/".$val.".png")) {
|
||||
$url = dol_buildpath('/'.$val.'/img/'.$val.'.png', 1);
|
||||
$found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Output entry for menu icon in CSS
|
||||
if (!$found) {
|
||||
print "/* A mainmenu entry was found but img file ".$val.".png not found (check /".$val."/img/".$val.".png), so we use a generic one */\n";
|
||||
print 'div.mainmenu.'.$val.' span::before {'."\n";
|
||||
print 'content: "\f249";'."\n";
|
||||
print '}'."\n";
|
||||
$generic++;
|
||||
} else {
|
||||
if ($url) {
|
||||
print "div.mainmenu.".$val." {\n";
|
||||
print " background-image: url(".$url.");\n";
|
||||
print " background-position-y: 3px;\n";
|
||||
print " filter: saturate(0);\n";
|
||||
print "}\n";
|
||||
} else {
|
||||
print '/* icon for module '.$val.' is a fa icon */'."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
// End of part to add more div class css
|
||||
} // End test if $dol_hide_topmenu?>
|
||||
|
||||
|
||||
|
||||
@@ -2962,6 +2962,7 @@ class User extends CommonObject
|
||||
$data['connectedsince'] = '<br><b>'.$langs->trans("ConnectedSince").':</b> '.dol_print_date($this->datelastlogin, "dayhour", 'tzuser');
|
||||
$data['previousconnexion'] = '<br><b>'.$langs->trans("PreviousConnexion").':</b> '.dol_print_date($this->datepreviouslogin, "dayhour", 'tzuser');
|
||||
$data['currenttheme'] = '<br><b>'.$langs->trans("CurrentTheme").':</b> '.dol_string_nohtmltag($conf->theme);
|
||||
// @phan-suppress-next-line PhanRedefinedClassReference
|
||||
$data['currentmenumanager'] = '<br><b>'.$langs->trans("CurrentMenuManager").':</b> '.dol_string_nohtmltag($menumanager->name);
|
||||
$s = picto_from_langcode($langs->getDefaultLang());
|
||||
$data['currentuserlang'] = '<br><b>'.$langs->trans("CurrentUserLanguage").':</b> '.dol_string_nohtmltag(($s ? $s.' ' : '').$langs->getDefaultLang());
|
||||
|
||||
@@ -112,6 +112,7 @@ if (empty($reshook)) {
|
||||
if ($object->id == $user->id) {
|
||||
$user->clearrights();
|
||||
$user->loadRights();
|
||||
// @phan-suppress-next-line PhanRedefinedClassReference
|
||||
$menumanager->loadMenu();
|
||||
}
|
||||
|
||||
@@ -131,6 +132,7 @@ if (empty($reshook)) {
|
||||
if ($object->id == $user->id) {
|
||||
$user->clearrights();
|
||||
$user->loadRights();
|
||||
// @phan-suppress-next-line PhanRedefinedClassReference
|
||||
$menumanager->loadMenu();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user