Skip to content
Snippets Groups Projects
Commit 477d3421 authored by Jared Hancock's avatar Jared Hancock
Browse files

Migrate Email Templates to a row-based data model

parent 4ab3936a
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
......@@ -88,7 +88,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
<select name="tpl_id">
<option value="0">&mdash; System default &mdash;</option>
<?php
$sql='SELECT tpl_id,name FROM '.EMAIL_TEMPLATE_TABLE.' tpl WHERE isactive=1 ORDER by name';
$sql='SELECT tpl_id,name FROM '.EMAIL_TEMPLATE_GRP_TABLE.' tpl WHERE isactive=1 ORDER by name';
if(($res=db_query($sql)) && db_num_rows($res)){
while(list($id,$name)=db_fetch_row($res)){
$selected=($info['tpl_id'] && $id==$info['tpl_id'])?'selected="selected"':'';
......@@ -144,7 +144,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
&nbsp;<span class="error">&nbsp;<?php echo $errors['manager_id']; ?></span>
</td>
</tr>
<?php
<?php
} ?>
<tr>
......@@ -167,7 +167,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
</td>
<td>
<input type="checkbox" name="ticket_auto_response" value="0" <?php echo !$info['ticket_auto_response']?'checked="checked"':''; ?> >
<strong>Disable</strong> new ticket auto-response for this Dept.
</td>
</tr>
......@@ -217,7 +217,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
.' ORDER BY group_name';
if(($res=db_query($sql)) && db_num_rows($res)){
while(list($id, $name, $members) = db_fetch_row($res)) {
if($members>0)
if($members>0)
$members=sprintf('<a href="staff.php?a=filter&gid=%d">%d</a>', $id, $members);
$ck=($info['groups'] && in_array($id,$info['groups']))?'checked="checked"':'';
......
......@@ -60,7 +60,7 @@ $gmtime = Misc::gmtime();
<select name="default_template_id">
<option value="">&mdash; Select Default Template &mdash;</option>
<?php
$sql='SELECT tpl_id,name FROM '.EMAIL_TEMPLATE_TABLE.' WHERE isactive=1 ORDER BY name';
$sql='SELECT tpl_id,name FROM '.EMAIL_TEMPLATE_GRP_TABLE.' WHERE isactive=1 ORDER BY name';
if(($res=db_query($sql)) && db_num_rows($res)){
while (list($id, $name) = db_fetch_row($res)){
$selected = ($config['default_template_id']==$id)?'selected="selected"':''; ?>
......@@ -99,7 +99,7 @@ $gmtime = Misc::gmtime();
</tr>
<tr>
<td>Purge Logs:</td>
<td>
<td>
<select name="log_graceperiod">
<option value=0 selected>Never Purge Logs</option>
<?php
......@@ -172,7 +172,7 @@ $gmtime = Misc::gmtime();
echo sprintf('<option value="%d" %s>%d</option>', $i,(($config['client_login_timeout']==$i)?'selected="selected"':''), $i);
}
?>
</select> minute lock-out is enforced.
</select> minute lock-out is enforced.
</td>
</tr>
......
......@@ -8,8 +8,8 @@ if($template && $_REQUEST['a']!='add'){
$action='update';
$submit_text='Save Changes';
$info=$template->getInfo();
$info['id']=$template->getId();
$qstr.='&id='.$template->getId();
$info['tpl_id']=$template->getId();
$qstr.='&tpl_id='.$template->getId();
}else {
$title='Add New Template';
$action='add';
......@@ -23,7 +23,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
<?php csrf_token(); ?>
<input type="hidden" name="do" value="<?php echo $action; ?>">
<input type="hidden" name="a" value="<?php echo Format::htmlchars($_REQUEST['a']); ?>">
<input type="hidden" name="id" value="<?php echo $info['id']; ?>">
<input type="hidden" name="tpl_id" value="<?php echo $info['tpl_id']; ?>">
<h2>Email Template</h2>
<table class="form_table" width="940" border="0" cellspacing="0" cellpadding="2">
<thead>
......@@ -74,10 +74,31 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
</th>
</tr>
<?php
foreach(Template::message_templates() as $k=>$tpl){
echo sprintf('<tr><td colspan=2>&nbsp;<strong><a href="templates.php?id=%d&a=manage&tpl=%s">%s</a></strong>&nbsp-&nbsp<em>%s</em></td></tr>',
$template->getId(),$k,Format::htmlchars($tpl['name']),Format::htmlchars($tpl['desc']));
foreach($template->getTemplates() as $tpl){
$info = $tpl->getDescription();
if (!$info['name'])
continue;
echo sprintf('<tr><td colspan=2>&nbsp;<strong><a href="templates.php?id=%d&a=manage">%s</a></strong>&nbsp-&nbsp<em>%s</em></td></tr>',
$tpl->getId(),Format::htmlchars($info['name']),
Format::htmlchars($info['desc']));
}
if (($undef = $template->getUndefinedTemplateNames())) { ?>
<tr>
<th colspan="2">
<em><strong>Unimplemented Template Messages</strong>: Click
on the message to implement</em>
</th>
</tr>
<?php
foreach($template->getUndefinedTemplateNames() as $cn=>$info){
echo sprintf('<tr><td colspan=2>&nbsp;<strong><a
href="templates.php?tpl_id=%d&a=implement&code_name=%s"
style="color:red;text-decoration:underline"
>%s</a></strong>&nbsp-&nbsp<em>%s</em></td></tr>',
$template->getId(),$cn,Format::htmlchars($info['name']),
Format::htmlchars($info['desc']));
}
}
}else{ ?>
<tr>
<td width="180" class="required">
......@@ -87,7 +108,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
<select name="tpl_id">
<option value="0">&mdash; Select One &dash;</option>
<?php
$sql='SELECT tpl_id,name FROM '.EMAIL_TEMPLATE_TABLE.' ORDER by name';
$sql='SELECT tpl_id,name FROM '.EMAIL_TEMPLATE_GRP_TABLE.' ORDER by name';
if(($res=db_query($sql)) && db_num_rows($res)){
while(list($id,$name)=db_fetch_row($res)){
$selected=($info['tpl_id'] && $id==$info['tpl_id'])?'selected="selected"':'';
......
......@@ -3,7 +3,7 @@ if(!defined('OSTADMININC') || !$thisstaff->isAdmin()) die('Access Denied');
$qstr='';
$sql='SELECT tpl.*,count(dept.tpl_id) as depts '.
'FROM '.EMAIL_TEMPLATE_TABLE.' tpl '.
'FROM '.EMAIL_TEMPLATE_GRP_TABLE.' tpl '.
'LEFT JOIN '.DEPT_TABLE.' dept USING(tpl_id) '.
'WHERE 1 ';
$sortOptions=array('name'=>'tpl.name','status'=>'tpl.isactive','created'=>'tpl.created','updated'=>'tpl.updated');
......@@ -27,7 +27,7 @@ $x=$sort.'_sort';
$$x=' class="'.strtolower($order).'" ';
$order_by="$order_column $order ";
$total=db_count('SELECT count(*) FROM '.EMAIL_TEMPLATE_TABLE.' tpl ');
$total=db_count('SELECT count(*) FROM '.EMAIL_TEMPLATE_GRP_TABLE.' tpl ');
$page=($_GET['p'] && is_numeric($_GET['p']))?$_GET['p']:1;
$pageNav=new Pagenate($total, $page, PAGE_LIMIT);
$pageNav->setURL('templates.php',$qstr.'&sort='.urlencode($_REQUEST['sort']).'&order='.urlencode($_REQUEST['order']));
......@@ -56,7 +56,7 @@ else
<caption><?php echo $showing; ?></caption>
<thead>
<tr>
<th width="7">&nbsp;</th>
<th width="7">&nbsp;</th>
<th width="350"><a <?php echo $name_sort; ?> href="templates.php?<?php echo $qstr; ?>&sort=name">Name</a></th>
<th width="100"><a <?php echo $status_sort; ?> href="templates.php?<?php echo $qstr; ?>&sort=status">Status</a></th>
<th width="80"><a <?php echo $inuse_sort; ?> href="templates.php?<?php echo $qstr; ?>&sort=inuse">In-Use</a></th>
......@@ -75,15 +75,15 @@ else
$sel=false;
if($ids && in_array($row['tpl_id'],$ids))
$sel=true;
$default=($defaultTplId==$row['tpl_id'])?'<small class="fadded">(System Default)</small>':'';
?>
<tr id="<?php echo $row['tpl_id']; ?>">
<td width=7px>
<input type="checkbox" class="ckb" name="ids[]" value="<?php echo $row['tpl_id']; ?>"
<input type="checkbox" class="ckb" name="ids[]" value="<?php echo $row['tpl_id']; ?>"
<?php echo $sel?'checked="checked"':''; ?> <?php echo $default?'disabled="disabled"':''; ?> >
</td>
<td>&nbsp;<a href="templates.php?id=<?php echo $row['tpl_id']; ?>"><?php echo Format::htmlchars($row['name']); ?></a>
<td>&nbsp;<a href="templates.php?tpl_id=<?php echo $row['tpl_id']; ?>"><?php echo Format::htmlchars($row['name']); ?></a>
&nbsp;<?php echo $default; ?></td>
<td>&nbsp;<?php echo $row['isactive']?'Active':'<b>Disabled</b>'; ?></td>
<td>&nbsp;&nbsp;<?php echo ($inuse)?'<b>Yes</b>':'No'; ?></td>
......
<?php
$msgtemplates=Template::message_templates();
$info=Format::htmlchars(($errors && $_POST)?$_POST:$_REQUEST);
$info['tpl']=($info['tpl'] && $msgtemplates[$info['tpl']])?$info['tpl']:'ticket_autoresp';
if (is_a($template, EmailTemplateGroup)) {
// New template implementation
$id = 0;
$tpl_id = $template->getId();
$name = $template->getName();
$selected = $_REQUEST['code_name'];
$action = 'implement';
$extras = array('code_name'=>$selected, 'tpl_id'=>$tpl_id);
$msgtemplates=$template->all_names;
} else {
// Template edit
$id = $template->getId();
$tpl_id = $template->getTplId();
$name = $template->getGroup()->getName();
$selected = $template->getCodeName();
$action = 'updatetpl';
$extras = array();
$msgtemplates=$template->getGroup()->all_names;
$info=array_merge(array('subj'=>$template->getSubject(), 'body'=>$template->getBody()),$info);
}
$info['tpl']=($info['tpl'] && $msgtemplates[$info['tpl']])?$info['tpl']:'ticket.autoresp';
$tpl=$msgtemplates[$info['tpl']];
$info=array_merge($template->getMsgTemplate($info['tpl']),$info);
?>
<h2>Email Template Message - <span><?php echo $template->getName(); ?></span></h2>
<h2>Email Template Message - <span><?php echo $name; ?></span></h2>
<div style="padding-top:10px;padding-bottom:5px;">
<form method="get" action="templates.php">
<input type="hidden" name="id" value="<?php echo $template->getId(); ?>">
<input type="hidden" name="a" value="manage">
Message Template:
<select id="tpl_options" name="tpl" style="width:300px;">
<select id="tpl_options" name="id" style="width:300px;">
<option value="">&mdash; Select Setting Group &mdash;</option>
<?php
foreach($msgtemplates as $k=>$v) {
$sel=($info['tpl']==$k)?'selected="selected"':'';
echo sprintf('<option value="%s" %s>%s</option>',$k,$sel,$v['name']);
foreach($template->getGroup()->getTemplates() as $cn=>$t) {
$nfo=$t->getDescription();
if (!$nfo['name'])
continue;
$sel=($selected==$cn)?'selected="selected"':'';
echo sprintf('<option value="%s" %s>%s</option>',
$t->getId(),$sel,$nfo['name']);
}
?>
</select>
......@@ -25,12 +47,14 @@ $info=array_merge($template->getMsgTemplate($info['tpl']),$info);
&nbsp;&nbsp;&nbsp;<font color="red"><?php echo $errors['tpl']; ?></font>
</form>
</div>
<form action="templates.php?id=<?php echo $template->getId(); ?>" method="post" id="save">
<form action="templates.php?id=<?php echo $id; ?>" method="post" id="save">
<?php csrf_token(); ?>
<input type="hidden" name="id" value="<?php echo $template->getId(); ?>">
<input type="hidden" name="tpl" value="<?php echo $info['tpl']; ?>">
<?php foreach ($extras as $k=>$v) { ?>
<input type="hidden" name="<?php echo $k; ?>" value="<?php echo $v; ?>" />
<?php } ?>
<input type="hidden" name="id" value="<?php echo $id; ?>">
<input type="hidden" name="a" value="manage">
<input type="hidden" name="do" value="updatetpl">
<input type="hidden" name="do" value="<?php echo $action; ?>">
<table class="form_table settings_table" width="940" border="0" cellspacing="0" cellpadding="2">
<thead>
......@@ -59,6 +83,7 @@ $info=array_merge($template->getMsgTemplate($info['tpl']),$info);
<p style="padding-left:210px;">
<input class="button" type="submit" name="submit" value="Save Changes">
<input class="button" type="reset" name="reset" value="Reset Changes">
<input class="button" type="button" name="cancel" value="Cancel Changes" onclick='window.location.href="templates.php?id=<?php echo $template->getId(); ?>"'>
<input class="button" type="button" name="cancel" value="Cancel Changes"
onclick='window.location.href="templates.php?tpl_id=<?php echo $tpl_id; ?>"'>
</p>
</form>
/**
* @version v1.7.1
* @signature 00000000000000000000000000000000
*
* - Migrates the email template table to two tables, groups and templates.
* Templates organized in a separate table by group will allow for a more
* extensible model for email templates.
*/
DROP TABLE IF EXISTS `%TABLE_PREFIX%email_template_group`;
CREATE TABLE `%TABLE_PREFIX%email_template_group` (
`tpl_id` int(11) NOT NULL auto_increment,
`isactive` tinyint(1) unsigned NOT NULL default '0',
`name` varchar(32) NOT NULL default '',
`notes` text,
`created` datetime NOT NULL,
`updated` timestamp NOT NULL,
PRIMARY KEY (`tpl_id`)
) DEFAULT CHARSET=utf8;
INSERT INTO `%TABLE_PREFIX%email_template_group`
SELECT `tpl_id`, `isactive`, `name`, `notes`, `created`, `updated`
FROM `%TABLE_PREFIX%email_template`;
CREATE TABLE `%TABLE_PREFIX%_email_template` (
`id` int(11) unsigned NOT NULL auto_increment,
`tpl_id` int(11) unsigned NOT NULL,
`code_name` varchar(32) NOT NULL,
`subject` varchar(255) NOT NULL default '',
`body` text NOT NULL,
`created` datetime NOT NULL,
`updated` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `template_lookup` (`tpl_id`, `code_name`)
) DEFAULT CHARSET=utf8;
INSERT INTO `%TABLE_PREFIX%_email_template`
(`tpl_id`, `code_name`, `subject`, `body`, `created`, `updated`)
SELECT `tpl_id`, 'ticket.autoresp', ticket_autoresp_subj, ticket_autoresp_body, `created`, `updated`
FROM `%TABLE_PREFIX%_email_template`;
INSERT INTO `%TABLE_PREFIX%_email_template`
(`tpl_id`, `code_name`, `subject`, `body`, `created`, `updated`)
SELECT `tpl_id`, 'ticket.autoreply', ticket_autoreply_subj, ticket_autoreply_body, `created`, `updated`
FROM `%TABLE_PREFIX%_email_template`;
INSERT INTO `%TABLE_PREFIX%_email_template`
(`tpl_id`, `code_name`, `subject`, `body`, `created`, `updated`)
SELECT `tpl_id`, 'message.autoresp', message_autoresp_subj, message_autoresp_body, `created`, `updated`
FROM `%TABLE_PREFIX%_email_template`;
INSERT INTO `%TABLE_PREFIX%_email_template`
(`tpl_id`, `code_name`, `subject`, `body`, `created`, `updated`)
SELECT `tpl_id`, 'ticket.notice', ticket_notice_subj, ticket_notice_body, `created`, `updated`
FROM `%TABLE_PREFIX%_email_template`;
INSERT INTO `%TABLE_PREFIX%_email_template`
(`tpl_id`, `code_name`, `subject`, `body`, `created`, `updated`)
SELECT `tpl_id`, 'ticket.overlimit', ticket_overlimit_subj, ticket_overlimit_body, `created`, `updated`
FROM `%TABLE_PREFIX%_email_template`;
INSERT INTO `%TABLE_PREFIX%_email_template`
(`tpl_id`, `code_name`, `subject`, `body`, `created`, `updated`)
SELECT `tpl_id`, 'ticket.reply', ticket_reply_subj, ticket_reply_body, `created`, `updated`
FROM `%TABLE_PREFIX%_email_template`;
INSERT INTO `%TABLE_PREFIX%_email_template`
(`tpl_id`, `code_name`, `subject`, `body`, `created`, `updated`)
SELECT `tpl_id`, 'ticket.alert', ticket_alert_subj, ticket_alert_body, `created`, `updated`
FROM `%TABLE_PREFIX%_email_template`;
INSERT INTO `%TABLE_PREFIX%_email_template`
(`tpl_id`, `code_name`, `subject`, `body`, `created`, `updated`)
SELECT `tpl_id`, 'message.alert', message_alert_subj, message_alert_body, `created`, `updated`
FROM `%TABLE_PREFIX%_email_template`;
INSERT INTO `%TABLE_PREFIX%_email_template`
(`tpl_id`, `code_name`, `subject`, `body`, `created`, `updated`)
SELECT `tpl_id`, 'note.alert', note_alert_subj, note_alert_body, `created`, `updated`
FROM `%TABLE_PREFIX%_email_template`;
INSERT INTO `%TABLE_PREFIX%_email_template`
(`tpl_id`, `code_name`, `subject`, `body`, `created`, `updated`)
SELECT `tpl_id`, 'assigned.alert', assigned_alert_subj, assigned_alert_body, `created`, `updated`
FROM `%TABLE_PREFIX%_email_template`;
INSERT INTO `%TABLE_PREFIX%_email_template`
(`tpl_id`, `code_name`, `subject`, `body`, `created`, `updated`)
SELECT `tpl_id`, 'transfer.alert', transfer_alert_subj, transfer_alert_body, `created`, `updated`
FROM `%TABLE_PREFIX%_email_template`;
INSERT INTO `%TABLE_PREFIX%_email_template`
(`tpl_id`, `code_name`, `subject`, `body`, `created`, `updated`)
SELECT `tpl_id`, 'ticket.overdue', ticket_overdue_subj, ticket_overdue_body, `created`, `updated`
FROM `%TABLE_PREFIX%_email_template`;
DROP TABLE `%TABLE_PREFIX%email_template`;
ALTER TABLE `%TABLE_PREFIX%_email_template`
RENAME TO `%TABLE_PREFIX%email_template`;
-- Finished with patch
UPDATE `%TABLE_PREFIX%config`
SET `value` = '00000000000000000000000000000000'
WHERE `key` = 'schema_signature' AND `namespace` = 'core';
......@@ -179,6 +179,7 @@
define('TICKET_EMAIL_INFO_TABLE',TABLE_PREFIX.'ticket_email_info');
define('EMAIL_TABLE',TABLE_PREFIX.'email');
define('EMAIL_TEMPLATE_GRP_TABLE',TABLE_PREFIX.'email_template_group');
define('EMAIL_TEMPLATE_TABLE',TABLE_PREFIX.'email_template');
define('FILTER_TABLE',TABLE_PREFIX.'filter');
......
......@@ -16,7 +16,11 @@
require('admin.inc.php');
include_once(INCLUDE_DIR.'class.template.php');
$template=null;
if($_REQUEST['id'] && !($template=Template::lookup($_REQUEST['id'])))
if($_REQUEST['tpl_id'] &&
!($template=EmailTemplateGroup::lookup($_REQUEST['tpl_id'])))
$errors['err']='Unknown or invalid template group ID.';
elseif($_REQUEST['id'] &&
!($template=EmailTemplate::lookup($_REQUEST['id'])))
$errors['err']='Unknown or invalid template ID.';
if($_POST){
......@@ -24,13 +28,23 @@ if($_POST){
case 'updatetpl':
if(!$template){
$errors['err']='Unknown or invalid template';
}elseif($template->updateMsgTemplate($_POST,$errors)){
}elseif($template->update($_POST,$errors)){
$template->reload();
$msg='Message template updated successfully';
}elseif(!$errors['err']){
$errors['err']='Error updating message template. Try again!';
}
break;
case 'implement':
if(!$template){
$errors['err']='Unknown or invalid template';
}elseif($new = EmailTemplate::add($_POST,$errors)){
$template = $new;
$msg='Message template updated successfully';
}elseif(!$errors['err']){
$errors['err']='Error updating message template. Try again!';
}
break;
case 'update':
if(!$template){
$errors['err']='Unknown or invalid template';
......@@ -41,7 +55,8 @@ if($_POST){
}
break;
case 'add':
if((Template::create($_POST,$errors))){
if(($new=EmailTemplateGroup::add($_POST,$errors))){
$template=$new;
$msg='Template added successfully';
$_REQUEST['a']=null;
}elseif(!$errors['err']){
......@@ -55,7 +70,7 @@ if($_POST){
$count=count($_POST['ids']);
switch(strtolower($_POST['a'])) {
case 'enable':
$sql='UPDATE '.EMAIL_TEMPLATE_TABLE.' SET isactive=1 '
$sql='UPDATE '.EMAIL_TEMPLATE_GRP_TABLE.' SET isactive=1 '
.' WHERE tpl_id IN ('.implode(',', db_input($_POST['ids'])).')';
if(db_query($sql) && ($num=db_affected_rows())){
if($num==$count)
......@@ -69,7 +84,7 @@ if($_POST){
case 'disable':
$i=0;
foreach($_POST['ids'] as $k=>$v) {
if(($t=Template::lookup($v)) && !$t->isInUse() && $t->disable())
if(($t=EmailTemplateGroup::lookup($v)) && !$t->isInUse() && $t->disable())
$i++;
}
if($i && $i==$count)
......@@ -82,7 +97,7 @@ if($_POST){
case 'delete':
$i=0;
foreach($_POST['ids'] as $k=>$v) {
if(($t=Template::lookup($v)) && !$t->isInUse() && $t->delete())
if(($t=EmailTemplateGroup::lookup($v)) && !$t->isInUse() && $t->delete())
$i++;
}
......@@ -107,6 +122,8 @@ if($_POST){
$page='templates.inc.php';
if($template && !strcasecmp($_REQUEST['a'],'manage')){
$page='tpl.inc.php';
}elseif($template && !strcasecmp($_REQUEST['a'],'implement')){
$page='tpl.inc.php';
}elseif($template || !strcasecmp($_REQUEST['a'],'add')){
$page='template.inc.php';
}
......
......@@ -134,7 +134,7 @@ class Installer extends SetupWizard {
$sql='SELECT `dept_id` FROM '.PREFIX.'department ORDER BY `dept_id` LIMIT 1';
$dept_id_1 = db_result(db_query($sql, false), 0);
$sql='SELECT `tpl_id` FROM '.PREFIX.'email_template ORDER BY `tpl_id` LIMIT 1';
$sql='SELECT `tpl_id` FROM '.PREFIX.'email_template_group ORDER BY `tpl_id` LIMIT 1';
$template_id_1 = db_result(db_query($sql, false), 0);
$sql='SELECT `group_id` FROM '.PREFIX.'groups ORDER BY `group_id` LIMIT 1';
......
......@@ -301,46 +301,63 @@ INSERT INTO `%TABLE_PREFIX%filter_rule` (
`filter_id`, `isactive`, `what`,`how`,`val`,`created`)
VALUES (LAST_INSERT_ID(), 1, 'email', 'equal', 'test@example.com',NOW());
DROP TABLE IF EXISTS `%TABLE_PREFIX%email_template`;
CREATE TABLE `%TABLE_PREFIX%email_template` (
DROP TABLE IF EXISTS `%TABLE_PREFIX%email_template_group`;
CREATE TABLE `%TABLE_PREFIX%email_template_group` (
`tpl_id` int(11) NOT NULL auto_increment,
`cfg_id` int(10) unsigned NOT NULL default '0',
`isactive` tinyint(1) unsigned NOT NULL default '0',
`name` varchar(32) NOT NULL default '',
`notes` text,
`ticket_autoresp_subj` varchar(255) NOT NULL default '',
`ticket_autoresp_body` text NOT NULL,
`ticket_autoreply_subj` varchar(255) NOT NULL default '',
`ticket_autoreply_body` text NOT NULL,
`ticket_notice_subj` varchar(255) NOT NULL,
`ticket_notice_body` text NOT NULL,
`ticket_alert_subj` varchar(255) NOT NULL default '',
`ticket_alert_body` text NOT NULL,
`message_autoresp_subj` varchar(255) NOT NULL default '',
`message_autoresp_body` text NOT NULL,
`message_alert_subj` varchar(255) NOT NULL default '',
`message_alert_body` text NOT NULL,
`note_alert_subj` varchar(255) NOT NULL,
`note_alert_body` text NOT NULL,
`assigned_alert_subj` varchar(255) NOT NULL default '',
`assigned_alert_body` text NOT NULL,
`transfer_alert_subj` varchar(255) NOT NULL default '',
`transfer_alert_body` text NOT NULL,
`ticket_overdue_subj` varchar(255) NOT NULL default '',
`ticket_overdue_body` text NOT NULL,
`ticket_overlimit_subj` varchar(255) NOT NULL default '',
`ticket_overlimit_body` text NOT NULL,
`ticket_reply_subj` varchar(255) NOT NULL default '',
`ticket_reply_body` text NOT NULL,
`created` datetime NOT NULL,
`updated` timestamp NOT NULL,
PRIMARY KEY (`tpl_id`)
) DEFAULT CHARSET=utf8;
INSERT INTO `%TABLE_PREFIX%email_template_group` SET
`isactive` = 1, `name` = 'osTicket Default Template',
`notes` = 'Default osTicket templates', `created` = NOW(), `updated` = NOW();
DROP TABLE IF EXISTS `%TABLE_PREFIX%email_template`;
CREATE TABLE `%TABLE_PREFIX%email_template` (
`id` int(11) UNSIGNED NOT NULL auto_increment,
`tpl_id` int(11) UNSIGNED NOT NULL,
`code_name` varchar(32) NOT NULL,
`subject` varchar(255) NOT NULL default '',
`body` text NOT NULL,
`created` datetime NOT NULL,
`updated` datetime NOT NULL,
PRIMARY KEY (`tpl_id`),
KEY `cfg_id` (`cfg_id`)
PRIMARY KEY (`id`),
UNIQUE KEY `template_lookup` (`tpl_id`, `code_name`)
) DEFAULT CHARSET=utf8;
-- TODO: Dump revised copy before release!!!
INSERT INTO `%TABLE_PREFIX%email_template` (`isactive`, `name`, `notes`, `ticket_autoresp_subj`, `ticket_autoresp_body`, `ticket_autoreply_subj`, `ticket_autoreply_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, '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: %{ticket.client_link}.\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}', 'Support Ticket Opened [#%{ticket.number}]', '%{ticket.name},\r\n\r\nA request for support has been created and assigned ticket #%{ticket.number} with the following auto-reply:\r\n\r\n%{response}\r\n\r\n\r\nWe hope this response has sufficiently answered your questions. If not, please do not open another ticket. If need be, representative will follow-up with you as soon as possible.\r\n\r\nYou can view this ticket''s progress online here: %{ticket.client_link}.', '[#%{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: %{ticket.client_link}.\r\n\r\n%{signature}', 'New Ticket Alert', '%{recipient},\r\n\r\nNew ticket #%{ticket.number} created.\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%{ticket.staff_link}\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: %{ticket.client_link}.\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%{ticket.staff_link}\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\n* %{note.title} *\r\n\r\n%{note.message}\r\n----------------------\r\n\r\nTo view/respond to the ticket, please login to the support ticket system.\r\n\r\n%{ticket.staff_link}\r\n\r\n- Your friendly Customer Support System - powered by osTicket.', 'Ticket #%{ticket.number} Assigned to you', '%{assignee},\r\n\r\nTicket #%{ticket.number} has been assigned to you by %{assigner}\r\n\r\n----------------------\r\n\r\n%{comments}\r\n\r\n----------------------\r\n\r\nTo view complete details, simply login to the support system.\r\n\r\n%{ticket.staff_link}\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 by %{staff.name}\r\n\r\n----------------------\r\n\r\n%{comments}\r\n\r\n----------------------\r\n\r\nTo view/respond to the ticket, please login to the support ticket system.\r\n\r\n%{ticket.staff_link}\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%{ticket.staff_link}\r\n\r\nWe should all work hard to guarantee that all tickets are being addressed in a timely manner.\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}/tickets.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%{ticket.client_link}\r\n\r\n%{signature}', NOW(), NOW());
INSERT INTO `%TABLE_PREFIX%email_template` (`code_name`, `subject`, `body`)
VALUES (
'ticket.autoresp', '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: %{ticket.client_link}.\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.autoreply', 'Support Ticket Opened [#%{ticket.number}]', '%{ticket.name}, \r\n\r\nA request for support has been created and assigned ticket #%{ticket.number} with the following auto-reply:\r\n\r\n%{response}\r\n\r\n\r\nWe hope this response has sufficiently answered your questions. If not, please do not open another ticket. If need be, representative will follow-up with you as soon as possible.\r\n\r\nYou can view this ticket''s progress online here: %{ticket.client_link}.'
), (
'ticket.notice', '[#%{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: %{ticket.client_link}.\r\n\r\n%{signature}'
), (
'ticket.alert', 'New Ticket Alert', '%{recipient}, \r\n\r\nNew ticket #%{ticket.number} created.\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%{ticket.staff_link}\r\n\r\n- Your friendly Customer Support System - powered by osTicket.'
), (
'message.autoresp', '[#%{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: %{ticket.client_link}.\r\n\r\n%{signature}'
), (
'message.alert', '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%{ticket.staff_link}\r\n\r\n- Your friendly Customer Support System - powered by osTicket.'
), (
'note.alert', 'New Internal Note Alert', '%{recipient}, \r\n\r\nInternal note appended to ticket #%{ticket.number}\r\n\r\n----------------------\r\n* %{note.title} *\r\n\r\n%{note.message}\r\n----------------------\r\n\r\nTo view/respond to the ticket, please login to the support ticket system.\r\n\r\n%{ticket.staff_link}\r\n\r\n- Your friendly Customer Support System - powered by osTicket.'
), (
'assigned.alert', 'Ticket #%{ticket.number} Assigned to you', '%{assignee}, \r\n\r\nTicket #%{ticket.number} has been assigned to you by %{assigner}\r\n\r\n----------------------\r\n\r\n%{comments}\r\n\r\n----------------------\r\n\r\nTo view complete details, simply login to the support system.\r\n\r\n%{ticket.staff_link}\r\n\r\n- Your friendly Support Ticket System - powered by osTicket.'
), (
'transfer.alert', 'Ticket Transfer #%{ticket.number} - %{ticket.dept.name}', '%{recipient}, \r\n\r\nTicket #%{ticket.number} has been transferred to %{ticket.dept.name} department by %{staff.name}\r\n\r\n----------------------\r\n\r\n%{comments}\r\n\r\n----------------------\r\n\r\nTo view/respond to the ticket, please login to the support ticket system.\r\n\r\n%{ticket.staff_link}\r\n\r\n- Your friendly Customer Support System - powered by osTicket.'
), (
'ticket.overdue', '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%{ticket.staff_link}\r\n\r\nWe should all work hard to guarantee that all tickets are being addressed in a timely manner.\r\n\r\n- Your friendly (although with limited patience) Support Ticket System - powered by osTicket.'
), (
'ticket.overlimit', '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}/tickets.php?e=%{ticket.email}\r\n\r\nThank you.\r\n\r\nSupport Ticket System'
), (
'ticket.reply', '[#%{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%{ticket.client_link}\r\n\r\n%{signature}'
);
UPDATE `%TABLE_PREFIX%email_template` SET `created`=NOW(), `updated`=NOW(),
`tpl_id` = (SELECT `tpl_id` FROM `%TABLE_PREFIX%email_template_group`);
DROP TABLE IF EXISTS `%TABLE_PREFIX%file`;
CREATE TABLE `%TABLE_PREFIX%file` (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment