CREATE TABLE IF NOT EXISTS `#__js_ticket_attachments` (
	`id` int(11) NOT NULL AUTO_INCREMENT, 
	`ticketid` int(11) DEFAULT NULL, 
	`replyattachmentid` int(11) DEFAULT NULL, 
	`filesize` varchar(32) DEFAULT NULL, 
	`filename` varchar(128) DEFAULT NULL, 
	`filekey` varchar(128) DEFAULT NULL, 
	`deleted` tinyint(1) DEFAULT NULL, 
	`status` tinyint(1) DEFAULT NULL, 
	`created` datetime DEFAULT NULL, 
	PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `#__js_ticket_config` (`configname` varchar(100) NOT NULL DEFAULT '', 
	`configvalue` varchar(255) NOT NULL DEFAULT '', 
	`configfor` varchar(50) DEFAULT NULL, PRIMARY KEY (`configname`), FULLTEXT KEY `config_name` (`configname`), FULLTEXT KEY `config_for` (`configfor`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

INSERT INTO `#__js_ticket_config` VALUES 
('version', '103', 'version'),
('versiontype', 'free', 'version'),
('priority', '15', 'default'),
('ticket_per_email', '25', 'ticket'),
('cplink_myticket_staff', '1', 'cplink'),
('reopened_ticket_auto_assign', '1', 'ticket'),
('assigned_ticket_open_queue', '1', 'ticket'),
('answered_ticket_open_queue', '1', 'ticket'),
('alert_email', '1', 'email'),
('admin_email', '1', 'email'),
('ticket_department_transfer_admin', '1', 'email'),
('ticket_ban_email_admin', '1', 'email'),
('ticket_ban_email_user', '1', 'email'),
('new_ticket_admin', '1', 'email'),
('new_ticket_staff', '1', 'email'),
('new_staff_admin', '1', 'email'),
('new_group_admin', '1', 'email'),
('new_depatment_admin', '1', 'email'),
('new_help_topic_admin', '1', 'email'),
('theme', 'golden/css/jsticketsgolden.css', 'default'),
('title', 'JS Support Ticket', 'default'),
('data_directory', 'jssupportticketdata', 'default'),
('fr_cr_txb', '<br>&copy;Copyright 2008 - 2010, <a href="http://www.burujsolutions.com" target="_blank">Buruj Solutions </a> ', 'default'),
('backuponuninstall', '1', 'default'),
('offline','0','default'),
('offline_text','system down please come back soon.','default'),
('ticket_lock_admin','1','email'),
('payment_method','paypal','payment'),
('payment_shopingurl','','payment'),
('payment_successefulurl','','payment'),
('payment_cancelurl','','payment'),
('payment_paypalaccount','','payment'),
('payment_showdescription','1','payment'),
('payment_description','Description','payment'),
('payment_showfooter','1','payment'),
('payment_currency','USD','payment'),
('payment_authtoken','','payment'),
('payment_test_mode','1','payment'),
('date_format','d-m-Y','default'),
('ticket_unbanemail_staff','1','email'),
('ticket_unbanemail_user','1','email'),
('ticket_unbanemail_admin','1','email'),
('ticket_ban_and_close_staff','1','email'),
('ticket_ban_and_close_user','1','email'),
('ticket_ban_and_close_admin','1','email'),
('mailfromname','JS Tickets','email'),
('ticket_response_staff_user','1','email'),
('ticket_response_staff_staff','1','email'),
('ticket_response_staff_admin','1','email'),
('ticket_reply_user_admin','1','email'),
('ticket_department_transfer_user','1','email'),
('ticket_reassign_admin','1','email'),
('ticket_reassign_staff','1','email'),
('ticket_reassign_user','1','email'),
('ticket_close_admin','1','email'),
('ticket_close_staff','1','email'),
('ticket_close_user','1','email'),
('ticket_delete_admin','1','email'),
('ticket_delete_staff','1','email'),
('ticket_delete_user','1','email'),
('ticket_overdue_admin','1','email'),
('ticket_overdue_staff','1','email'),
('ticket_overdue_user', '1', 'email'),
('system_email','13','email'),
('cur_location', '1', 'default'),
('fr_cr_txa', '<img src="components/com_jsjobs/images/jsjobs_logo_small.png" width="65">&nbsp;&nbsp;&nbsp;Powered by <a href="http://www.joomsky.com" target="_blank">Joom Sky</a>', 'default'),
('api_primary', 'a2d09c7d76fced01f8be4b1f4cce8bec', 'api'),
('api_secondary', '', 'api'),
('filesize', '3072', 'default'),
('fileextension', 'doc,docx,odt,pdf,txt,png,jpeg,jpg,zip', 'default'),
('ticket_department_transfer_staff', '1', 'email'),
('ticket_ban_email_staff', '1', 'email'),
('ticket_reply_user_staff', '1', 'email'),
('staff_knowledgebase_articles', '1', 'knowledgebase'),
('staff_knowledgebase_category', '1', 'knowledgebase'),
('knowledgebase_articles_per_row', '2', 'knowledgebase'),
('banemail_new_ticket_admin', '1', 'email'),
('noofattachment', '5', 'default'),
('can_append_message', '1', 'email'),
('visitor_can_create_ticket', '0', 'default'),
('ticket_reopen_within_days', '5', 'ticket'),
('show_captcha_visitor_form_ticket', '1', 'default'),
('defaultalert', '0', 'default'),
('tvalue', '0', 'version'),
('ticket_overdue_indays', '5', 'default'),
('knowledgebase_enable', '1', 'default'),
('ticket_auto_close_indays', '5', 'default'),
('cplink_openticket_staff', '1', 'cplink'),
('ticket_reply_user_user', '1', 'email'),
('ticket_lock_user', '1', 'email'),
('ticket_lock_staff', '1', 'email'),
('cplink_addrole_staff', '0', 'cplink'),
('cplink_roles_staff', '1', 'cplink'),
('cplink_addstaff_staff', '0', 'cplink'),
('cplink_staff_staff', '1', 'cplink'),
('cplink_adddepartment_staff', '0', 'cplink'),
('cplink_department_staff', '1', 'cplink'),
('cplink_addcategory_staff', '0', 'cplink'),
('cplink_category_staff', '1', 'cplink'),
('cplink_addkb_staff', '0', 'cplink'),
('cplink_kb_staff', '1', 'cplink'),
('cplink_adddownload_staff', '0', 'cplink'),
('cplink_download_staff', '1', 'cplink'),
('cplink_addannouncement_staff', '0', 'cplink'),
('cplink_announcement_staff', '1', 'cplink'),
('cplink_addfaq_staff', '0', 'cplink'),
('cplink_faq_staff', '1', 'cplink'),
('cplink_mail_staff', '1', 'cplink'),
('cplink_profile_staff', '1', 'cplink'),
('tplink_home_staff', '1', 'tplink'),
('tplink_ticket_staff', '1', 'tplink'),
('tplink_kb_staff', '1', 'tplink'),
('tplink_announcement_staff', '1', 'tplink'),
('tplink_download_staff', '1', 'tplink'),
('tplink_faq_staff', '1', 'tplink'),
('cplink_openticket_user', '1', 'cplink'),
('cplink_myticket_user', '1', 'cplink'),
('cplink_checkstatus_user', '1', 'cplink'),
('cplink_download_user', '1', 'cplink'),
('cplink_announcement_user', '1', 'cplink'),
('cplink_faq_user', '1', 'cplink'),
('cplink_kb_user', '1', 'cplink'),
('tplink_home_user', '1', 'tplink'),
('tplink_ticket_user', '1', 'tplink'),
('tplink_kb_user', '1', 'tplink'),
('tplink_announcement_user', '1', 'tplink'),
('tplink_download_user', '1', 'tplink'),
('tplink_faq_user', '1', 'tplink'),
('show_count_tickets', '1', 'default'),
('maximum_ticket', '100', 'default'),
('ticket_unlock_user', '1', 'email'),
('ticket_unlock_admin', '1', 'email'),
('ticket_unlock_staff', '1', 'email'),
('unban_email_admin', '1', 'email'),
('unban_email_staff', '1', 'email'),
('unban_email_user', '1', 'email'),
('controlpanel_column_count', '3', 'default'),
('tve_enabled', '0', 'ticketviaemail'),
('cronjob_time', '', 'default'),
('tve_attachment', '1', 'ticketviaemail'),
('tve_mailreadtype', '1', 'ticketviaemail'),
('tve_emailpassword', '', 'ticketviaemail'),
('tve_emailaddress', '', 'ticketviaemail'),
('tve_hostname', '', 'ticketviaemail'),
('tve_hosttype', '1', 'ticketviaemail'),
('serialnumber', '', 'hostdata'),
('hostdata', '', 'hostdata'),
('zvdk', '', 'hostdata'),
('captcha_selection', '2', 'default'),
('owncaptcha_calculationtype', '1', 'default'),
('owncaptcha_totaloperand', '2', 'default'),
('owncaptcha_subtractionans', '1', 'default'),
('new_ticket_message', '', 'default'),
('tve_ssl','2','ticketviaemail'), 
('tve_hostportnumber','','ticketviaemail'), 
('maximum_open_tickets','100','default'), 
('ticket_priority_user','1','email'), 
('ticket_priority_admin','1','email'), 
('ticket_priority_staff','1','email');

CREATE TABLE IF NOT EXISTS `#__js_ticket_departments` (
	`id` int(11) NOT NULL AUTO_INCREMENT, 
	`emailtemplateid` int(11) DEFAULT NULL, 
	`emailid` int(11) DEFAULT NULL, 
	`autoresponceemailid` int(11) DEFAULT NULL, 
	`managerid` int(11) DEFAULT NULL, 
	`departmentname` varchar(32) DEFAULT NULL, 
	`departmentsignature` text, 
	`ispublic` tinyint(1) DEFAULT NULL, 
	`isdefault` tinyint(1) DEFAULT NULL, 
	`ticketautoresponce` tinyint(1) DEFAULT NULL, 
	`messageautoresponce` tinyint(1) DEFAULT NULL, 
	`canappendsignature` tinyint(1) DEFAULT NULL, 
	`update` datetime DEFAULT NULL, 
	`created` datetime DEFAULT NULL, 
	`status` tinyint(1) DEFAULT NULL, 
	PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

INSERT INTO `#__js_ticket_departments` VALUES (1,NULL,1,NULL,NULL,'Support','--Support Signature--',1,1,0,0,1,now(),'0000-00-00 00:00:00',1);

CREATE TABLE IF NOT EXISTS `#__js_ticket_email` (
	`id` int(11) NOT NULL AUTO_INCREMENT, 
	`autoresponce` tinyint(1) DEFAULT NULL, 
	`priorityid` int(11) DEFAULT NULL, 
	`departmentid` int(11) DEFAULT NULL, 
	`email` varchar(125) DEFAULT NULL, 
	`name` varchar(32) DEFAULT NULL, 
	`uid` int(11) DEFAULT NULL, 
	`password` varchar(125) DEFAULT NULL COMMENT '	', 
	`status` tinyint(1) DEFAULT NULL, 
	`mailhost` varchar(125) DEFAULT NULL, 
	`mailprotocol` enum('pop','map') DEFAULT NULL, 
	`mailencryption` enum('NONE','SSL') DEFAULT NULL, 
	`mailport` smallint(6) DEFAULT NULL, 
	`mailfetchfrequency` tinyint(3) DEFAULT NULL, 
	`mailfetchmaximum` tinyint(4) DEFAULT NULL, 
	`maildeleted` tinyint(1) DEFAULT NULL, 
	`mailerrors` tinyint(3) DEFAULT NULL, 
	`maillasterror` datetime DEFAULT NULL, 
	`maillastfetch` datetime DEFAULT NULL, 
	`smtpactive` tinyint(1) DEFAULT NULL, 
	`smtphost` varchar(125) DEFAULT NULL, 
	`smtpport` smallint(6) DEFAULT NULL, 
	`smtpsecure` tinyint(1) DEFAULT NULL, 
	`smtpauthencation` tinyint(1) DEFAULT NULL, 
	`created` datetime DEFAULT NULL, 
	`update` datetime DEFAULT NULL, 
	PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `#__js_ticket_emailtemplates` (
	`id` int(11) NOT NULL AUTO_INCREMENT, 
	`templatefor` varchar(50) DEFAULT NULL, 
	`title` varchar(50) DEFAULT NULL, 
	`subject` varchar(255) DEFAULT NULL, 
	`body` text, 
	`created` datetime DEFAULT NULL, 
	`status` tinyint(1) DEFAULT NULL, 
	PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=25 DEFAULT CHARSET=utf8;

INSERT INTO `#__js_ticket_emailtemplates` VALUES
(1, 'ticket-new', '', 'JS Support Ticket: New Ticket Received', '<p >Dear {USERNAME},</p>\r\n<p >Your support ticket <strong>{SUBJECT}</strong> has been submitted. We try to reply to all tickets as soon as possible, usually within 24 hours.</p>\r\n<p >Your tracking ID: {TRACKINGID}</p>\r\n<p >Your Email ID: {EMAIL}</p>\r\n<p >Ticket message: {MESSAGE}</p>\r\n<p >You can view the status of your ticket here:<br />{TICKETURL}</p>\r\n<p >You will receive an e-mail notification when our staff replies to your ticket.</p>\r\n<p ><span style="color: red;"><strong>*DO NOT REPLY TO THIS E-MAIL*</strong></span><br />This is an automated e-mail message sent from our support system. Do not reply to this e-mail as we wonot receive your reply!</p>', '2012-07-21 11:09:00', 1),
(6, 'reassign-tk', NULL, 'JS Support Ticket: Reassign Tickets', '<p >Sucess: Ticket Reassign</p>\r\n<p >Ticket Subject : {SUBJECT}</p>\r\n<p >Your ticket has been successfully Reassign! Ticket ID:{TRACKINGID} is Reassign to Staff Member:{STAFF_MEMBER_TITLE}</p>\r\n<p >You can manage this ticket here</p>\r\n<p >{TICKETURL}</p>\r\n<p ><span style="color: red;"><strong>*DO NOT REPLY TO THIS E-MAIL*</strong></span><br />This is an automated e-mail message sent from our support system. Do not reply to this e-mail as we wonot receive your reply!</p>', '2012-07-22 07:17:43', NULL),
(7, 'close-tk', NULL, 'JS Support Ticket:  Close Tickets', '<p >Ticket Close</p>\r\n<p >Ticket Subject : {SUBJECT}</p>\r\n<p >Ticket ID:{TRACKINGID} is Closed.</p>\r\n<p >You can manage this ticket here</p>\r\n<p >{TICKETURL}</p>\r\n<p ><span style="color: red;"><strong>*DO NOT REPLY TO THIS E-MAIL*</strong></span><br />This is an automated e-mail message sent from our support system. Do not reply to this e-mail as we wonot receive your reply!</p>', '2012-07-22 07:17:54', NULL),
(8, 'delete-tk', NULL, 'JS Support Ticket:  Delete Ticket', '<p >Ticket Deleted</p>\r\n<p >Ticket Subject : {SUBJECT}</p>\r\n<p >Ticket ID:{TRACKINGID} is Deleted.</p>\r\n<p ><span style="color: red;"><strong>*DO NOT REPLY TO THIS E-MAIL*</strong></span><br />This is an automated e-mail message sent from our support system. Do not reply to this e-mail as we wonot receive your reply!</p>', '2012-07-22 07:18:05', NULL),
(9, 'moverdue-tk', NULL, 'JS Support Ticket:  Ticket Mark Overdue ', '<p >Hi,</p>\r\n<p >Ticket Mark Overdue</p>\r\n<p >Ticket Subject : {SUBJECT}</p>\r\n<p >Ticket ID:{TRACKINGID} is Markoverdue.</p>\r\n<p >You can manage this ticket here</p>\r\n<p >{TICKETURL}</p>\r\n<p ><span style="color: red;"><strong>*DO NOT REPLY TO THIS E-MAIL*</strong></span><br />This is an automated e-mail message sent from our support system. Do not reply to this e-mail as we wonot receive your reply!</p>', '2012-07-22 07:18:12', NULL),
(10, 'banemail-tk', '', 'JS Support Ticket:  Ban new email', '<p >Hi,</p>\r\n<p >Email Baned</p>\r\n<p >This email {EMAIL_ADDRESS} is Baned.</p>\r\n<p ><span style="color: red;"><strong>*DO NOT REPLY TO THIS E-MAIL*</strong></span><br />This is an automated e-mail message sent from our support system. Do not reply to this e-mail as we wonot receive your reply!</p>', '2012-07-22 07:18:20', NULL),
(11, 'deptrans-tk', NULL, 'JS Support Ticket:  Ticket transfer to department {DEPARTMENT_TITLE}', '<p >Ticket transfer to department</p>\r\n<p >Ticket Subject : {SUBJECT}</p>\r\n<p >Ticket ID: {TRACKINGID} is transfer to department {DEPARTMENT_TITLE}.</p>\r\n<p ><span style="color: red;"><strong>*DO NOT REPLY TO THIS E-MAIL*</strong></span><br />This is an automated e-mail message sent from our support system. Do not reply to this e-mail as we wonot receive your reply!</p>', '2012-07-22 07:18:29', NULL),
(12, 'banemailcloseticket-tk', NULL, 'JS Support Ticket: Email baned and ticket close', '<p >Email Baned and ticket close</p>\r\n<p >Ticket Subject : {SUBJECT}</p>\r\n<p >This email {EMAIL_ADDRESS} is Baned and ticket ID:{TICKETID} is closed.</p>\r\n<p ><span style="color: red;"><strong>*DO NOT REPLY TO THIS E-MAIL*</strong></span><br />This is an automated e-mail message sent from our support system. Do not reply to this e-mail as we wonot receive your reply!</p>', '2012-07-22 07:18:37', NULL),
(13, 'unbanemail-tk', NULL, 'JS Support Ticket:  Email Unbaneded', '<p >Email Unbaned</p>\r\n<p >This email {EMAIL_ADDRESS} is Unbaned</p>\r\n<p ><span style="color: red;"><strong>*DO NOT REPLY TO THIS E-MAIL*</strong></span><br />This is an automated e-mail message sent from our support system. Do not reply to this e-mail as we wonot receive your reply!</p>', '2012-07-22 07:18:44', NULL),
(14, 'reply-tk', NULL, 'JS Support Ticket:  Ticket Reply', '<p >Hello,</p>\r\n<p >A new reply of ticket <strong>{SUBJECT} </strong>has been submitted.</p>\r\n<p >User Name: {USERNAME}</p>\r\n<p >Tracking ID: {TRACKINGID}</p>\r\n<p >Email: {EMAIL}</p>\r\n<p >Message: {MESSAGE}</p>\r\n<p >You can manage this ticket here:<br />{TICKETURL}</p>\r\n<p ><span style="color: red;"><strong>*DO NOT REPLY TO THIS E-MAIL*</strong></span><br />This is an automated e-mail message sent from our support system. Do not reply to this e-mail as we wonot receive your reply!</p>', '2012-07-22 07:19:08', NULL),
(15, 'responce-tk', NULL, 'JS Support Ticket:  Staff reply to your ticket', '<p >Hello,</p>\r\n<p >Staff just reply of your ticket <strong>{SUBJECT}</strong>.</p>\r\n<p >User Name: {USERNAME}</p>\r\n<p >Tracking ID: {TRACKINGID}</p>\r\n<p >Email: {EMAIL}</p>\r\n<p >Message: {MESSAGE}</p>\r\n<p >You can manage this ticket here:<br />{TICKETURL}</p>\r\n<p ><span style="color: red;"><strong>*DO NOT REPLY TO THIS E-MAIL*</strong></span><br />This is an automated e-mail message sent from our support system. Do not reply to this e-mail as we wonot receive your reply!</p>', '2012-07-22 07:18:52', NULL),
(16, 'ticket-staff', '', 'JS Support Ticket: New Tickets', '<p >Sucess: Ticket Submitted</p>\r\n<p >New ticket <strong>{SUBJECT}</strong> has been submitted with the following details.</p>\r\n<p >Tracking ID: {TRACKINGID}</p>\r\n<p >Email ID: {EMAIL}</p>\r\n<p >Ticket message: {MESSAGE}</p>\r\n<p >Help Topic: {HELP_TOPIC}</p>\r\n<p >You can view the status of your ticket here:<br />{TICKETURL}</p>\r\n<p >You will receive an e-mail notification when our staff replies to your ticket.</p>\r\n<p ><span style="color: red;"><strong>*DO NOT REPLY TO THIS E-MAIL*</strong></span><br />This is an automated e-mail message sent from our support system. Do not reply to this e-mail as we wonot receive your reply!</p>', '2012-07-22 06:43:31', NULL),
(17, 'banemail-trtk', NULL, 'JS Support Ticket: Ban emaild tryto create new ticket', '<p >Hello Admin ,</p>\r\n<p >This email {EMAIL_ADDRESS} is baned and try open new ticket .</p>\r\n<p ><span style="color: red;"><strong>*DO NOT REPLY TO THIS E-MAIL*</strong></span><br />This is an automated e-mail message sent from our support system. Do not reply to this e-mail as we wonot receive your reply!</p>', '2012-07-22 07:19:19', NULL),
(18, 'ticket-new-admin', '', 'JS Support Ticket: New Tickets Received', '<p >Hello,</p>\r\n<p >A new support ticket <strong>{SUBJECT}</strong> has been submitted. Ticket details.</p>\r\n<p >Tracking ID: {TRACKINGID}</p>\r\n<p >Email ID: {EMAIL}</p>\r\n<p >Ticket message: {MESSAGE}</p>\r\n<p >You can manage this ticket here:<br />{TICKETURL}</p>\r\n<p ><span style="color: #ff0000;"><strong>*DO NOT REPLY TO THIS E-MAIL*</strong></span><br />This is an automated e-mail message sent from our support system. Do not reply to this e-mail as we wonot receive your reply!</p>', '2012-07-21 11:08:28', 1),
(2, 'department-new', NULL, 'JS Support Ticket :  New Department {DEPARTMENT_TITLE} has beed received', '<p>Hello Admin ,</p>\r\n<p>We receive new department.</p>\r\n<p><span style="color: red;"><strong>*DO NOT REPLY TO THIS E-MAIL*</strong></span><br />This is an automated e-mail message sent from our support system. Do not reply to this e-mail as we wonot receive your reply!</p>', '2012-07-22 07:15:12', NULL),
(3, 'group-new', NULL, 'JS Support Ticket :  New Group {GROUP_TITLE} has beed received', '<p>Hello Admin ,</p>\r\n<p>We receive new group.</p>\r\n<p><span style="color: red;"><strong>*DO NOT REPLY TO THIS E-MAIL*</strong></span><br />This is an automated e-mail message sent from our support system. Do not reply to this e-mail as we wonot receive your reply!</p>', '2012-07-22 07:17:17', NULL),
(4, 'staff-new', NULL, 'JS Support Ticket:  New Staff Member {STAFF_MEMBER_TITLE} has beed received', '<p >Hello Admin ,</p>\r\n<p >We receive new staff member.</p>\r\n<p ><span style="color: red;"><strong>*DO NOT REPLY TO THIS E-MAIL*</strong></span><br />This is an automated e-mail message sent from our support system. Do not reply to this e-mail as we wonot receive your reply!</p>', '2012-07-22 07:17:26', NULL),
(5, 'helptopic-new', NULL, 'JS Support Ticket : New Help Topic {HELPTOPIC_TITLE} has beed received', '<p >Hello Admin ,</p>\r\n<p >We receive new help topic {HELPTOPIC_TITLE} of department {DEPARTMENT_TITLE}.</p>\r\n<p ><span style="color: red;"><strong>*DO NOT REPLY TO THIS E-MAIL*</strong></span><br />This is an automated e-mail message sent from our support system. Do not reply to this e-mail as we wonot receive your reply!</p>', '2012-07-22 07:17:34', NULL),
(19, 'lock-tk', NULL, 'JS Support Ticket :  Ticket {TRACKINGID} has been locked', '<p >Dear {USERNAME} ,</p>\r\n<p >Your Ticket {TRACKINGID} has been locked.</p>\r\n<p >Username : {USERNAME}<br />Subject : {SUBJECT}<br />Ticket ID : {TRACKINGID}<br />Email : {EMAIL}</p>\r\n<p >You can manage ticket here {TICKETURL}</p>\r\n<p ><span style="color: red;"><strong>*DO NOT REPLY TO THIS E-MAIL*</strong></span><br />This is an automated e-mail message sent from our support system. Do not reply to this e-mail as we wonot receive your reply!</p>', '2012-07-22 07:18:12', NULL),
(20, 'unlock-tk', NULL, 'JS Support Ticket :  Ticket {TRACKINGID} has been unlocked', '<p >Dear {USERNAME} ,</p>\r\n<p >Your Ticket {TRACKINGID} has been unlocked.</p>\r\n<p >Username : {USERNAME}<br />Subject : {SUBJECT}<br />Ticket ID : {TRACKINGID}<br />Email : {EMAIL}</p>\r\n<p >You can manage ticket here {TICKETURL}</p>\r\n<p ><span style="color: red;"><strong>*DO NOT REPLY TO THIS E-MAIL*</strong></span><br />This is an automated e-mail message sent from our support system. Do not reply to this e-mail as we wonot receive your reply!</p>', '2012-07-22 07:18:12', NULL),
(21, 'markprgs-tk', NULL, 'JS Support Ticket:  Yout ticket mark in progress', '<p >Ticket Mark in progress</p>\r\n<p >Ticket Subject : {SUBJECT}</p>\r\n<p >Ticket ID:{TRACKINGID} is Mark in progress.</p>\r\n<p >You can manage this ticket here</p>\r\n<p >{TICKETURL}</p>\r\n<p ><span style="color: red;"><strong>*DO NOT REPLY TO THIS E-MAIL*</strong></span><br />This is an automated e-mail message sent from our support system. Do not reply to this e-mail as we wonot receive your reply!</p>', '2012-07-22 07:18:12', NULL),
(22, 'pchnge-tk', NULL, 'JS Support Ticket:  Your ticket priority is change', '<p >Ticket priority is changed</p>\r\n<p >Ticket Subject : {SUBJECT}</p>\r\n<p >Ticket ID: {TRACKINGID} is priority changed and new priority and new priority {PRIORITY_TITLE}.</p>\r\n<p >You can manage this ticket here</p>\r\n<p >{TICKETURL}</p>\r\n<p ><span style="color: red;"><strong>*DO NOT REPLY TO THIS E-MAIL*</strong></span><br />This is an automated e-mail message sent from our support system. Do not reply to this e-mail as we wonot receive your reply!</p>', '2012-07-22 07:18:12', NULL),
(23, 'mlnew-tk', NULL, 'JS Support Ticket:  New mail has been sent by {STAFF_MEMBER_NAME}', '<p>Internal Mail</p>\r\n<p>New internal mail received.</p>\r\n<p>You can manage this mail here</p>\r\n<p>{TICKETURL}</p>\r\n<p><span style=\"color: red;\"><strong>*DO NOT REPLY TO THIS E-MAIL****************</strong></span><br />This is an automated e-mail message sent from our support system. Do not reply to this e-mail as we wonot receive your reply!</p>', '2012-07-22 07:18:12', NULL),
(24, 'mlrep-tk', NULL, 'JS Support Ticket:  New reply has been sent by {STAFF_MEMBER_NAME}', '<p >New reply has been sent by the {STAFF_MEMBER_NAME}</p>\r\n<p >Mail Subject : {SUBJECT}</p>\r\n<p >Message : {MESSAGE}</p>\r\n<p ><span style="color: red;"><strong>*DO NOT REPLY TO THIS E-MAIL*</strong></span><br />This is an automated e-mail message sent from our support system. Do not reply to this e-mail as we wonot receive your reply!</p>', '2012-07-22 07:18:12', NULL),
(25, 'ticket-staff', '', 'JS Support Ticket: New Ticket', 'Sucess: Ticket Submitted\r\n\r\nNew ticket <strong>{SUBJECT}</strong> has been submitted with the following details.\r\n\r\nTracking ID: {TRACKINGID}\r\n\r\nEmail ID: {EMAIL}\r\n\r\nTicket message: {MESSAGE}\r\n\r\nHelp Topic: {HELP_TOPIC}\r\n\r\nYou can view the status of your ticket here:\r\n{TICKETURL}\r\n\r\nYou will receive an e-mail notification when our staff replies to your ticket.\r\n\r\n<span style="color: red;"><strong>*DO NOT REPLY TO THIS E-MAIL*</strong></span>\r\nThis is an automated e-mail message sent from our support system. Do not reply to this e-mail as we wonot receive your reply!', '2012-07-21 11:09:00', 1);

CREATE TABLE IF NOT EXISTS `#__js_ticket_priorities` (
	`id` int(11) NOT NULL AUTO_INCREMENT, 
	`priority` varchar(60) DEFAULT NULL, 
	`prioritycolour` varchar(7) DEFAULT NULL, 
	`priorityurgency` int(1) DEFAULT NULL, 
	`ispublic` varchar(45) DEFAULT NULL, 
	`isdefault` tinyint(1) DEFAULT NULL, 
	`status` tinyint(4) NOT NULL DEFAULT '0', 
	PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

INSERT INTO `#__js_ticket_priorities` VALUES (1,'Normal','#00a650',NULL,'1',1,1),
(2,'Low','#00aeef',NULL,'1',0,1),
(3,'High','#ee1d24',NULL,'1',0,1);

CREATE TABLE IF NOT EXISTS `#__js_ticket_replies` (
	`id` int(11) NOT NULL AUTO_INCREMENT, 
	`ticketid` int(11) DEFAULT NULL, 
	`name` varchar(50) DEFAULT NULL, 
	`message` text, 
	`staffid` int(11) DEFAULT NULL, 
	`rating` enum('1','5') DEFAULT NULL, 
	`status` tinyint(1) DEFAULT NULL, 
	`created` datetime DEFAULT NULL, 
	`ticketviaemail` tinyint(1) NOT NULL, 
	PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `#__js_ticket_system_errors` (
	`id` int(11) NOT NULL AUTO_INCREMENT, 
	`uid` int(11) DEFAULT NULL, 
	`error` text, 
	`isview` tinyint(1) DEFAULT '0', 
	`created` datetime DEFAULT NULL, 
	PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `#__js_ticket_tickets` (
	`id` int(11) NOT NULL AUTO_INCREMENT, 
	`uid` int(11) DEFAULT NULL, 
	`ticketid` varchar(11) DEFAULT NULL, 
	`departmentid` int(11) DEFAULT NULL, 
	`priorityid` int(11) DEFAULT NULL, 
	`staffid` int(11) DEFAULT NULL, 
	`email` varchar(255) DEFAULT NULL, 
	`name` varchar(100) DEFAULT NULL, 
	`subject` varchar(255) DEFAULT NULL, 
	`message` text, 
	`helptopicid` int(11) DEFAULT NULL, 
	`phone` varchar(16) DEFAULT NULL, 
	`phoneext` varchar(8) DEFAULT NULL, 
	`status` tinyint(1) DEFAULT NULL, 
	`isoverdue` tinyint(1) DEFAULT NULL, 
	`isanswered` tinyint(1) NOT NULL DEFAULT '0', 
	`duedate` datetime DEFAULT NULL, 
	`reopened` datetime DEFAULT NULL, 
	`closed` datetime DEFAULT NULL, 
	`lastreply` datetime DEFAULT NULL, 
	`created` datetime DEFAULT NULL, 
	`update` datetime DEFAULT NULL, 
	`lock` tinyint(4) NOT NULL DEFAULT '0', 
	`ticketviaemail` tinyint(1) NOT NULL, 
	PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `#__js_ticket_userfield_data` (
	`id` int(10) unsigned NOT NULL AUTO_INCREMENT, 
	`referenceid` int(11) NOT NULL, 
	`field` int(10) unsigned DEFAULT NULL, 
	`data` varchar(1000) DEFAULT NULL, 
	PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `#__js_ticket_userfields` (
	`id` int(11) NOT NULL AUTO_INCREMENT, 
	`name` varchar(50) NOT NULL DEFAULT '', 
	`title` varchar(255) NOT NULL, 
	`description` mediumtext, 
	`type` varchar(50) NOT NULL DEFAULT '', 
	`maxlength` int(11) DEFAULT NULL, 
	`size` int(11) DEFAULT NULL, 
	`required` tinyint(4) DEFAULT '0', 
	`ordering` int(11) DEFAULT NULL, 
	`cols` int(11) DEFAULT NULL, 
	`rows` int(11) DEFAULT NULL, 
	`value` varchar(50) DEFAULT NULL, 
	`default` int(11) DEFAULT NULL, 
	`published` tinyint(1) NOT NULL DEFAULT '1', 
	`fieldfor` tinyint(2) NOT NULL DEFAULT '0', 
	`readonly` tinyint(1) NOT NULL DEFAULT '0', 
	`calculated` tinyint(1) NOT NULL DEFAULT '0', 
	`sys` tinyint(4) NOT NULL DEFAULT '0', 
	`params` mediumtext, 
	PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `#__js_ticket_userfieldvalues` (
	`id` int(11) NOT NULL AUTO_INCREMENT, 
	`field` int(11) NOT NULL DEFAULT '0', 
	`fieldtitle` varchar(255) NOT NULL DEFAULT '', 
	`fieldvalue` varchar(255) NOT NULL, 
	`ordering` int(11) NOT NULL DEFAULT '0', 
	`sys` tinyint(4) NOT NULL DEFAULT '0', 
	PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `#__js_ticket_fieldsordering` (
	`id` int(11) NOT NULL AUTO_INCREMENT, 
	`field` varchar(50) NOT NULL, 
	`fieldtitle` varchar(50) DEFAULT NULL, 
	`ordering` int(11) DEFAULT NULL, 
	`section` varchar(20) DEFAULT NULL, 
	`fieldfor` tinyint(2) DEFAULT NULL, 
	`published` tinyint(1) DEFAULT NULL, 
	`sys` tinyint(1) NOT NULL, 
	`cannotunpublish` tinyint(1) NOT NULL, 
	`required` tinyint(1) NOT NULL DEFAULT '0', 
	PRIMARY KEY (`id`), KEY `fieldordering_filedfor` (`fieldfor`) ) 
ENGINE=MyISAM AUTO_INCREMENT=15 DEFAULT CHARSET=utf8;
INSERT INTO `#__js_ticket_fieldsordering` VALUES (1,'emailaddress','Email Address',1,'10',1,1,0,1,1), (2, 'users', 'User', 2, '10', 1, 1, 0, 0, 0), (3,'fullname','Full Name',4,'10',1,1,0,1,1), (4,'phone','Phone',5,'10',1,1,0,0,0), (5,'department','Department',6,'10',1,1,0,0,0), (6,'helptopic','Help Topic',7,'10',1,1,0,0,0), (7,'priority','Priority',3,'10',1,1,0,1,1), (8,'subject','Subject',9,'10',1,1,0,1,1), (9,'premade','Premade',8,'10',1,1,0,0,0), (10,'issuesummary','Issue Summary',10,'10',1,1,0,1,1), (11,'attachments','Attachments',11,'10',1,1,0,0,0), (12,'internalnotetitle','Internal Note Title',12,'10',1,1,0,0,1), (13,'assignto','Assign To',13,'10',1,1,0,0,0), (14,'duedate','Due Date',14,'10',1,1,0,0,0), (15, 'status', 'Status', 15, '10', 1, 1, 0, 0, 0);

