Keep a ticket's emails in one conversation: every client email about a ticket has the subject [TCK-123] and its subject and carries Message-ID, In-Reply-To and References, kept per ticket in ticket_mail_threads, and the email parser finds a reply's ticket by those headers first, then by the number in brackets with the prefix that ticket was given; one email goes to the contact with the watchers and colleagues copied in, switchable in Admin, Settings, Tickets; a client's reply by email, text or portal is passed on to the people following the ticket who weren't on it, by email only when it answers one of the ticket's emails; others in To and Cc on a client's or watcher's email become watchers, never your own domain or agents; the same email twice makes one ticket and a merged ticket's replies go to the ticket it went into; database 4.2.6; 26.12.3 changelog entries

This commit is contained in:
johnnyq
2026-11-30 13:08:24 -05:00
parent b208ed0069
commit 42ea7e58a5
27 changed files with 831 additions and 162 deletions

25
db.sql
View File

@@ -1762,12 +1762,14 @@ CREATE TABLE `email_queue` (
`email_status` tinyint(1) NOT NULL DEFAULT 0,
`email_recipient` varchar(255) NOT NULL,
`email_recipient_name` varchar(255) DEFAULT NULL,
`email_cc` text DEFAULT NULL,
`email_from` varchar(255) NOT NULL,
`email_from_name` varchar(255) NOT NULL,
`email_subject` varchar(255) NOT NULL,
`email_content` longtext NOT NULL,
`email_cal_str` text DEFAULT NULL,
`email_attachments` text DEFAULT NULL,
`email_headers` text DEFAULT NULL,
`email_queued_at` datetime NOT NULL DEFAULT current_timestamp(),
`email_failed_at` datetime DEFAULT NULL,
`email_error` varchar(500) DEFAULT NULL,
@@ -4114,6 +4116,8 @@ CREATE TABLE `settings` (
`config_sms_visit_reminder_hours` int(11) NOT NULL DEFAULT 24,
`config_sms_client_invoices` tinyint(1) NOT NULL DEFAULT 1,
`config_ticket_client_general_notifications` tinyint(1) NOT NULL DEFAULT 1,
`config_ticket_email_copy` tinyint(1) NOT NULL DEFAULT 1,
`config_ticket_email_relay` tinyint(1) NOT NULL DEFAULT 1,
`config_ticket_autoclose_hours` int(5) NOT NULL DEFAULT 72,
`config_ticket_new_ticket_notification_email` varchar(200) DEFAULT NULL,
`config_ticket_ai_triage` tinyint(1) NOT NULL DEFAULT 0,
@@ -4900,6 +4904,26 @@ CREATE TABLE `ticket_mail_choices` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `ticket_mail_threads`
--
DROP TABLE IF EXISTS `ticket_mail_threads`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `ticket_mail_threads` (
`mail_thread_id` int(11) NOT NULL AUTO_INCREMENT,
`mail_thread_ticket_id` int(11) NOT NULL,
`mail_thread_message_id` varchar(255) NOT NULL,
`mail_thread_ours` tinyint(1) NOT NULL DEFAULT 0,
`mail_thread_created_at` datetime NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`mail_thread_id`),
UNIQUE KEY `mail_thread_message_id` (`mail_thread_message_id`,`mail_thread_ticket_id`),
KEY `mail_thread_ticket_id` (`mail_thread_ticket_id`),
CONSTRAINT `ticket_mail_threads_ibfk_1` FOREIGN KEY (`mail_thread_ticket_id`) REFERENCES `tickets` (`ticket_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `ticket_reads`
--
@@ -5195,6 +5219,7 @@ CREATE TABLE `tickets` (
PRIMARY KEY (`ticket_id`),
KEY `ticket_response_due_at` (`ticket_response_due_at`),
KEY `ticket_resolution_due_at` (`ticket_resolution_due_at`),
KEY `ticket_number` (`ticket_number`),
KEY `ticket_client_id` (`ticket_client_id`,`ticket_archived_at`),
KEY `ticket_project_id` (`ticket_project_id`),
KEY `ticket_template_id` (`ticket_template_id`),