IDEMPIERE-5202 Implement auto save of current tab / add ZK_AUTO_SAVE_TABS_EXCLUDED, exclude Request windows (#1221)

This commit is contained in:
Carlos Ruiz 2022-03-04 08:59:53 +01:00 committed by GitHub
parent 60fb790b17
commit 715dfe8192
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 8 deletions

View File

@ -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
;

View File

@ -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
;

View File

@ -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";

View File

@ -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"));
}
}
}
}