diff --git a/migration/360lts-release/oracle/837_IDEMPIERE-195.sql b/migration/360lts-release/oracle/837_IDEMPIERE-195.sql new file mode 100644 index 0000000000..9cf01d6e00 --- /dev/null +++ b/migration/360lts-release/oracle/837_IDEMPIERE-195.sql @@ -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 +; diff --git a/migration/360lts-release/postgresql/837_IDEMPIERE-195.sql b/migration/360lts-release/postgresql/837_IDEMPIERE-195.sql new file mode 100644 index 0000000000..8dc78e9449 --- /dev/null +++ b/migration/360lts-release/postgresql/837_IDEMPIERE-195.sql @@ -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 +; diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_User.java b/org.adempiere.base/src/org/compiere/model/I_AD_User.java index 58837e3e97..e2d9f4f216 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_User.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_User.java @@ -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"; diff --git a/org.adempiere.base/src/org/compiere/model/MUser.java b/org.adempiere.base/src/org/compiere/model/MUser.java index e7a5de22e0..522befcfcd 100644 --- a/org.adempiere.base/src/org/compiere/model/MUser.java +++ b/org.adempiere.base/src/org/compiere/model/MUser.java @@ -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 @@ -804,7 +803,20 @@ public class MUser extends X_AD_User setValue(super.getValue()); 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 diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_User.java b/org.adempiere.base/src/org/compiere/model/X_AD_User.java index c2457d4ed3..8b61c745d2 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_User.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_User.java @@ -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. diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java b/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java index 7492fd59ec..7abd543ed0 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java @@ -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 diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java index a5602c0c22..f761c4c665 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java @@ -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 }