From b06d550c7215a1fd8ea04fe6b1a271c0ed763374 Mon Sep 17 00:00:00 2001 From: Peter Rotich <peter@osticket.com> Date: Wed, 8 Jul 2015 14:05:19 +0000 Subject: [PATCH] Task email templates --- include/class.template.php | 25 ++++++++++++++++-- include/class.variable.php | 3 ++- .../templates/email/task.activity.alert.yaml | 26 ++----------------- .../templates/email/task.activity.notice.yaml | 9 +++---- .../en_US/templates/email/task.alert.yaml | 2 +- .../email/task.assignment.alert.yaml | 15 +---------- .../templates/email/task.overdue.alert.yaml | 6 ++--- 7 files changed, 34 insertions(+), 52 deletions(-) diff --git a/include/class.template.php b/include/class.template.php index f3a459f6d..bc998c851 100644 --- a/include/class.template.php +++ b/include/class.template.php @@ -136,32 +136,49 @@ class EmailTemplateGroup { 'group'=>'c.task', 'name'=>/* @trans */ 'New Task Alert', 'desc'=>/* @trans */ 'Alert sent to agents, if enabled, on new task.', + 'context' => array( + 'task', 'recipient', 'message', + ), ), 'task.activity.notice' => array( 'group'=>'c.task', 'name'=>/* @trans */ 'New Activity Notice', - 'desc'=>/* @trans */ 'Template used to notify collaborators on task activity.' + 'desc'=>/* @trans */ 'Template used to notify collaborators on task activity.', + 'context' => array( + 'task', 'signature', 'message', 'poster', 'recipient', + ), ), 'task.activity.alert'=>array( 'group'=>'c.task', 'name'=>/* @trans */ 'New Activity Alert', 'desc'=>/* @trans */ 'Alert sent to selected agents, if enabled, on new activity.', - + 'context' => array( + 'task', 'recipient', 'note', 'comments', 'activity', + ), ), 'task.assignment.alert' => array( 'group'=>'c.task', 'name'=>/* @trans */ 'Task Assignment Alert', 'desc'=>/* @trans */ 'Alert sent to agents on task assignment.', + 'context' => array( + 'task', 'recipient', 'comments', 'assignee', 'assigner', + ), ), 'task.transfer.alert'=>array( 'group'=>'c.task', 'name'=>/* @trans */ 'Task Transfer Alert', 'desc'=>/* @trans */ 'Alert sent to agents on task transfer.', + 'context' => array( + 'task', 'recipient', 'note', 'comments', 'activity', + ), ), 'task.overdue.alert'=>array( 'group'=>'c.task', 'name'=>/* @trans */ 'Overdue Task Alert', 'desc'=>/* @trans */ 'Alert sent to agents on stale or overdue task.', + 'context' => array( + 'task', 'recipient', 'comments', + ), ), ); @@ -337,6 +354,10 @@ class EmailTemplateGroup { return $this->getMsgTemplate('task.alert'); } + function getTaskActivityAlertMsgTemplate() { + return $this->getMsgTemplate('task.activity.alert'); + } + function getTaskActivityNoticeMsgTemplate() { return $this->getMsgTemplate('task.activity.notice'); } diff --git a/include/class.variable.php b/include/class.variable.php index 8c10fc61c..76acb1d0f 100644 --- a/include/class.variable.php +++ b/include/class.variable.php @@ -262,7 +262,7 @@ class VariableReplacer { return false; $contextTypes = array( - 'activity' => __('Type of recent activity'), + 'activity' => array('class' => 'ThreadActivity', 'desc' => __('Type of recent activity')), 'assignee' => array('class' => 'Staff', 'desc' => __('Assigned agent/team')), 'assigner' => array('class' => 'Staff', 'desc' => __('Agent performing the assignment')), 'comments' => __('Assign/transfer comments'), @@ -276,6 +276,7 @@ class VariableReplacer { 'signature' => 'Selected staff or department signature', 'staff' => array('class' => 'Staff', 'desc' => 'Agent originating the activity'), 'ticket' => array('class' => 'Ticket', 'desc' => 'The ticket'), + 'task' => array('class' => 'Task', 'desc' => 'The task'), 'user' => array('class' => 'User', 'desc' => __('Message recipient')), ); $context = array(); diff --git a/include/i18n/en_US/templates/email/task.activity.alert.yaml b/include/i18n/en_US/templates/email/task.activity.alert.yaml index 82e7c4ce0..5c94582ed 100644 --- a/include/i18n/en_US/templates/email/task.activity.alert.yaml +++ b/include/i18n/en_US/templates/email/task.activity.alert.yaml @@ -13,34 +13,12 @@ notes: | or visits the web portal and posts a new message there. subject: | - New Activity Alert + Task Activity [#%{task.number}] - %{activity.title} body: | <h3><strong>Hi %{recipient.name},</strong></h3> - New message appended to task <a - href="%{ticket.staff_link}">#%{task.number}</a> + Task <a href="%{task.staff_link}">#%{task.number}</a> updated: %{activity.description} <br> <br> - <table> - <tbody> - <tr> - <td> - <strong>Title</strong>: - </td> - <td> - %{task.title} - </td> - </tr> - <tr> - <td> - <strong>Department</strong>: - </td> - <td> - %{task.dept.name} - </td> - </tr> - </tbody> - </table> - <br> %{message} <br> <br> diff --git a/include/i18n/en_US/templates/email/task.activity.notice.yaml b/include/i18n/en_US/templates/email/task.activity.notice.yaml index 45d1e3e51..750e4a09c 100644 --- a/include/i18n/en_US/templates/email/task.activity.notice.yaml +++ b/include/i18n/en_US/templates/email/task.activity.notice.yaml @@ -5,7 +5,7 @@ # --- notes: | - Notice sent to collaborators on task activity e.g note or message. + Notice sent to collaborators on task activity e.g reply or message. subject: | Re: %{task.title} [#%{task.number}] @@ -20,9 +20,6 @@ body: | <br> <hr> <div style="color: rgb(127, 127, 127); font-size: small; text-align: center;"> - <em>You're getting this email because you are a collaborator - on task <a href="%{recipient.task_link}" style="color: rgb(84, 141, 212);" - >#%{task.number}</a>. To participate, simply reply to this email - or <a href="%{recipient.task_link}" style="color: rgb(84, 141, 212);" - >click here</a> for a complete archive of the task thread.</em> + <em>You're getting this email because you are a collaborator on task + #%{task.number}. To participate, simply reply to this email.</em> </div> diff --git a/include/i18n/en_US/templates/email/task.alert.yaml b/include/i18n/en_US/templates/email/task.alert.yaml index 08e311fe0..ee6760803 100644 --- a/include/i18n/en_US/templates/email/task.alert.yaml +++ b/include/i18n/en_US/templates/email/task.alert.yaml @@ -12,7 +12,7 @@ subject: | New Task Alert body: | <h2>Hi %{recipient.name},</h2> - New task #%{task.number} created + New task <a href="%{task.staff_link}">#%{task.number}</a> created <br> <br> <table> diff --git a/include/i18n/en_US/templates/email/task.assignment.alert.yaml b/include/i18n/en_US/templates/email/task.assignment.alert.yaml index 4c509b08b..2a8684c51 100644 --- a/include/i18n/en_US/templates/email/task.assignment.alert.yaml +++ b/include/i18n/en_US/templates/email/task.assignment.alert.yaml @@ -1,7 +1,7 @@ # # Email template: task.assignment.alert.yaml # -# Sent to agents when a ticket is assigned to them or the team to which +# Sent to agents when a task is assigned to them or the team to which # they belong. # Use %{assigner} to distinguish who made the assignment. # @@ -18,19 +18,6 @@ body: | assigned to you by %{assigner.name.short} <br> <br> - <table> - <tbody> - <tr> - <td> - <strong>Title</strong>: - </td> - <td> - %{task.title} - </td> - </tr> - </tbody> - </table> - <br> %{comments} <br> <br> diff --git a/include/i18n/en_US/templates/email/task.overdue.alert.yaml b/include/i18n/en_US/templates/email/task.overdue.alert.yaml index 0b48a7337..05a8573d3 100644 --- a/include/i18n/en_US/templates/email/task.overdue.alert.yaml +++ b/include/i18n/en_US/templates/email/task.overdue.alert.yaml @@ -2,14 +2,12 @@ # Email template: task.overdue.alert.yaml # # Sent to agents when a tasks transitions to overdue in the system. -# Overdue tasks occur based on set due-date as well as the SLA -# defined for the task. +# Overdue tasks occur based on set due-date. # --- notes: | Sent to agents when a task transitions to overdue in the system. - Overdue tasks occur based on the set due-date as well as the SLA - defined for the task. + Overdue tasks occur based on the set due-date. subject: | Stale Task Alert -- GitLab