DisplayRoleInMenu
Code snippetName: Display Role Name in the Menu
|
To display the rolename currently selected by the logged in user next to the username in the leftside menu, update the following two files:
- In OpenbravoERP/AppsOpenbravo/src/org/openbravo/erpCommon/utility/Menu_data.xsql add the following to the end of all the method definitons:
<SqlMethod name="getRoleName" type="preparedStatement" return="String" default="">
<SqlMethodComment></SqlMethodComment>
<Sql>
SELECT NAME
FROM AD_ROLE
WHERE AD_Role_ID = ?
</Sql>
<Parameter name="adRoleId"/>
</SqlMethod>
- In OpenbravoERP/AppsOpenbravo/src/org/openbravo/erpCommon/utility/VerticalMenu.java change line 121 (line 105 in version 2.40) to:
xmlDocument.setParameter("userName", MenuData.getUserName(this, vars.getUser()) + " (" + MenuData.getRoleName(this, vars.getRole()) + ")");
Then, compile the manual code from the commandline, positioned inside the OpenbravoERP/AppsOpenbravo:
ant compile.development -Dtab=XXX
Enjoy!
Category: Code Snippets

