1003856 IDEMPIERE-1951 Run report as a background job. Fix counts of background user jobs included scheduler jobs.

This commit is contained in:
Heng Sin Low 2014-05-06 20:00:10 +08:00
parent c232e04e04
commit bc960ac0fa
1 changed files with 3 additions and 3 deletions

View File

@ -355,7 +355,7 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
int AD_Client_ID = Env.getAD_Client_ID(m_ctx); int AD_Client_ID = Env.getAD_Client_ID(m_ctx);
int AD_User_ID = Env.getAD_User_ID(m_ctx); int AD_User_ID = Env.getAD_User_ID(m_ctx);
int count = new Query(m_ctx, MPInstance.Table_Name, "NVL(AD_User_ID,0)=? AND IsProcessing='Y'", null) int count = new Query(m_ctx, MPInstance.Table_Name, "Coalesce(AD_User_ID,0)=? AND IsProcessing='Y' AND IsRunAsJob='Y' ", null)
.setOnlyActiveRecords(true) .setOnlyActiveRecords(true)
.setClient_ID() .setClient_ID()
.setParameters(AD_User_ID) .setParameters(AD_User_ID)
@ -363,14 +363,14 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
if (count >= MSysConfig.getIntValue(MSysConfig.BACKGROUND_JOB_MAX_PER_USER, 5, AD_Client_ID)) if (count >= MSysConfig.getIntValue(MSysConfig.BACKGROUND_JOB_MAX_PER_USER, 5, AD_Client_ID))
throw new IllegalStateException(Msg.getMsg(m_ctx, "BackgroundJobExceedMaxPerUser")); throw new IllegalStateException(Msg.getMsg(m_ctx, "BackgroundJobExceedMaxPerUser"));
count = new Query(m_ctx, MPInstance.Table_Name, "IsProcessing='Y'", null) count = new Query(m_ctx, MPInstance.Table_Name, "IsProcessing='Y' AND IsRunAsJob='Y' ", null)
.setOnlyActiveRecords(true) .setOnlyActiveRecords(true)
.setClient_ID() .setClient_ID()
.count(); .count();
if (count >= MSysConfig.getIntValue(MSysConfig.BACKGROUND_JOB_MAX_PER_CLIENT, 10, AD_Client_ID)) if (count >= MSysConfig.getIntValue(MSysConfig.BACKGROUND_JOB_MAX_PER_CLIENT, 10, AD_Client_ID))
throw new IllegalStateException(Msg.getMsg(m_ctx, "BackgroundJobExceedMaxPerClient")); throw new IllegalStateException(Msg.getMsg(m_ctx, "BackgroundJobExceedMaxPerClient"));
count = new Query(m_ctx, MPInstance.Table_Name, "IsProcessing='Y'", null) count = new Query(m_ctx, MPInstance.Table_Name, "IsProcessing='Y' AND IsRunAsJob='Y' ", null)
.setOnlyActiveRecords(true) .setOnlyActiveRecords(true)
.count(); .count();
if (count >= MSysConfig.getIntValue(MSysConfig.BACKGROUND_JOB_MAX_IN_SYSTEM, 20)) if (count >= MSysConfig.getIntValue(MSysConfig.BACKGROUND_JOB_MAX_IN_SYSTEM, 20))