Skip to content
Snippets Groups Projects
Commit 4ccce8d7 authored by Jared Hancock's avatar Jared Hancock Committed by Peter Rotich
Browse files

DB patch for federated email templates and site pages

parent 254bd759
No related branches found
No related tags found
No related merge requests found
/**
* @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';
......@@ -440,6 +440,7 @@ CREATE TABLE `%TABLE_PREFIX%help_topic` (
`staff_id` int(10) unsigned NOT NULL default '0',
`team_id` int(10) unsigned NOT NULL default '0',
`sla_id` int(10) unsigned NOT NULL default '0',
`page_id` int(10) unsigned NOT NULL default '0',
`topic` varchar(32) NOT NULL default '',
`notes` text,
`created` datetime NOT NULL,
......@@ -450,7 +451,8 @@ CREATE TABLE `%TABLE_PREFIX%help_topic` (
KEY `priority_id` (`priority_id`),
KEY `dept_id` (`dept_id`),
KEY `staff_id` (`staff_id`,`team_id`),
KEY `sla_id` (`sla_id`)
KEY `sla_id` (`sla_id`),
KEY `page_id` (`page_id`)
) DEFAULT CHARSET=utf8;
INSERT INTO `%TABLE_PREFIX%help_topic` (`isactive`, `ispublic`, `noautoresp`, `dept_id`, `sla_id`, `topic`, `notes`) VALUES
......@@ -751,3 +753,28 @@ INSERT INTO `%TABLE_PREFIX%timezone` (`offset`, `timezone`) VALUES
(10.0, 'Eastern Australia, Guam, Vladivostok'),
(11.0, 'Magadan, Solomon Islands, New Caledonia'),
(12.0, 'Auckland, Wellington, Fiji, Kamchatka');
-- pages
CREATE TABLE IF NOT EXISTS `%TABLE_PREFIX%page` (
`id` int(10) unsigned NOT NULL auto_increment,
`isactive` tinyint(1) unsigned NOT NULL default '0',
`type` enum('landing','offline','thank-you','other') NOT NULL default 'other',
`name` varchar(255) NOT NULL,
`body` text NOT NULL,
`notes` text,
`created` datetime NOT NULL,
`updated` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) DEFAULT CHARSET=utf8;
INSERT INTO `%TABLE_PREFIX%page` (`id`, `isactive`, `type`, `name`, `body`, `notes`, `created`, `updated`) VALUES
('', 1, 'offline', 'Offline', '<div>\r\n<h1><span style="font-size: medium">Support Ticket System Offline</span></h1>\r\n<p>Thank you for your interest in contacting us.</p>\r\n<p>Our helpdesk is offline at the moment, please check back at a later time.</p>\r\n</div>', 'Default offline page', NOW(), NOW()),
('', 1, 'thank-you', 'Thank you', '<div>%{ticket.name},<br />\r\n \r\n<p>\r\nThank you for contacting us.</p><p> A support ticket request #%{ticket.number} has been created and a representative will be getting back to you shortly if necessary.</p>\r\n \r\n<p>Support Team </p>\r\n</div>', 'Default "thank you" page displayed after the end-user creates a web ticket.', NOW(), NOW()),
('', 1, 'landing', 'Landing', '<h1>Welcome to the Support Center</h1>\r\n<p>In order to streamline support requests and better serve you, we utilize a support ticket system. Every support request is assigned a unique ticket number which you can use to track the progress and responses online. For your reference we provide complete archives and history of all your support requests. A valid email address is required to submit a ticket.\r\n</p>\r\n', 'Introduction text on the landing page.', NOW(), NOW());
INSERT INTO `%TABLE_PREFIX%config` (`key`, `value`, `namespace`) VALUES
('landing_page_id', (SELECT `id` FROM `%TABLE_PREFIX%page` WHERE `type` = 'landing'), 'core'),
('offline_page_id', (SELECT `id` FROM `%TABLE_PREFIX%page` WHERE `type` = 'offline'), 'core'),
('thank-you_page_id', (SELECT `id` FROM `%TABLE_PREFIX%page` WHERE `type` = 'thank-you'), 'core');
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