From 01693677f9e6ed03174fa52e7711a39d49bc4f3f Mon Sep 17 00:00:00 2001 From: kthiemann Date: Thu, 22 Feb 2007 12:03:10 +0000 Subject: [PATCH] patch [ 1666044 ] Workflow - Send Approval Notification As Notice Or Email https://sourceforge.net/tracker/index.php?func=detail&aid=1666044&group_id=176962&atid=879334 --- base/src/org/compiere/wf/MWFActivity.java | 34 +++++++++++++++-------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/base/src/org/compiere/wf/MWFActivity.java b/base/src/org/compiere/wf/MWFActivity.java index c2688c5baf..8163d943f0 100644 --- a/base/src/org/compiere/wf/MWFActivity.java +++ b/base/src/org/compiere/wf/MWFActivity.java @@ -1134,18 +1134,30 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable setTextMsg ("User Choice: " + e.toString()); log.log(Level.WARNING, "", e); } - // Send Approval Notification - if (newState.equals(StateEngine.STATE_Aborted)) - { - MClient client = MClient.get(getCtx(), doc.getAD_Client_ID()); - client.sendEMail(doc.getDoc_User_ID(), - doc.getDocumentInfo() + ": " + Msg.getMsg(getCtx(), "NotApproved"), - doc.getSummary() - + "\n" + doc.getProcessMsg() - + "\n" + getTextMsg(), - doc.createPDF()); + // Send Approval Notification + if (newState.equals(StateEngine.STATE_Aborted)) { + MUser to = new MUser(getCtx(), doc.getDoc_User_ID(), null); + String NotificationType = to.getNotificationType(); + + // send email + if (MUser.NOTIFICATIONTYPE_EMail.equals(NotificationType) + || MUser.NOTIFICATIONTYPE_EMailPlusNotice.equals(NotificationType)) { + MClient client = MClient.get(getCtx(), doc.getAD_Client_ID()); + client.sendEMail(doc.getDoc_User_ID(), Msg.getMsg(getCtx(), "NotApproved") + + ": " + doc.getDocumentNo(), doc.getSummary() + "\n" + + doc.getProcessMsg() + "\n" + getTextMsg(), null); + } + + // Send Note + if (MUser.NOTIFICATIONTYPE_Notice.equals(NotificationType) + || MUser.NOTIFICATIONTYPE_EMailPlusNotice.equals(NotificationType)) { + MNote note = new MNote(getCtx(), "NotApproved", doc.getDoc_User_ID(), null); + note.setTextMsg(doc.getSummary() + "\n" + doc.getProcessMsg() + "\n" + + getTextMsg()); + note.save(); + } } - } + } setWFState (newState); return ok; } // setUserChoice