diff --git a/migration/i2.1/oracle/201504220959_IDEMPIERE-581.sql b/migration/i2.1/oracle/201504220959_IDEMPIERE-581.sql new file mode 100644 index 0000000000..7d6f3c1867 --- /dev/null +++ b/migration/i2.1/oracle/201504220959_IDEMPIERE-581.sql @@ -0,0 +1,6 @@ +delete from ad_preference where ad_user_id is null and (attribute like '%|DetailPane.Height' or attribute like '%|DetailPane.IsOpen') +; + +SELECT register_migration_script('201504220959_IDEMPIERE-581.sql') FROM dual +; + diff --git a/migration/i2.1/postgresql/201504220959_IDEMPIERE-581.sql b/migration/i2.1/postgresql/201504220959_IDEMPIERE-581.sql new file mode 100644 index 0000000000..7d6f3c1867 --- /dev/null +++ b/migration/i2.1/postgresql/201504220959_IDEMPIERE-581.sql @@ -0,0 +1,6 @@ +delete from ad_preference where ad_user_id is null and (attribute like '%|DetailPane.Height' or attribute like '%|DetailPane.IsOpen') +; + +SELECT register_migration_script('201504220959_IDEMPIERE-581.sql') FROM dual +; + diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java index 704330483d..96806e1772 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java @@ -1104,19 +1104,19 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer int windowId = getGridTab().getAD_Window_ID(); int adTabId = getGridTab().getAD_Tab_ID(); if (windowId > 0 && adTabId > 0) { - Query query = new Query(Env.getCtx(), MTable.get(Env.getCtx(), I_AD_Preference.Table_ID), "AD_Window_ID=? AND Attribute=? AND AD_Process_ID IS NULL AND PreferenceFor = 'W'", null); + Query query = new Query(Env.getCtx(), MTable.get(Env.getCtx(), I_AD_Preference.Table_ID), "AD_Window_ID=? AND Attribute=? AND AD_User_ID=? AND AD_Process_ID IS NULL AND PreferenceFor = 'W'", null); + int userId = Env.getAD_User_ID(Env.getCtx()); MPreference preference = query.setOnlyActiveRecords(true) .setApplyAccessFilter(true) - .setParameters(windowId, adTabId+"|DetailPane.IsOpen") + .setParameters(windowId, adTabId+"|DetailPane.IsOpen", userId) .first(); - if (preference != null && preference.getAD_Preference_ID() > 0) { - preference.setValue(value ? "Y" : "N"); - } else { + if (preference == null || preference.getAD_Preference_ID() <= 0) { preference = new MPreference(Env.getCtx(), 0, null); preference.setAD_Window_ID(windowId); + preference.setAD_User_ID(userId); preference.setAttribute(adTabId+"|DetailPane.IsOpen"); - preference.setValue(value ? "Y" : "N"); } + preference.setValue(value ? "Y" : "N"); preference.saveEx(); //update current context Env.getCtx().setProperty("P"+windowId+"|"+adTabId+"|DetailPane.IsOpen", value ? "Y" : "N"); @@ -1738,14 +1738,16 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer int windowId = getGridTab().getAD_Window_ID(); int adTabId = getGridTab().getAD_Tab_ID(); if (windowId > 0 && adTabId > 0) { - Query query = new Query(Env.getCtx(), MTable.get(Env.getCtx(), I_AD_Preference.Table_ID), "AD_Window_ID=? AND Attribute=? AND AD_Process_ID IS NULL AND PreferenceFor = 'W'", null); + Query query = new Query(Env.getCtx(), MTable.get(Env.getCtx(), I_AD_Preference.Table_ID), "AD_Window_ID=? AND Attribute=? AND AD_User_ID=? AND AD_Process_ID IS NULL AND PreferenceFor = 'W'", null); + int userId = Env.getAD_User_ID(Env.getCtx()); MPreference preference = query.setOnlyActiveRecords(true) .setApplyAccessFilter(true) - .setParameters(windowId, adTabId+"|DetailPane.Height") + .setParameters(windowId, adTabId+"|DetailPane.Height", userId) .first(); if (preference == null || preference.getAD_Preference_ID() <= 0) { preference = new MPreference(Env.getCtx(), 0, null); preference.setAD_Window_ID(windowId); + preference.setAD_User_ID(userId); preference.setAttribute(adTabId+"|DetailPane.Height"); } preference.setValue(height);