diff --git a/migration/iD10/oracle/202203031552_IDEMPIERE-5202.sql b/migration/iD10/oracle/202203031552_IDEMPIERE-5202.sql new file mode 100644 index 0000000000..5e57d84969 --- /dev/null +++ b/migration/iD10/oracle/202203031552_IDEMPIERE-5202.sql @@ -0,0 +1,14 @@ +-- IDEMPIERE-5202 Implement auto save of current tab +SELECT register_migration_script('202203031552_IDEMPIERE-5202.sql') FROM dual; + +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Mar 3, 2022, 3:53:48 PM CET +INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200196,0,0,TO_TIMESTAMP('2022-03-03 15:53:47','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2022-03-03 15:53:47','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ZK_AUTO_SAVE_TABS_EXCLUDED','344,402','D','C','7c2fe8a9-c627-465e-a639-d6b051916410') +; + +-- Mar 3, 2022, 3:55:43 PM CET +UPDATE AD_SysConfig SET Description='Comma separated list of tabs (ID or UUID) excluded from the auto save feature',Updated=TO_TIMESTAMP('2022-03-03 15:55:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_SysConfig_ID=200196 +; + diff --git a/migration/iD10/postgresql/202203031552_IDEMPIERE-5202.sql b/migration/iD10/postgresql/202203031552_IDEMPIERE-5202.sql new file mode 100644 index 0000000000..2476e5bfeb --- /dev/null +++ b/migration/iD10/postgresql/202203031552_IDEMPIERE-5202.sql @@ -0,0 +1,11 @@ +-- IDEMPIERE-5202 Implement auto save of current tab +SELECT register_migration_script('202203031552_IDEMPIERE-5202.sql') FROM dual; + +-- Mar 3, 2022, 3:53:48 PM CET +INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200196,0,0,TO_TIMESTAMP('2022-03-03 15:53:47','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2022-03-03 15:53:47','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ZK_AUTO_SAVE_TABS_EXCLUDED','344,402','D','C','7c2fe8a9-c627-465e-a639-d6b051916410') +; + +-- Mar 3, 2022, 3:55:43 PM CET +UPDATE AD_SysConfig SET Description='Comma separated list of tabs (ID or UUID) excluded from the auto save feature',Updated=TO_TIMESTAMP('2022-03-03 15:55:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_SysConfig_ID=200196 +; + diff --git a/org.adempiere.base/src/org/compiere/model/MSysConfig.java b/org.adempiere.base/src/org/compiere/model/MSysConfig.java index d0f43a925f..e466c102a1 100644 --- a/org.adempiere.base/src/org/compiere/model/MSysConfig.java +++ b/org.adempiere.base/src/org/compiere/model/MSysConfig.java @@ -44,7 +44,7 @@ public class MSysConfig extends X_AD_SysConfig /** * */ - private static final long serialVersionUID = -3851200335563922376L; + private static final long serialVersionUID = -4977677634921011590L; public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION"; public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS"; @@ -175,6 +175,7 @@ public class MSysConfig extends X_AD_SysConfig public static final String WEBUI_LOGOURL = "WEBUI_LOGOURL"; public static final String ZK_ADVANCE_FIND_FILTER_COLUMN_LIST = "ZK_ADVANCE_FIND_FILTER_COLUMN_LIST"; public static final String ZK_AUTO_SAVE_CHANGES = "ZK_AUTO_SAVE_CHANGES"; + public static final String ZK_AUTO_SAVE_TABS_EXCLUDED = "ZK_AUTO_SAVE_TABS_EXCLUDED"; public static final String ZK_BROWSER_ICON = "ZK_BROWSER_ICON"; public static final String ZK_BROWSER_TITLE = "ZK_BROWSER_TITLE"; public static final String ZK_BUTTON_STYLE = "ZK_BUTTON_STYLE"; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java index fdf28ba9b7..d2e2709e48 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java @@ -1959,13 +1959,26 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements && Util.isEmpty(dirtyTabpanel.getGridTab().getCommitWarning(), true) && Env.isAutoCommit(ctx, curWindowNo)) { if (dirtyTabpanel.getGridTab().isNeedSaveAndMandatoryFill()) { - //sleep needed for onClose to show confirmation dialog - try { - Thread.sleep(200); - } catch (InterruptedException e2) { - } - if (!showingOnExitDialog) - Executions.schedule(getComponent().getDesktop(), e1 -> asyncAutoSave(), new Event("onAutoSave")); + String tabsExcluded = MSysConfig.getValue(MSysConfig.ZK_AUTO_SAVE_TABS_EXCLUDED, Env.getAD_Client_ID(Env.getCtx())); + boolean isTabExcluded = false; + if (!Util.isEmpty(tabsExcluded)) { + String tabID = String.valueOf(dirtyTabpanel.getGridTab().getAD_Tab_ID()); + String tabUU = dirtyTabpanel.getGridTab().getAD_Tab_UU(); + for (String excl : tabsExcluded.split(",")) { + if (excl.equals(tabID) || excl.equals(tabUU)) { + isTabExcluded = true; + } + } + } + if (!isTabExcluded) { + //sleep needed for onClose to show confirmation dialog + try { + Thread.sleep(200); + } catch (InterruptedException e2) { + } + if (!showingOnExitDialog) + Executions.schedule(getComponent().getDesktop(), e1 -> asyncAutoSave(), new Event("onAutoSave")); + } } } }