From e61fc6ce850a28d02c0f55c5b387b37f9b6ebdcb Mon Sep 17 00:00:00 2001 From: Daniel Silva Date: Tue, 23 Jan 2018 10:01:28 -0600 Subject: [PATCH] #13390 cherry-pick the email fix (#13484) --- .../workflows/util/WorkflowEmailUtil.java | 8 +- .../workflow/workflow_email_template.vtl | 94 +++++++++++++++++++ 2 files changed, 98 insertions(+), 4 deletions(-) create mode 100644 dotCMS/src/main/webapp/WEB-INF/velocity/static/workflow/workflow_email_template.vtl diff --git a/dotCMS/src/main/java/com/dotmarketing/portlets/workflows/util/WorkflowEmailUtil.java b/dotCMS/src/main/java/com/dotmarketing/portlets/workflows/util/WorkflowEmailUtil.java index ce900c10a893..674f7bb5ec06 100644 --- a/dotCMS/src/main/java/com/dotmarketing/portlets/workflows/util/WorkflowEmailUtil.java +++ b/dotCMS/src/main/java/com/dotmarketing/portlets/workflows/util/WorkflowEmailUtil.java @@ -33,7 +33,7 @@ public class WorkflowEmailUtil { * This method will take an email address and a {@link WorkflowProcessor} * and send a generic workflow email to them. If subject is null, it will be * intelligently inferred, and if the email text is null, the system will - * try send the file: "static/workflow/workflow_email_template.html". + * try send the file: "static/workflow/workflow_email_template.vtl". * * Both the subject and the emailBody will be parsed by Velocity with an * $workflow object in their context This object is the @@ -108,7 +108,7 @@ public static void sendWorkflowEmail(WorkflowProcessor processor, String[] email if (!UtilMethods.isSet(emailText)) { - emailText = VelocityUtil.mergeTemplate("static/workflow/workflow_email_template.html", ctx); + emailText = VelocityUtil.mergeTemplate("static/workflow/workflow_email_template.vtl", ctx); isHTML = true; } else { emailText = VelocityUtil.eval(emailText, ctx); @@ -138,7 +138,7 @@ public static void sendWorkflowEmail(WorkflowProcessor processor, String[] email * to a group of people that belong to the next assign role. If subject is * null, it will be intelligently inferred, and if the email text is null, * the system will try send the file: - * "static/workflow/workflow_email_template.html". Both the subject and the + * "static/workflow/workflow_email_template.vtl". Both the subject and the * emailBody will be parsed by Velocity with an $workflow object in their * context This object is the {@link WorkflowProcessor} object that has * access to every aspect of the workflow task. @@ -186,7 +186,7 @@ public static void sendWorkflowMessageToNextAssign(WorkflowProcessor processor, } catch (Exception e) { - throw new DotWorkflowException("Exception ocurred trying to deliver emails for workflow " + e.getMessage()); + throw new DotWorkflowException("Exception ocurred trying to deliver emails for workflow " + e.getMessage(), e); } } diff --git a/dotCMS/src/main/webapp/WEB-INF/velocity/static/workflow/workflow_email_template.vtl b/dotCMS/src/main/webapp/WEB-INF/velocity/static/workflow/workflow_email_template.vtl new file mode 100644 index 000000000000..5287c138c67a --- /dev/null +++ b/dotCMS/src/main/webapp/WEB-INF/velocity/static/workflow/workflow_email_template.vtl @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + #if($stepId != $nextStepId) + + + + + #else + + + + + #end + + + + + + + #if($UtilMethods.isSet($workflowMessage)) + + + + + + + #end +
+ $languagewebapi.getFromUserLanguage("dotCMS-Workflow") + #if($nextStepResolved) + ($languagewebapi.getFromUserLanguage("Resolved")!) + #end +
+ $structureName: + + $!{workflowTaskTitle}
+
+ $languagewebapi.getFromUserLanguage("Updated-By"): + + $!{user.fullName} @ $!{UtilMethods.dateToHTMLDate($modDate, "MM/dd/yyyy hh:mm:ss a")} + +
+ $languagewebapi.getFromUserLanguage("Moved-from"): + + + $!{stepName} --> $!{nextStepName} + +
+ $languagewebapi.getFromUserLanguage("Current-Step"): + + $!{step} +
+ $languagewebapi.getFromUserLanguage("Assignee"): + + $!{nextAssign} +
+ $languagewebapi.getFromUserLanguage("Comment"): + + $workflowMessage +
+ + + + +