IDEMPIERE-5347 Minor scheduler improvement (#1393)

This commit is contained in:
hengsin 2022-07-14 05:09:54 +08:00 committed by GitHub
parent b2f5a7a0ae
commit 73aecb1145
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 2 deletions

View File

@ -167,6 +167,8 @@ public class ProcessInfo implements Serializable
private int languageID = 0; private int languageID = 0;
private int m_AD_Scheduler_ID = 0;
public int getLanguageID() { public int getLanguageID() {
return languageID; return languageID;
} }
@ -957,5 +959,21 @@ public class ProcessInfo implements Serializable
public void setReplaceTabContent() { public void setReplaceTabContent() {
this.m_IsReplaceTabContent = !(MSysConfig.getBooleanValue(MSysConfig.ZK_REPORT_TABLE_OPEN_IN_NEW_TAB, false, Env.getAD_Client_ID(Env.getCtx()))); this.m_IsReplaceTabContent = !(MSysConfig.getBooleanValue(MSysConfig.ZK_REPORT_TABLE_OPEN_IN_NEW_TAB, false, Env.getAD_Client_ID(Env.getCtx())));
} }
/**
*
* @return AD_Scheduler_ID or 0 if not running from scheduler
*/
public int getAD_Scheduler_ID() {
return m_AD_Scheduler_ID;
}
/**
*
* @param AD_Scheduler_ID
*/
public void setAD_Scheduler_ID(int AD_Scheduler_ID) {
this.m_AD_Scheduler_ID = AD_Scheduler_ID;
}
} // ProcessInfo } // ProcessInfo

View File

@ -205,6 +205,7 @@ public class Scheduler extends AdempiereServer
pi.setIsBatch(true); pi.setIsBatch(true);
pi.setPrintPreview(true); pi.setPrintPreview(true);
pi.setReportType(scheduler.getReportOutputType()); pi.setReportType(scheduler.getReportOutputType());
pi.setAD_Scheduler_ID(scheduler.getAD_Scheduler_ID());
int AD_PrintFormat_ID = scheduler.getAD_PrintFormat_ID(); int AD_PrintFormat_ID = scheduler.getAD_PrintFormat_ID();
if (AD_PrintFormat_ID > 0) if (AD_PrintFormat_ID > 0)
{ {
@ -333,7 +334,7 @@ public class Scheduler extends AdempiereServer
String mailContent = ""; String mailContent = "";
if (mailTemplate.is_new()){ if (mailTemplate.is_new()){
mailContent = scheduler.getDescription(); mailContent = scheduler.getDescription() != null ? scheduler.getDescription() : "";
}else{ }else{
mailTemplate.setUser(user); mailTemplate.setUser(user);
mailTemplate.setLanguage(Env.getContext(getCtx(), Env.LANGUAGE)); mailTemplate.setLanguage(Env.getContext(getCtx(), Env.LANGUAGE));
@ -358,7 +359,7 @@ public class Scheduler extends AdempiereServer
pLog.saveEx(); pLog.saveEx();
} }
} else { } else {
if (!client.sendEMail(from, user, schedulerName, mailContent + "\n" + pi.getSummary() + " " + pi.getLogInfo(), null)) { if (!client.sendEMail(from, user, schedulerName, mailContent + "\n" + pi.getSummary() + "\n" + pi.getLogInfo(), null)) {
StringBuilder summary = new StringBuilder(Msg.getMsg(Env.getCtx(), "SchedulerSendNotificationFailed")); StringBuilder summary = new StringBuilder(Msg.getMsg(Env.getCtx(), "SchedulerSendNotificationFailed"));
summary.append(user.getName()); summary.append(user.getName());
String error = (String) Env.getCtx().remove(EMail.EMAIL_SEND_MSG); String error = (String) Env.getCtx().remove(EMail.EMAIL_SEND_MSG);