IDEMPIERE-195 Expand menu automatically / make user preference override the role configuration

http://jira.idempiere.com/browse/IDEMPIERE-195
This commit is contained in:
Carlos Ruiz 2012-04-18 10:59:22 -05:00
parent 37a4b33bf6
commit 3a0f716618
7 changed files with 75 additions and 22 deletions

View File

@ -0,0 +1,22 @@
-- Apr 18, 2012 10:41:39 AM COT
-- IDEMPIERE-195 Expand menu automatically
UPDATE AD_Column SET AD_Reference_ID=17, AD_Reference_Value_ID=319, DefaultValue=NULL, IsMandatory='N',Updated=TO_DATE('2012-04-18 10:41:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200113
;
-- Apr 18, 2012 10:41:41 AM COT
-- IDEMPIERE-195 Expand menu automatically
ALTER TABLE AD_User MODIFY IsMenuAutoExpand CHAR(1) DEFAULT NULL
;
-- Apr 18, 2012 10:41:44 AM COT
-- IDEMPIERE-195 Expand menu automatically
ALTER TABLE AD_User MODIFY IsMenuAutoExpand NULL
;
UPDATE AD_User SET IsMenuAutoExpand=NULL;
UPDATE AD_System
SET LastMigrationScriptApplied='837_IDEMPIERE-195.sql'
WHERE LastMigrationScriptApplied<'837_IDEMPIERE-195.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -0,0 +1,22 @@
-- Apr 18, 2012 10:41:39 AM COT
-- IDEMPIERE-195 Expand menu automatically
UPDATE AD_Column SET AD_Reference_ID=17, AD_Reference_Value_ID=319, DefaultValue=NULL, IsMandatory='N',Updated=TO_TIMESTAMP('2012-04-18 10:41:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200113
;
-- Apr 18, 2012 10:41:41 AM COT
-- IDEMPIERE-195 Expand menu automatically
INSERT INTO t_alter_column values('ad_user','IsMenuAutoExpand','CHAR(1)',null,'NULL')
;
-- Apr 18, 2012 10:41:44 AM COT
-- IDEMPIERE-195 Expand menu automatically
INSERT INTO t_alter_column values('ad_user','IsMenuAutoExpand',null,'NULL',null)
;
UPDATE AD_User SET IsMenuAutoExpand=NULL;
UPDATE AD_System
SET LastMigrationScriptApplied='837_IDEMPIERE-195.sql'
WHERE LastMigrationScriptApplied<'837_IDEMPIERE-195.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -18,7 +18,6 @@ package org.compiere.model;
import java.math.BigDecimal;
import java.sql.Timestamp;
import org.compiere.model.*;
import org.compiere.util.KeyNamePair;
/** Generated Interface for AD_User
@ -340,12 +339,12 @@ public interface I_AD_User
/** Set Auto expand menu.
* If ticked, the menu is automatically expanded
*/
public void setIsMenuAutoExpand (boolean IsMenuAutoExpand);
public void setIsMenuAutoExpand (String IsMenuAutoExpand);
/** Get Auto expand menu.
* If ticked, the menu is automatically expanded
*/
public boolean isMenuAutoExpand();
public String getIsMenuAutoExpand();
/** Column name LastContact */
public static final String COLUMNNAME_LastContact = "LastContact";

View File

@ -50,8 +50,7 @@ public class MUser extends X_AD_User
/**
*
*/
private static final long serialVersionUID = 1399447378628744412L;
private static final long serialVersionUID = -5845477151929518375L;
/**
* Get active Users of BPartner
@ -805,6 +804,19 @@ public class MUser extends X_AD_User
return true;
} // beforeSave
/**
* Is Menu Auto Expand - user preference
* Check if the user has a preference, otherwise use the value from current role
* @return boolean
*/
public boolean isMenuAutoExpand() {
boolean isMenuAutoExpand = false;
if (getIsMenuAutoExpand() != null)
isMenuAutoExpand = ISMENUAUTOEXPAND_Yes.equals(getIsMenuAutoExpand());
else
isMenuAutoExpand = MRole.getDefault().isMenuAutoExpand();
return isMenuAutoExpand;
}
/**
* Test

View File

@ -31,7 +31,7 @@ public class X_AD_User extends PO implements I_AD_User, I_Persistent
/**
*
*/
private static final long serialVersionUID = 20120412L;
private static final long serialVersionUID = 20120418L;
/** Standard Constructor */
public X_AD_User (Properties ctx, int AD_User_ID, String trxName)
@ -43,8 +43,6 @@ public class X_AD_User extends PO implements I_AD_User, I_Persistent
setIsFullBPAccess (true);
// Y
setIsInPayroll (false);
// N
setIsMenuAutoExpand (false);
// N
setName (null);
setNotificationType (null);
@ -467,28 +465,28 @@ public class X_AD_User extends PO implements I_AD_User, I_Persistent
return false;
}
/** IsMenuAutoExpand AD_Reference_ID=319 */
public static final int ISMENUAUTOEXPAND_AD_Reference_ID=319;
/** Yes = Y */
public static final String ISMENUAUTOEXPAND_Yes = "Y";
/** No = N */
public static final String ISMENUAUTOEXPAND_No = "N";
/** Set Auto expand menu.
@param IsMenuAutoExpand
If ticked, the menu is automatically expanded
*/
public void setIsMenuAutoExpand (boolean IsMenuAutoExpand)
public void setIsMenuAutoExpand (String IsMenuAutoExpand)
{
set_Value (COLUMNNAME_IsMenuAutoExpand, Boolean.valueOf(IsMenuAutoExpand));
set_Value (COLUMNNAME_IsMenuAutoExpand, IsMenuAutoExpand);
}
/** Get Auto expand menu.
@return If ticked, the menu is automatically expanded
*/
public boolean isMenuAutoExpand ()
public String getIsMenuAutoExpand ()
{
Object oo = get_Value(COLUMNNAME_IsMenuAutoExpand);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
return (String)get_Value(COLUMNNAME_IsMenuAutoExpand);
}
/** Set Last Contact.

View File

@ -198,7 +198,7 @@ public final class AMenu extends CFrame
infoUpdaterThread.start();
// Auto Expand Tree - nmicoud IDEMPIERE 195
if (MRole.getDefault().isMenuAutoExpand() || MUser.get(m_ctx).isMenuAutoExpand())
if (MUser.get(m_ctx).isMenuAutoExpand())
treePanel.expandTree(true);
// Auto Expand Tree - nmicoud IDEMPIERE 195

View File

@ -84,7 +84,7 @@ public class MenuPanel extends Panel implements EventListener
pnlSearch.initialise();
// Auto Expand Tree - nmicoud IDEMPIERE 195
if (MRole.getDefault().isMenuAutoExpand() || MUser.get(ctx).isMenuAutoExpand())
if (MUser.get(ctx).isMenuAutoExpand())
expandAll();
// Auto Expand Tree - nmicoud IDEMPIERE 195
}