From 6b981929dd882e63b29ef08cc05929dbd0bbb2c9 Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Tue, 18 Sep 2012 14:25:46 -0400
Subject: [PATCH] Add support for new variables to email templates + upgrade
 patch

---
 .../upgrader/sql/15b30765-7f35de42.patch.sql  | 409 ++++++++++++++++++
 main.inc.php                                  |   2 +-
 setup/inc/sql/osTicket-mysql.sql              |   4 +-
 setup/inc/sql/osTicket-mysql.sql.md5          |   2 +-
 4 files changed, 413 insertions(+), 4 deletions(-)
 create mode 100644 include/upgrader/sql/15b30765-7f35de42.patch.sql

diff --git a/include/upgrader/sql/15b30765-7f35de42.patch.sql b/include/upgrader/sql/15b30765-7f35de42.patch.sql
new file mode 100644
index 000000000..80eb122c1
--- /dev/null
+++ b/include/upgrader/sql/15b30765-7f35de42.patch.sql
@@ -0,0 +1,409 @@
+/*
+ * @version=1.6RC2+
+ * 
+ * change variable names
+ */
+
+-- Canned Responses (with variables)
+UPDATE `%TABLE_PREFIX%canned_response` SET `response` = REPLACE(`response`, '%id', '%{ticket.id}');
+UPDATE `%TABLE_PREFIX%canned_response` SET `response` = REPLACE(`response`, '%ticket', '%{ticket.number}');
+UPDATE `%TABLE_PREFIX%canned_response` SET `response` = REPLACE(`response`, '%name', '%{ticket.name}');
+UPDATE `%TABLE_PREFIX%canned_response` SET `response` = REPLACE(`response`, '%email', '%{ticket.email}');
+UPDATE `%TABLE_PREFIX%canned_response` SET `response` = REPLACE(`response`, '%subject', '%{ticket.subject}');
+
+UPDATE `%TABLE_PREFIX%canned_response` SET `response` = REPLACE(`response`, '%status', '%{ticket.status}');
+UPDATE `%TABLE_PREFIX%canned_response` SET `response` = REPLACE(`response`, '%priority', '%{ticket.priority}');
+
+UPDATE `%TABLE_PREFIX%canned_response` SET `response` = REPLACE(`response`, '%auth', '%{ticket.auth_token}');
+
+UPDATE `%TABLE_PREFIX%canned_response` SET `response` = REPLACE(`response`, '%phone', '%{ticket.phone_number}');
+UPDATE `%TABLE_PREFIX%canned_response` SET `response` = REPLACE(`response`, '%createdate', '%{ticket.create_date}');
+UPDATE `%TABLE_PREFIX%canned_response` SET `response` = REPLACE(`response`, '%duedate', '%{ticket.due_date}');
+UPDATE `%TABLE_PREFIX%canned_response` SET `response` = REPLACE(`response`, '%closedate', '%{ticket.close_date}');
+
+UPDATE `%TABLE_PREFIX%canned_response` SET `response` = REPLACE(`response`, '%topic', '%{ticket.topic.name}');
+UPDATE `%TABLE_PREFIX%canned_response` SET `response` = REPLACE(`response`, '%dept', '%{ticket.dept.name}');
+UPDATE `%TABLE_PREFIX%canned_response` SET `response` = REPLACE(`response`, '%team', '%{ticket.team.name}');
+
+-- %id
+UPDATE `%TABLE_PREFIX%email_template` 
+    SET `ticket_autoresp_body` = REPLACE(`ticket_autoresp_body`, '%id', '%{ticket.id}'),
+        `message_autoresp_body` = REPLACE(`message_autoresp_body`, '%id', '%{ticket.id}'),
+        `ticket_notice_body` = REPLACE(`ticket_notice_body`, '%id', '%{ticket.id}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%id', '%{ticket.id}'),
+        `ticket_reply_body` = REPLACE(`ticket_reply_body`, '%id', '%{ticket.id}'),
+        `ticket_alert_body` = REPLACE(`ticket_alert_body`, '%id', '%{ticket.id}'),
+        `message_alert_body` = REPLACE(`message_alert_body`, '%id', '%{ticket.id}'),
+        `note_alert_body` = REPLACE(`note_alert_body`, '%id', '%{ticket.id}'),
+        `assigned_alert_body` = REPLACE(`assigned_alert_body`, '%id', '%{ticket.id}'),
+        `transfer_alert_body` = REPLACE(`transfer_alert_body`, '%id', '%{ticket.id}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%id', '%{ticket.id}');
+
+-- %ticket
+UPDATE `%TABLE_PREFIX%email_template`
+    SET `ticket_autoresp_subj` = REPLACE(`ticket_autoresp_subj`, '%ticket', '%{ticket.number}'),
+        `ticket_autoresp_body` = REPLACE(`ticket_autoresp_body`, '%ticket', '%{ticket.number}'),
+        `message_autoresp_subj` = REPLACE(`message_autoresp_subj`, '%ticket', '%{ticket.number}'),
+        `message_autoresp_body` = REPLACE(`message_autoresp_body`, '%ticket', '%{ticket.number}'),
+        `ticket_notice_subj` = REPLACE(`ticket_notice_subj`, '%ticket', '%{ticket.number}'),
+        `ticket_notice_body` = REPLACE(`ticket_notice_body`, '%ticket', '%{ticket.number}'),
+        `ticket_overlimit_subj` = REPLACE(`ticket_overlimit_subj`, '%ticket', '%{ticket.number}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%ticket', '%{ticket.number}'),
+        `ticket_reply_subj` = REPLACE(`ticket_reply_subj`, '%ticket', '%{ticket.number}'),
+        `ticket_reply_body` = REPLACE(`ticket_reply_body`, '%ticket', '%{ticket.number}'),
+        `ticket_alert_subj` = REPLACE(`ticket_alert_subj`, '%ticket', '%{ticket.number}'),
+        `ticket_alert_body` = REPLACE(`ticket_alert_body`, '%ticket', '%{ticket.number}'),
+        `message_alert_subj` = REPLACE(`message_alert_subj`, '%ticket', '%{ticket.number}'),
+        `message_alert_body` = REPLACE(`message_alert_body`, '%ticket', '%{ticket.number}'),
+        `note_alert_subj` = REPLACE(`note_alert_subj`, '%ticket', '%{ticket.number}'),
+        `note_alert_body` = REPLACE(`note_alert_body`, '%ticket', '%{ticket.number}'),
+        `assigned_alert_subj` = REPLACE(`assigned_alert_subj`, '%ticket', '%{ticket.number}'),
+        `assigned_alert_body` = REPLACE(`assigned_alert_body`, '%ticket', '%{ticket.number}'),
+        `transfer_alert_subj` = REPLACE(`transfer_alert_subj`, '%ticket', '%{ticket.number}'),
+        `transfer_alert_body` = REPLACE(`transfer_alert_body`, '%ticket', '%{ticket.number}'),
+        `ticket_overlimit_subj` = REPLACE(`ticket_overlimit_subj`, '%ticket', '%{ticket.number}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%ticket', '%{ticket.number}');
+
+-- %subject
+UPDATE `%TABLE_PREFIX%email_template`
+    SET `ticket_autoresp_subj` = REPLACE(`ticket_autoresp_subj`, '%subject', '%{ticket.subject}'),
+        `ticket_autoresp_body` = REPLACE(`ticket_autoresp_body`, '%subject', '%{ticket.subject}'),
+        `message_autoresp_subj` = REPLACE(`message_autoresp_subj`, '%subject', '%{ticket.subject}'),
+        `message_autoresp_body` = REPLACE(`message_autoresp_body`, '%subject', '%{ticket.subject}'),
+        `ticket_notice_subj` = REPLACE(`ticket_notice_subj`, '%subject', '%{ticket.subject}'),
+        `ticket_notice_body` = REPLACE(`ticket_notice_body`, '%subject', '%{ticket.subject}'),
+        `ticket_overlimit_subj` = REPLACE(`ticket_overlimit_subj`, '%subject', '%{ticket.subject}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%subject', '%{ticket.subject}'),
+        `ticket_reply_subj` = REPLACE(`ticket_reply_subj`, '%subject', '%{ticket.subject}'),
+        `ticket_reply_body` = REPLACE(`ticket_reply_body`, '%subject', '%{ticket.subject}'),
+        `ticket_alert_subj` = REPLACE(`ticket_alert_subj`, '%subject', '%{ticket.subject}'),
+        `ticket_alert_body` = REPLACE(`ticket_alert_body`, '%subject', '%{ticket.subject}'),
+        `message_alert_subj` = REPLACE(`message_alert_subj`, '%subject', '%{ticket.subject}'),
+        `message_alert_body` = REPLACE(`message_alert_body`, '%subject', '%{ticket.subject}'),
+        `note_alert_subj` = REPLACE(`note_alert_subj`, '%subject', '%{ticket.subject}'),
+        `note_alert_body` = REPLACE(`note_alert_body`, '%subject', '%{ticket.subject}'),
+        `assigned_alert_subj` = REPLACE(`assigned_alert_subj`, '%subject', '%{ticket.subject}'),
+        `assigned_alert_body` = REPLACE(`assigned_alert_body`, '%subject', '%{ticket.subject}'),
+        `transfer_alert_subj` = REPLACE(`transfer_alert_subj`, '%subject', '%{ticket.subject}'),
+        `transfer_alert_body` = REPLACE(`transfer_alert_body`, '%subject', '%{ticket.subject}'),
+        `ticket_overlimit_subj` = REPLACE(`ticket_overlimit_subj`, '%subject', '%{ticket.subject}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%subject', '%{ticket.subject}');
+
+-- %name
+UPDATE `%TABLE_PREFIX%email_template`
+    SET `ticket_autoresp_subj` = REPLACE(`ticket_autoresp_subj`, '%name', '%{ticket.name}'),
+        `ticket_autoresp_body` = REPLACE(`ticket_autoresp_body`, '%name', '%{ticket.name}'),
+        `message_autoresp_subj` = REPLACE(`message_autoresp_subj`, '%name', '%{ticket.name}'),
+        `message_autoresp_body` = REPLACE(`message_autoresp_body`, '%name', '%{ticket.name}'),
+        `ticket_notice_subj` = REPLACE(`ticket_notice_subj`, '%name', '%{ticket.name}'),
+        `ticket_notice_body` = REPLACE(`ticket_notice_body`, '%name', '%{ticket.name}'),
+        `ticket_overlimit_subj` = REPLACE(`ticket_overlimit_subj`, '%name', '%{ticket.name}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%name', '%{ticket.name}'),
+        `ticket_reply_subj` = REPLACE(`ticket_reply_subj`, '%name', '%{ticket.name}'),
+        `ticket_reply_body` = REPLACE(`ticket_reply_body`, '%name', '%{ticket.name}'),
+        `ticket_alert_subj` = REPLACE(`ticket_alert_subj`, '%name', '%{ticket.name}'),
+        `ticket_alert_body` = REPLACE(`ticket_alert_body`, '%name', '%{ticket.name}'),
+        `message_alert_subj` = REPLACE(`message_alert_subj`, '%name', '%{ticket.name}'),
+        `message_alert_body` = REPLACE(`message_alert_body`, '%name', '%{ticket.name}'),
+        `note_alert_subj` = REPLACE(`note_alert_subj`, '%name', '%{ticket.name}'),
+        `note_alert_body` = REPLACE(`note_alert_body`, '%name', '%{ticket.name}'),
+        `assigned_alert_subj` = REPLACE(`assigned_alert_subj`, '%name', '%{ticket.name}'),
+        `assigned_alert_body` = REPLACE(`assigned_alert_body`, '%name', '%{ticket.name}'),
+        `transfer_alert_subj` = REPLACE(`transfer_alert_subj`, '%name', '%{ticket.name}'),
+        `transfer_alert_body` = REPLACE(`transfer_alert_body`, '%name', '%{ticket.name}'),
+        `ticket_overlimit_subj` = REPLACE(`ticket_overlimit_subj`, '%name', '%{ticket.name}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%name', '%{ticket.name}');
+
+-- %email
+UPDATE `%TABLE_PREFIX%email_template`
+    SET `ticket_autoresp_subj` = REPLACE(`ticket_autoresp_subj`, '%email', '%{ticket.email}'),
+        `ticket_autoresp_body` = REPLACE(`ticket_autoresp_body`, '%email', '%{ticket.email}'),
+        `message_autoresp_subj` = REPLACE(`message_autoresp_subj`, '%email', '%{ticket.email}'),
+        `message_autoresp_body` = REPLACE(`message_autoresp_body`, '%email', '%{ticket.email}'),
+        `ticket_notice_subj` = REPLACE(`ticket_notice_subj`, '%email', '%{ticket.email}'),
+        `ticket_notice_body` = REPLACE(`ticket_notice_body`, '%email', '%{ticket.email}'),
+        `ticket_overlimit_subj` = REPLACE(`ticket_overlimit_subj`, '%email', '%{ticket.email}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%email', '%{ticket.email}'),
+        `ticket_reply_subj` = REPLACE(`ticket_reply_subj`, '%email', '%{ticket.email}'),
+        `ticket_reply_body` = REPLACE(`ticket_reply_body`, '%email', '%{ticket.email}'),
+        `ticket_alert_subj` = REPLACE(`ticket_alert_subj`, '%email', '%{ticket.email}'),
+        `ticket_alert_body` = REPLACE(`ticket_alert_body`, '%email', '%{ticket.email}'),
+        `message_alert_subj` = REPLACE(`message_alert_subj`, '%email', '%{ticket.email}'),
+        `message_alert_body` = REPLACE(`message_alert_body`, '%email', '%{ticket.email}'),
+        `note_alert_subj` = REPLACE(`note_alert_subj`, '%email', '%{ticket.email}'),
+        `note_alert_body` = REPLACE(`note_alert_body`, '%email', '%{ticket.email}'),
+        `assigned_alert_subj` = REPLACE(`assigned_alert_subj`, '%email', '%{ticket.email}'),
+        `assigned_alert_body` = REPLACE(`assigned_alert_body`, '%email', '%{ticket.email}'),
+        `transfer_alert_subj` = REPLACE(`transfer_alert_subj`, '%email', '%{ticket.email}'),
+        `transfer_alert_body` = REPLACE(`transfer_alert_body`, '%email', '%{ticket.email}'),
+        `ticket_overlimit_subj` = REPLACE(`ticket_overlimit_subj`, '%email', '%{ticket.email}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%email', '%{ticket.email}');
+
+-- %status
+UPDATE `%TABLE_PREFIX%email_template`
+    SET `ticket_autoresp_subj` = REPLACE(`ticket_autoresp_subj`, '%status', '%{ticket.status}'),
+        `ticket_autoresp_body` = REPLACE(`ticket_autoresp_body`, '%status', '%{ticket.status}'),
+        `message_autoresp_subj` = REPLACE(`message_autoresp_subj`, '%status', '%{ticket.status}'),
+        `message_autoresp_body` = REPLACE(`message_autoresp_body`, '%status', '%{ticket.status}'),
+        `ticket_notice_subj` = REPLACE(`ticket_notice_subj`, '%status', '%{ticket.status}'),
+        `ticket_notice_body` = REPLACE(`ticket_notice_body`, '%status', '%{ticket.status}'),
+        `ticket_overlimit_subj` = REPLACE(`ticket_overlimit_subj`, '%status', '%{ticket.status}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%status', '%{ticket.status}'),
+        `ticket_reply_subj` = REPLACE(`ticket_reply_subj`, '%status', '%{ticket.status}'),
+        `ticket_reply_body` = REPLACE(`ticket_reply_body`, '%status', '%{ticket.status}'),
+        `ticket_alert_subj` = REPLACE(`ticket_alert_subj`, '%status', '%{ticket.status}'),
+        `ticket_alert_body` = REPLACE(`ticket_alert_body`, '%status', '%{ticket.status}'),
+        `message_alert_subj` = REPLACE(`message_alert_subj`, '%status', '%{ticket.status}'),
+        `message_alert_body` = REPLACE(`message_alert_body`, '%status', '%{ticket.status}'),
+        `note_alert_subj` = REPLACE(`note_alert_subj`, '%status', '%{ticket.status}'),
+        `note_alert_body` = REPLACE(`note_alert_body`, '%status', '%{ticket.status}'),
+        `assigned_alert_subj` = REPLACE(`assigned_alert_subj`, '%status', '%{ticket.status}'),
+        `assigned_alert_body` = REPLACE(`assigned_alert_body`, '%status', '%{ticket.status}'),
+        `transfer_alert_subj` = REPLACE(`transfer_alert_subj`, '%status', '%{ticket.status}'),
+        `transfer_alert_body` = REPLACE(`transfer_alert_body`, '%status', '%{ticket.status}'),
+        `ticket_overlimit_subj` = REPLACE(`ticket_overlimit_subj`, '%status', '%{ticket.status}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%status', '%{ticket.status}');
+
+-- %priority
+UPDATE `%TABLE_PREFIX%email_template`
+    SET `ticket_autoresp_subj` = REPLACE(`ticket_autoresp_subj`, '%priority', '%{ticket.priority}'),
+        `ticket_autoresp_body` = REPLACE(`ticket_autoresp_body`, '%priority', '%{ticket.priority}'),
+        `message_autoresp_subj` = REPLACE(`message_autoresp_subj`, '%priority', '%{ticket.priority}'),
+        `message_autoresp_body` = REPLACE(`message_autoresp_body`, '%priority', '%{ticket.priority}'),
+        `ticket_notice_subj` = REPLACE(`ticket_notice_subj`, '%priority', '%{ticket.priority}'),
+        `ticket_notice_body` = REPLACE(`ticket_notice_body`, '%priority', '%{ticket.priority}'),
+        `ticket_overlimit_subj` = REPLACE(`ticket_overlimit_subj`, '%priority', '%{ticket.priority}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%priority', '%{ticket.priority}'),
+        `ticket_reply_subj` = REPLACE(`ticket_reply_subj`, '%priority', '%{ticket.priority}'),
+        `ticket_reply_body` = REPLACE(`ticket_reply_body`, '%priority', '%{ticket.priority}'),
+        `ticket_alert_subj` = REPLACE(`ticket_alert_subj`, '%priority', '%{ticket.priority}'),
+        `ticket_alert_body` = REPLACE(`ticket_alert_body`, '%priority', '%{ticket.priority}'),
+        `message_alert_subj` = REPLACE(`message_alert_subj`, '%priority', '%{ticket.priority}'),
+        `message_alert_body` = REPLACE(`message_alert_body`, '%priority', '%{ticket.priority}'),
+        `note_alert_subj` = REPLACE(`note_alert_subj`, '%priority', '%{ticket.priority}'),
+        `note_alert_body` = REPLACE(`note_alert_body`, '%priority', '%{ticket.priority}'),
+        `assigned_alert_subj` = REPLACE(`assigned_alert_subj`, '%priority', '%{ticket.priority}'),
+        `assigned_alert_body` = REPLACE(`assigned_alert_body`, '%priority', '%{ticket.priority}'),
+        `transfer_alert_subj` = REPLACE(`transfer_alert_subj`, '%priority', '%{ticket.priority}'),
+        `transfer_alert_body` = REPLACE(`transfer_alert_body`, '%priority', '%{ticket.priority}'),
+        `ticket_overlimit_subj` = REPLACE(`ticket_overlimit_subj`, '%priority', '%{ticket.priority}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%priority', '%{ticket.priority}');
+
+-- %auth
+UPDATE `%TABLE_PREFIX%email_template`
+    SET `ticket_autoresp_body` = REPLACE(`ticket_autoresp_body`, '%auth', '%{ticket.auth_code}'),
+        `message_autoresp_body` = REPLACE(`message_autoresp_body`, '%auth', '%{ticket.auth_code}'),
+        `ticket_notice_body` = REPLACE(`ticket_notice_body`, '%auth', '%{ticket.auth_code}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%auth', '%{ticket.auth_code}'),
+        `ticket_reply_body` = REPLACE(`ticket_reply_body`, '%auth', '%{ticket.auth_code}'),
+        `ticket_alert_body` = REPLACE(`ticket_alert_body`, '%auth', '%{ticket.auth_code}'),
+        `message_alert_body` = REPLACE(`message_alert_body`, '%auth', '%{ticket.auth_code}'),
+        `note_alert_body` = REPLACE(`note_alert_body`, '%auth', '%{ticket.auth_code}'),
+        `assigned_alert_body` = REPLACE(`assigned_alert_body`, '%auth', '%{ticket.auth_code}'),
+        `transfer_alert_body` = REPLACE(`transfer_alert_body`, '%auth', '%{ticket.auth_code}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%auth', '%{ticket.auth_code}');
+
+-- %phone
+UPDATE `%TABLE_PREFIX%email_template`
+    SET `ticket_autoresp_body` = REPLACE(`ticket_autoresp_body`, '%phone', '%{ticket.phone_number}'),
+        `message_autoresp_body` = REPLACE(`message_autoresp_body`, '%phone', '%{ticket.phone_number}'),
+        `ticket_notice_body` = REPLACE(`ticket_notice_body`, '%phone', '%{ticket.phone_number}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%phone', '%{ticket.phone_number}'),
+        `ticket_reply_body` = REPLACE(`ticket_reply_body`, '%phone', '%{ticket.phone_number}'),
+        `ticket_alert_body` = REPLACE(`ticket_alert_body`, '%phone', '%{ticket.phone_number}'),
+        `message_alert_body` = REPLACE(`message_alert_body`, '%phone', '%{ticket.phone_number}'),
+        `note_alert_body` = REPLACE(`note_alert_body`, '%phone', '%{ticket.phone_number}'),
+        `assigned_alert_body` = REPLACE(`assigned_alert_body`, '%phone', '%{ticket.phone_number}'),
+        `transfer_alert_body` = REPLACE(`transfer_alert_body`, '%phone', '%{ticket.phone_number}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%phone', '%{ticket.phone_number}');
+
+-- %createdate
+UPDATE `%TABLE_PREFIX%email_template`
+    SET `ticket_autoresp_body` = REPLACE(`ticket_autoresp_body`, '%createdate', '%{ticket.create_date}'),
+        `message_autoresp_body` = REPLACE(`message_autoresp_body`, '%createdate', '%{ticket.create_date}'),
+        `ticket_notice_body` = REPLACE(`ticket_notice_body`, '%createdate', '%{ticket.create_date}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%createdate', '%{ticket.create_date}'),
+        `ticket_reply_body` = REPLACE(`ticket_reply_body`, '%createdate', '%{ticket.create_date}'),
+        `ticket_alert_body` = REPLACE(`ticket_alert_body`, '%createdate', '%{ticket.create_date}'),
+        `message_alert_body` = REPLACE(`message_alert_body`, '%createdate', '%{ticket.create_date}'),
+        `note_alert_body` = REPLACE(`note_alert_body`, '%createdate', '%{ticket.create_date}'),
+        `assigned_alert_body` = REPLACE(`assigned_alert_body`, '%createdate', '%{ticket.create_date}'),
+        `transfer_alert_body` = REPLACE(`transfer_alert_body`, '%createdate', '%{ticket.create_date}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%createdate', '%{ticket.create_date}');
+
+-- %duedate
+UPDATE `%TABLE_PREFIX%email_template`
+    SET `ticket_autoresp_body` = REPLACE(`ticket_autoresp_body`, '%duedate', '%{ticket.due_date}'),
+        `message_autoresp_body` = REPLACE(`message_autoresp_body`, '%duedate', '%{ticket.due_date}'),
+        `ticket_notice_body` = REPLACE(`ticket_notice_body`, '%duedate', '%{ticket.due_date}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%duedate', '%{ticket.due_date}'),
+        `ticket_reply_body` = REPLACE(`ticket_reply_body`, '%duedate', '%{ticket.due_date}'),
+        `ticket_alert_body` = REPLACE(`ticket_alert_body`, '%duedate', '%{ticket.due_date}'),
+        `message_alert_body` = REPLACE(`message_alert_body`, '%duedate', '%{ticket.due_date}'),
+        `note_alert_body` = REPLACE(`note_alert_body`, '%duedate', '%{ticket.due_date}'),
+        `assigned_alert_body` = REPLACE(`assigned_alert_body`, '%duedate', '%{ticket.due_date}'),
+        `transfer_alert_body` = REPLACE(`transfer_alert_body`, '%duedate', '%{ticket.due_date}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%duedate', '%{ticket.due_date}');
+
+-- %closedate
+UPDATE `%TABLE_PREFIX%email_template`
+    SET `ticket_autoresp_body` = REPLACE(`ticket_autoresp_body`, '%closedate', '%{ticket.close_date}'),
+        `message_autoresp_body` = REPLACE(`message_autoresp_body`, '%closedate', '%{ticket.close_date}'),
+        `ticket_notice_body` = REPLACE(`ticket_notice_body`, '%closedate', '%{ticket.close_date}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%closedate', '%{ticket.close_date}'),
+        `ticket_reply_body` = REPLACE(`ticket_reply_body`, '%closedate', '%{ticket.close_date}'),
+        `ticket_alert_body` = REPLACE(`ticket_alert_body`, '%closedate', '%{ticket.close_date}'),
+        `message_alert_body` = REPLACE(`message_alert_body`, '%closedate', '%{ticket.close_date}'),
+        `note_alert_body` = REPLACE(`note_alert_body`, '%closedate', '%{ticket.close_date}'),
+        `assigned_alert_body` = REPLACE(`assigned_alert_body`, '%closedate', '%{ticket.close_date}'),
+        `transfer_alert_body` = REPLACE(`transfer_alert_body`, '%closedate', '%{ticket.close_date}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%closedate', '%{ticket.close_date}');
+
+-- %topic
+UPDATE `%TABLE_PREFIX%email_template`
+    SET `ticket_autoresp_body` = REPLACE(`ticket_autoresp_body`, '%topic', '%{ticket.topic.name}'),
+        `message_autoresp_body` = REPLACE(`message_autoresp_body`, '%topic', '%{ticket.topic.name}'),
+        `ticket_notice_body` = REPLACE(`ticket_notice_body`, '%topic', '%{ticket.topic.name}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%topic', '%{ticket.topic.name}'),
+        `ticket_reply_body` = REPLACE(`ticket_reply_body`, '%topic', '%{ticket.topic.name}'),
+        `ticket_alert_body` = REPLACE(`ticket_alert_body`, '%topic', '%{ticket.topic.name}'),
+        `message_alert_body` = REPLACE(`message_alert_body`, '%topic', '%{ticket.topic.name}'),
+        `note_alert_body` = REPLACE(`note_alert_body`, '%topic', '%{ticket.topic.name}'),
+        `assigned_alert_body` = REPLACE(`assigned_alert_body`, '%topic', '%{ticket.topic.name}'),
+        `transfer_alert_body` = REPLACE(`transfer_alert_body`, '%topic', '%{ticket.topic.name}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%topic', '%{ticket.topic.name}');
+
+-- %dept
+UPDATE `%TABLE_PREFIX%email_template`
+    SET `ticket_autoresp_body` = REPLACE(`ticket_autoresp_body`, '%dept', '%{ticket.dept.name}'),
+        `message_autoresp_body` = REPLACE(`message_autoresp_body`, '%dept', '%{ticket.dept.name}'),
+        `ticket_notice_body` = REPLACE(`ticket_notice_body`, '%dept', '%{ticket.dept.name}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%dept', '%{ticket.dept.name}'),
+        `ticket_reply_body` = REPLACE(`ticket_reply_body`, '%dept', '%{ticket.dept.name}'),
+        `ticket_alert_body` = REPLACE(`ticket_alert_body`, '%dept', '%{ticket.dept.name}'),
+        `message_alert_body` = REPLACE(`message_alert_body`, '%dept', '%{ticket.dept.name}'),
+        `note_alert_body` = REPLACE(`note_alert_body`, '%dept', '%{ticket.dept.name}'),
+        `assigned_alert_body` = REPLACE(`assigned_alert_body`, '%dept', '%{ticket.dept.name}'),
+        `transfer_alert_body` = REPLACE(`transfer_alert_body`, '%dept', '%{ticket.dept.name}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%dept', '%{ticket.dept.name}');
+
+-- %team
+UPDATE `%TABLE_PREFIX%email_template`
+    SET `ticket_autoresp_body` = REPLACE(`ticket_autoresp_body`, '%team', '%{ticket.team.name}'),
+        `message_autoresp_body` = REPLACE(`message_autoresp_body`, '%team', '%{ticket.team.name}'),
+        `ticket_notice_body` = REPLACE(`ticket_notice_body`, '%team', '%{ticket.team.name}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%team', '%{ticket.team.name}'),
+        `ticket_reply_body` = REPLACE(`ticket_reply_body`, '%team', '%{ticket.team.name}'),
+        `ticket_alert_body` = REPLACE(`ticket_alert_body`, '%team', '%{ticket.team.name}'),
+        `message_alert_body` = REPLACE(`message_alert_body`, '%team', '%{ticket.team.name}'),
+        `note_alert_body` = REPLACE(`note_alert_body`, '%team', '%{ticket.team.name}'),
+        `assigned_alert_body` = REPLACE(`assigned_alert_body`, '%team', '%{ticket.team.name}'),
+        `transfer_alert_body` = REPLACE(`transfer_alert_body`, '%team', '%{ticket.team.name}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%team', '%{ticket.team.name}');
+
+-- %clientlink
+UPDATE `%TABLE_PREFIX%email_template`
+    SET `ticket_autoresp_body` = REPLACE(`ticket_autoresp_body`, '%clientlink', '%{ticket.client_link}'),
+        `message_autoresp_body` = REPLACE(`message_autoresp_body`, '%clientlink', '%{ticket.client_link}'),
+        `ticket_notice_body` = REPLACE(`ticket_notice_body`, '%clientlink', '%{ticket.client_link}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%clientlink', '%{ticket.client_link}'),
+        `ticket_reply_body` = REPLACE(`ticket_reply_body`, '%clientlink', '%{ticket.client_link}'),
+        `ticket_alert_body` = REPLACE(`ticket_alert_body`, '%clientlink', '%{ticket.client_link}'),
+        `message_alert_body` = REPLACE(`message_alert_body`, '%clientlink', '%{ticket.client_link}'),
+        `note_alert_body` = REPLACE(`note_alert_body`, '%clientlink', '%{ticket.client_link}'),
+        `assigned_alert_body` = REPLACE(`assigned_alert_body`, '%clientlink', '%{ticket.client_link}'),
+        `transfer_alert_body` = REPLACE(`transfer_alert_body`, '%clientlink', '%{ticket.client_link}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%clientlink', '%{ticket.client_link}');
+
+-- %staff (recipient of the alert)
+UPDATE `%TABLE_PREFIX%email_template`
+    SET `ticket_alert_body` = REPLACE(`ticket_alert_body`, '%staff', '%{recipient}'),
+        `message_alert_body` = REPLACE(`message_alert_body`, '%staff', '%{recipient}'),
+        `note_alert_body` = REPLACE(`note_alert_body`, '%staff', '%{recipient}'),
+        `assigned_alert_body` = REPLACE(`assigned_alert_body`, '%staff', '%{recipient}'),
+        `transfer_alert_body` = REPLACE(`transfer_alert_body`, '%staff', '%{recipient}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%staff', '%{recipient}');
+
+-- %message 
+UPDATE `%TABLE_PREFIX%email_template`
+    SET `ticket_autoresp_body` = REPLACE(`ticket_autoresp_body`, '%message', '%{message}'),
+        `message_autoresp_body` = REPLACE(`message_autoresp_body`, '%message', '%{message}'),
+        `ticket_notice_body` = REPLACE(`ticket_notice_body`, '%message', '%{message}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%message', '%{message}'),
+        `ticket_reply_body` = REPLACE(`ticket_reply_body`, '%message', '%{message}'),
+        `ticket_alert_body` = REPLACE(`ticket_alert_body`, '%message', '%{message}'),
+        `message_alert_body` = REPLACE(`message_alert_body`, '%message', '%{message}'),
+        `note_alert_body` = REPLACE(`note_alert_body`, '%message', '%{message}'),
+        `assigned_alert_body` = REPLACE(`assigned_alert_body`, '%message', '%{message}'),
+        `transfer_alert_body` = REPLACE(`transfer_alert_body`, '%message', '%{message}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%message', '%{message}');
+
+-- %response
+UPDATE `%TABLE_PREFIX%email_template`
+    SET `ticket_autoresp_body` = REPLACE(`ticket_autoresp_body`, '%response', '%{response}'),
+        `message_autoresp_body` = REPLACE(`message_autoresp_body`, '%response', '%{response}'),
+        `ticket_notice_body` = REPLACE(`ticket_notice_body`, '%response', '%{response}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%response', '%{response}'),
+        `ticket_reply_body` = REPLACE(`ticket_reply_body`, '%response', '%{response}'),
+        `ticket_alert_body` = REPLACE(`ticket_alert_body`, '%response', '%{response}'),
+        `message_alert_body` = REPLACE(`message_alert_body`, '%response', '%{response}'),
+        `note_alert_body` = REPLACE(`note_alert_body`, '%response', '%{response}'),
+        `assigned_alert_body` = REPLACE(`assigned_alert_body`, '%response', '%{response}'),
+        `transfer_alert_body` = REPLACE(`transfer_alert_body`, '%response', '%{response}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%response', '%{response}');
+
+-- %note 
+UPDATE `%TABLE_PREFIX%email_template`
+    SET `ticket_autoresp_body` = REPLACE(`ticket_autoresp_body`, '%note', '%{note}'),
+        `message_autoresp_body` = REPLACE(`message_autoresp_body`, '%note', '%{note}'),
+        `ticket_notice_body` = REPLACE(`ticket_notice_body`, '%note', '%{note}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%note', '%{note}'),
+        `ticket_reply_body` = REPLACE(`ticket_reply_body`, '%note', '%{note}'),
+        `ticket_alert_body` = REPLACE(`ticket_alert_body`, '%note', '%{note}'),
+        `message_alert_body` = REPLACE(`message_alert_body`, '%note', '%{note}'),
+        `note_alert_body` = REPLACE(`note_alert_body`, '%note', '%{note}'),
+        `assigned_alert_body` = REPLACE(`assigned_alert_body`, '%note', '%{note}'),
+        `transfer_alert_body` = REPLACE(`transfer_alert_body`, '%note', '%{note}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%note', '%{note}');
+
+-- %url
+UPDATE `%TABLE_PREFIX%email_template`
+    SET `ticket_autoresp_body` = REPLACE(`ticket_autoresp_body`, '%url', '%{url}'),
+        `message_autoresp_body` = REPLACE(`message_autoresp_body`, '%url', '%{url}'),
+        `ticket_notice_body` = REPLACE(`ticket_notice_body`, '%url', '%{url}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%url', '%{url}'),
+        `ticket_reply_body` = REPLACE(`ticket_reply_body`, '%url', '%{url}'),
+        `ticket_alert_body` = REPLACE(`ticket_alert_body`, '%url', '%{url}'),
+        `message_alert_body` = REPLACE(`message_alert_body`, '%url', '%{url}'),
+        `note_alert_body` = REPLACE(`note_alert_body`, '%url', '%{url}'),
+        `assigned_alert_body` = REPLACE(`assigned_alert_body`, '%url', '%{url}'),
+        `transfer_alert_body` = REPLACE(`transfer_alert_body`, '%url', '%{url}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%url', '%{url}');
+
+-- %signature
+UPDATE `%TABLE_PREFIX%email_template`
+    SET `ticket_autoresp_body` = REPLACE(`ticket_autoresp_body`, '%signature', '%{signature}'),
+        `message_autoresp_body` = REPLACE(`message_autoresp_body`, '%signature', '%{signature}'),
+        `ticket_notice_body` = REPLACE(`ticket_notice_body`, '%signature', '%{signature}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%signature', '%{signature}'),
+        `ticket_reply_body` = REPLACE(`ticket_reply_body`, '%signature', '%{signature}'),
+        `ticket_alert_body` = REPLACE(`ticket_alert_body`, '%signature', '%{signature}'),
+        `message_alert_body` = REPLACE(`message_alert_body`, '%signature', '%{signature}'),
+        `note_alert_body` = REPLACE(`note_alert_body`, '%signature', '%{signature}'),
+        `assigned_alert_body` = REPLACE(`assigned_alert_body`, '%signature', '%{signature}'),
+        `transfer_alert_body` = REPLACE(`transfer_alert_body`, '%signature', '%{signature}'),
+        `ticket_overlimit_body` = REPLACE(`ticket_overlimit_body`, '%signature', '%{signature}');
+
+-- %assignee
+UPDATE `%TABLE_PREFIX%email_template`
+    SET `assigned_alert_subj` = REPLACE(`assigned_alert_subj`, '%assignee', '%{assignee}'),
+        `assigned_alert_body` = REPLACE(`assigned_alert_body`, '%assignee', '%{assignee}');
+
+-- %assigner
+UPDATE `%TABLE_PREFIX%email_template`
+    SET `assigned_alert_subj` = REPLACE(`assigned_alert_subj`, '%assigner', '%{assigner}'),
+        `assigned_alert_body` = REPLACE(`assigned_alert_body`, '%assigner', '%{assigner}');
+
+ -- update schema signature
+UPDATE `%TABLE_PREFIX%config`
+    SET `schema_signature`='7f35de4260e7a1d8bc2d4214786972ea';
diff --git a/main.inc.php b/main.inc.php
index 8ce394669..8e0008e05 100644
--- a/main.inc.php
+++ b/main.inc.php
@@ -63,7 +63,7 @@
 
     #Current version && schema signature (Changes from version to version)
     define('THIS_VERSION','1.7-RC2+'); //Shown on admin panel
-    define('SCHEMA_SIGNATURE','15b3076533123ff617801d89861136c8'); //MD5 signature of the db schema. (used to trigger upgrades)
+    define('SCHEMA_SIGNATURE', '7f35de4260e7a1d8bc2d4214786972ea'); //MD5 signature of the db schema. (used to trigger upgrades)
     #load config info
     $configfile='';
     if(file_exists(ROOT_DIR.'ostconfig.php')) //Old installs prior to v 1.6 RC5
diff --git a/setup/inc/sql/osTicket-mysql.sql b/setup/inc/sql/osTicket-mysql.sql
index 6ac95bb52..9cb2b0045 100644
--- a/setup/inc/sql/osTicket-mysql.sql
+++ b/setup/inc/sql/osTicket-mysql.sql
@@ -318,7 +318,7 @@ CREATE TABLE `%TABLE_PREFIX%email_template` (
 
 -- TODO: Dump revised copy before release!!!
 INSERT INTO `%TABLE_PREFIX%email_template` (`tpl_id`, `cfg_id`, `isactive`, `name`, `notes`, `ticket_autoresp_subj`, `ticket_autoresp_body`, `ticket_notice_subj`, `ticket_notice_body`, `ticket_alert_subj`, `ticket_alert_body`, `message_autoresp_subj`, `message_autoresp_body`, `message_alert_subj`, `message_alert_body`, `note_alert_subj`, `note_alert_body`, `assigned_alert_subj`, `assigned_alert_body`, `transfer_alert_subj`, `transfer_alert_body`, `ticket_overdue_subj`, `ticket_overdue_body`, `ticket_overlimit_subj`, `ticket_overlimit_body`, `ticket_reply_subj`, `ticket_reply_body`, `created`, `updated`) VALUES
-(1, 1, 1, 'osTicket Default Template', 'Default osTicket templates', 'Support Ticket Opened [#%ticket]', '%name,\r\n\r\nA request for support has been created and assigned ticket #%ticket. A representative will follow-up with you as soon as possible.\r\n\r\nYou can view this ticket''s progress online here: %url/view.php?e=%email&t=%ticket.\r\n\r\nIf you wish to send additional comments or information regarding this issue, please don''t open a new ticket. Simply login using the link above and update the ticket.\r\n\r\n%signature', '[#%ticket] %subject', '%name,\r\n\r\nOur customer care team has created a ticket, #%ticket on your behalf, with the following message.\r\n\r\n%message\r\n\r\nIf you wish to provide additional comments or information regarding this issue, please don''t open a new ticket. You can update or view this ticket''s progress online here: %url/view.php?e=%email&t=%ticket.\r\n\r\n%signature', 'New Ticket Alert', '%staff,\r\n\r\nNew ticket #%ticket created.\r\n-------------------\r\nName: %name\r\nEmail: %email\r\nDept: %dept\r\n\r\n%message\r\n-------------------\r\n\r\nTo view/respond to the ticket, please login to the support ticket system.\r\n\r\n- Your friendly Customer Support System - powered by osTicket.', '[#%ticket] Message Added', '%name,\r\n\r\nYour reply to support request #%ticket has been noted.\r\n\r\nYou can view this support request progress online here: %url/view.php?e=%email&t=%ticket.\r\n\r\n%signature', 'New Message Alert', '%staff,\r\n\r\nNew message appended to ticket #%ticket\r\n\r\n----------------------\r\nName: %name\r\nEmail: %email\r\nDept: %dept\r\n\r\n%message\r\n-------------------\r\n\r\nTo view/respond to the ticket, please login to the support ticket system.\r\n\r\n- Your friendly Customer Support System - powered by osTicket.', 'New Internal Note Alert', '%staff,\r\n\r\nInternal note appended to ticket #%ticket\r\n\r\n----------------------\r\nName: %name\r\n\r\n%note\r\n-------------------\r\n\r\nTo view/respond to the ticket, please login to the support ticket system.\r\n\r\n- Your friendly Customer Support System - powered by osTicket.', 'Ticket #%ticket Assigned to you', '%assignee,\r\n\r\n%assigner has assigned ticket #%ticket to you or one of your teams!\r\n\r\n%note\r\n\r\nTo view complete details, simply login to the support system.\r\n\r\n%url/scp/tickets.php?id=%id\r\n\r\n- Your friendly Support Ticket System - powered by osTicket.', 'Ticket Transfer #%ticket - %dept', '%staff,\r\n\r\nTicket #%ticket has been transferred to %dept department\r\n\r\n----------------------\r\n\r\n%note\r\n\r\n-------------------\r\n\r\nTo view/respond to the ticket, please login to the support ticket system.\r\n\r\n%url/scp/ticket.php?id=%id\r\n\r\n- Your friendly Customer Support System - powered by osTicket.', 'Stale Ticket Alert', '%staff,\r\n\r\nA ticket, #%ticket assigned to you or in your department is seriously overdue.\r\n\r\n%url/scp/tickets.php?id=%id\r\n\r\nWe should all work hard to guarantee that all tickets are being addressed in a timely manner. Enough baby talk...please address the issue or you will hear from me again.\r\n\r\n\r\n- Your friendly (although with limited patience) Support Ticket System - powered by osTicket.', 'Open Tickets Limit Reached', '%name\r\n\r\nYou have reached the maximum number of open tickets allowed.\r\n\r\nTo be able to open another ticket, one of your pending tickets must be closed. To update or add comments to an open ticket simply login using the link below.\r\n\r\n%url/view.php?e=%email\r\n\r\nThank you.\r\n\r\nSupport Ticket System', '[#%ticket] %subject', '%name,\r\n\r\nA customer support staff member has replied to your support request, #%ticket with the following response:\r\n\r\n%response\r\n\r\nWe hope this response has sufficiently answered your questions. If not, please do not send another email. Instead, reply to this email or login to your account for a complete archive of all your support requests and responses.\r\n\r\n%url/view.php?e=%email&t=%ticket\r\n\r\n%signature', '2011-08-05 17:00:03', '2012-03-19 01:44:54');
+(1, 1, 1, 'osTicket Default Template', 'Default osTicket templates', 'Support Ticket Opened [#%{ticket.number}]', '%{ticket.name},\r\n\r\nA request for support has been created and assigned ticket #%{ticket.number}. A representative will follow-up with you as soon as possible.\r\n\r\nYou can view this ticket''s progress online here: %{url}/view.php?e=%{ticket.email}&t=%{ticket.number}.\r\n\r\nIf you wish to send additional comments or information regarding this issue, please don''t open a new ticket. Simply login using the link above and update the ticket.\r\n\r\n%{signature}', '[#%{ticket.number}] %{ticket.subject}', '%{ticket.name},\r\n\r\nOur customer care team has created a ticket, #%{ticket.number} on your behalf, with the following message.\r\n\r\n%{message}\r\n\r\nIf you wish to provide additional comments or information regarding this issue, please don''t open a new ticket. You can update or view this ticket''s progress online here: %{url}/view.php?e=%{ticket.email}&t=%{ticket.number}.\r\n\r\n%{signature}', 'New Ticket Alert', '%{recipient},\r\n\r\nNew ticket #%{ticket.number} created.\r\n-------------------\r\nName: %{ticket.name}\r\nEmail: %{ticket.email}\r\nDept: %{ticket.dept.name}\r\n\r\n%{message}\r\n-------------------\r\n\r\nTo view/respond to the ticket, please login to the support ticket system.\r\n\r\n- Your friendly Customer Support System - powered by osTicket.', '[#%{ticket.number}] Message Added', '%{ticket.name},\r\n\r\nYour reply to support request #%{ticket.number} has been noted.\r\n\r\nYou can view this support request progress online here: %{url}/view.php?e=%{ticket.email}&t=%{ticket.number}.\r\n\r\n%{signature}', 'New Message Alert', '%{recipient},\r\n\r\nNew message appended to ticket #%{ticket.number}\r\n\r\n----------------------\r\nName: %{ticket.name}\r\nEmail: %{ticket.email}\r\nDept: %{ticket.dept.name}\r\n\r\n%{message}\r\n-------------------\r\n\r\nTo view/respond to the ticket, please login to the support ticket system.\r\n\r\n- Your friendly Customer Support System - powered by osTicket.', 'New Internal Note Alert', '%{recipient},\r\n\r\nInternal note appended to ticket #%{ticket.number}\r\n\r\n----------------------\r\nName: %{ticket.name}\r\n\r\n%{note}\r\n-------------------\r\n\r\nTo view/respond to the ticket, please login to the support ticket system.\r\n\r\n- Your friendly Customer Support System - powered by osTicket.', 'Ticket #%{ticket.number} Assigned to you', '%{assignee},\r\n\r\n%{assigner} has assigned ticket #%{ticket.number} to you or one of your teams!\r\n\r\n%{note}\r\n\r\nTo view complete details, simply login to the support system.\r\n\r\n%{url}/scp/tickets.php?id=%{ticket.id}\r\n\r\n- Your friendly Support Ticket System - powered by osTicket.', 'Ticket Transfer #%{ticket.number} - %{ticket.dept.name}', '%{recipient},\r\n\r\nTicket #%{ticket.number} has been transferred to %{ticket.dept.name} department\r\n\r\n----------------------\r\n\r\n%{note}\r\n\r\n-------------------\r\n\r\nTo view/respond to the ticket, please login to the support ticket system.\r\n\r\n%{url}/scp/ticket.php?id=%{ticket.id}\r\n\r\n- Your friendly Customer Support System - powered by osTicket.', 'Stale Ticket Alert', '%{recipient},\r\n\r\nA ticket, #%{ticket.number} assigned to you or in your department is seriously overdue.\r\n\r\n%{url}/scp/tickets.php?id=%{ticket.id}\r\n\r\nWe should all work hard to guarantee that all tickets are being addressed in a timely manner.\r\n\r\n\r\n- Your friendly (although with limited patience) Support Ticket System - powered by osTicket.', 'Open Tickets Limit Reached', '%{ticket.name}\r\n\r\nYou have reached the maximum number of open tickets allowed.\r\n\r\nTo be able to open another ticket, one of your pending tickets must be closed. To update or add comments to an open ticket simply login using the link below.\r\n\r\n%{url}/view.php?e=%{ticket.email}\r\n\r\nThank you.\r\n\r\nSupport Ticket System', '[#%{ticket.number}] %{ticket.subject}', '%{ticket.name},\r\n\r\nA customer support staff member has replied to your support request, #%{ticket.number} with the following response:\r\n\r\n%{response}\r\n\r\nWe hope this response has sufficiently answered your questions. If not, please do not send another email. Instead, reply to this email or login to your account for a complete archive of all your support requests and responses.\r\n\r\n%{url}/view.php?e=%{ticket.email}&t=%{ticket.number}\r\n\r\n%{signature}', '2011-08-05 17:00:03', '2012-03-19 01:44:54');
 
 DROP TABLE IF EXISTS `%TABLE_PREFIX%file`;
 CREATE TABLE `%TABLE_PREFIX%file` (
@@ -422,7 +422,7 @@ CREATE TABLE `%TABLE_PREFIX%canned_response` (
 
 INSERT INTO `%TABLE_PREFIX%canned_response` (`canned_id`, `dept_id`, `isenabled`, `title`, `response`) VALUES
     (1, 0, 1, 'What is osTicket (sample)?', '\r\nosTicket is a widely-used open source support ticket system, an attractive alternative to higher-cost and complex customer support systems - simple, lightweight, reliable, open source, web-based and easy to setup and use.'),
-    (2, 0, 1, 'Sample (with variables)', '\r\n%name,\r\n\r\nYour ticket #%ticket created on %createdate is in %dept department.\r\n\r\n');
+    (2, 0, 1, 'Sample (with variables)', '\r\n%{ticket.name},\r\n\r\nYour ticket #%{ticket.number} created on %{ticket.create_date} is in %{ticket.dept.name} department.\r\n\r\n');
 
 DROP TABLE IF EXISTS `%TABLE_PREFIX%canned_attachment`;
 CREATE TABLE IF NOT EXISTS `%TABLE_PREFIX%canned_attachment` (
diff --git a/setup/inc/sql/osTicket-mysql.sql.md5 b/setup/inc/sql/osTicket-mysql.sql.md5
index 11c872a50..ede3ca85c 100644
--- a/setup/inc/sql/osTicket-mysql.sql.md5
+++ b/setup/inc/sql/osTicket-mysql.sql.md5
@@ -1 +1 @@
-15b3076533123ff617801d89861136c8
+7f35de4260e7a1d8bc2d4214786972ea
-- 
GitLab