From 1daa1c70e266ec220191cf8294212b4e38505557 Mon Sep 17 00:00:00 2001 From: hengsin Date: Fri, 10 Feb 2023 21:13:40 +0800 Subject: [PATCH] IDEMPIERE-5572 Scheduler: Allow process to suppress auto sending of process execution result to scheduler recipients (#1668) --- .../src/org/compiere/process/ProcessInfo.java | 16 ++++++++++++++++ .../server/org/compiere/server/Scheduler.java | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/process/ProcessInfo.java b/org.adempiere.base/src/org/compiere/process/ProcessInfo.java index 4215f6cdab..68e9d410ec 100644 --- a/org.adempiere.base/src/org/compiere/process/ProcessInfo.java +++ b/org.adempiere.base/src/org/compiere/process/ProcessInfo.java @@ -171,6 +171,9 @@ public class ProcessInfo implements Serializable private int m_AD_Scheduler_ID = 0; + /** For scheduler: true to notify scheduler recipients with process execution result using AD_Scheduler.R_MailTexT_ID mail template (if define). Default is true. **/ + private boolean isNotifyRecipients = true; + public int getLanguageID() { return languageID; } @@ -994,4 +997,17 @@ public class ProcessInfo implements Serializable this.m_AD_Scheduler_ID = AD_Scheduler_ID; } + /** + * @return true if scheduler should notify scheduler recipients with process execution result + */ + public boolean isNotifyRecipients() { + return isNotifyRecipients; + } + + /** + * @param isNotifyRecipients if true, scheduler should notify scheduler recipients with process execution result + */ + public void setNotifyRecipients(boolean isNotifyRecipients) { + this.isNotifyRecipients = isNotifyRecipients; + } } // 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 338cc4a3af..d7f583ed61 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 @@ -269,9 +269,9 @@ public class Scheduler extends AdempiereServer } List sendErrors = new ArrayList<>(); - // always notify recipients + // notify recipients Integer[] userIDs = scheduler.getRecipientAD_User_IDs(true); - if (userIDs.length > 0) + if (userIDs.length > 0 && pi.isNotifyRecipients()) { ProcessInfoUtil.setLogFromDB(pi); List fileList = new ArrayList();