IDEMPIERE-357 Ticket #1001002 Move the Menu to be a Portlet / enable dashboard for System user

This commit is contained in:
Carlos Ruiz 2012-11-09 11:56:08 -05:00
parent c77297c201
commit e7aee3e466
2 changed files with 7 additions and 26 deletions

View File

@ -49,17 +49,9 @@ public class MDashboardPreference extends X_PA_DashboardPreference
{
Properties ctx = Env.getCtx();
StringBuilder whereClause = new StringBuilder(COLUMNNAME_IsShowInDashboard).append("=?");
if (AD_Role_ID == 0)
whereClause.append(" AND (").append(COLUMNNAME_AD_Role_ID).append(" IS NULL OR ").append(COLUMNNAME_AD_Role_ID).append("=?)");
else
whereClause.append(" AND ").append(COLUMNNAME_AD_Role_ID).append("=?");
if (AD_User_ID == 0)
whereClause.append(" AND (").append(COLUMNNAME_AD_User_ID).append(" IS NULL OR ").append(COLUMNNAME_AD_User_ID).append("=?)");
else
whereClause.append(" AND ").append(COLUMNNAME_AD_User_ID).append("=?");
StringBuilder whereClause = new StringBuilder(COLUMNNAME_IsShowInDashboard).append("=?")
.append(" AND ").append(COLUMNNAME_AD_Role_ID).append("=?")
.append(" AND ").append(COLUMNNAME_AD_User_ID).append("=?");
List<Object> parameters = new ArrayList<Object>();
parameters.add(isShowInDashboard);
@ -83,17 +75,9 @@ public class MDashboardPreference extends X_PA_DashboardPreference
{
Properties ctx = Env.getCtx();
StringBuilder whereClause = new StringBuilder();
if (AD_Role_ID == 0)
whereClause.append("(").append(COLUMNNAME_AD_Role_ID).append(" IS NULL OR ").append(COLUMNNAME_AD_Role_ID).append("=?)");
else
whereClause.append(COLUMNNAME_AD_Role_ID).append("=?");
if (AD_User_ID == 0)
whereClause.append(" AND (").append(COLUMNNAME_AD_User_ID).append(" IS NULL OR ").append(COLUMNNAME_AD_User_ID).append("=?)");
else
whereClause.append(" AND ").append(COLUMNNAME_AD_User_ID).append("=?");
StringBuilder whereClause = new StringBuilder()
.append(COLUMNNAME_AD_Role_ID).append("=?")
.append(" AND ").append(COLUMNNAME_AD_User_ID).append("=?");
List<Object> parameters = new ArrayList<Object>();
parameters.add(AD_Role_ID);

View File

@ -516,16 +516,13 @@ public class DashboardController implements EventListener<Event> {
private void createDashboardPreference()
{
if (Env.getAD_User_ID(Env.getCtx()) == 0 && Env.getAD_Role_ID(Env.getCtx()) == 0)
return;
MDashboardContent[] dcs = MDashboardContent.getForSession(0, 0);
for (MDashboardContent dc : dcs)
{
MDashboardPreference preference = new MDashboardPreference(Env.getCtx(), 0, null);
preference.setAD_Org_ID(Env.getAD_Org_ID(Env.getCtx()));
preference.setAD_Role_ID(Env.getAD_Role_ID(Env.getCtx()));
preference.setAD_User_ID(Env.getAD_User_ID(Env.getCtx()));
preference.set_ValueNoCheck("AD_User_ID", Env.getAD_User_ID(Env.getCtx()));
preference.setColumnNo(dc.getColumnNo());
preference.setIsCollapsedByDefault(dc.isCollapsedByDefault());
preference.setIsShowInDashboard(dc.isShowInDashboard());