diff --git a/org.adempiere.base/src/org/compiere/process/ProcessInfo.java b/org.adempiere.base/src/org/compiere/process/ProcessInfo.java index 4b6cfc6e37..b2613607bb 100644 --- a/org.adempiere.base/src/org/compiere/process/ProcessInfo.java +++ b/org.adempiere.base/src/org/compiere/process/ProcessInfo.java @@ -167,6 +167,8 @@ public class ProcessInfo implements Serializable private int languageID = 0; + private int m_AD_Scheduler_ID = 0; + public int getLanguageID() { return languageID; } @@ -957,5 +959,21 @@ public class ProcessInfo implements Serializable public void setReplaceTabContent() { 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 diff --git a/org.adempiere.server/src/main/server/org/compiere/server/Scheduler.java b/org.adempiere.server/src/main/server/org/compiere/server/Scheduler.java index 47585c1980..05470c5335 100644 --- a/org.adempiere.server/src/main/server/org/compiere/server/Scheduler.java +++ b/org.adempiere.server/src/main/server/org/compiere/server/Scheduler.java @@ -205,6 +205,7 @@ public class Scheduler extends AdempiereServer pi.setIsBatch(true); pi.setPrintPreview(true); pi.setReportType(scheduler.getReportOutputType()); + pi.setAD_Scheduler_ID(scheduler.getAD_Scheduler_ID()); int AD_PrintFormat_ID = scheduler.getAD_PrintFormat_ID(); if (AD_PrintFormat_ID > 0) { @@ -333,7 +334,7 @@ public class Scheduler extends AdempiereServer String mailContent = ""; if (mailTemplate.is_new()){ - mailContent = scheduler.getDescription(); + mailContent = scheduler.getDescription() != null ? scheduler.getDescription() : ""; }else{ mailTemplate.setUser(user); mailTemplate.setLanguage(Env.getContext(getCtx(), Env.LANGUAGE)); @@ -358,7 +359,7 @@ public class Scheduler extends AdempiereServer pLog.saveEx(); } } 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")); summary.append(user.getName()); String error = (String) Env.getCtx().remove(EMail.EMAIL_SEND_MSG);