Files
itflow/admin/database_updates/3.1.9.php
johnnyq 3f90d2b0d0 Ticket templates stage 1: templates now set up the whole ticket - category, priority, billable, agent, due time and tags (migration 3.1.9 adds them, the ticket_template_tags table and tickets.ticket_template_id) - and fill [Client], [Contact], [Asset], [Site], [Agent], [Project], [Ticket], [Date], [Month], [Quarter] and [Year] in the subject, details and tasks when a ticket is raised, leaving other bracketed text for whoever picks it up; tickets remember the template they came from and each template shows how many tickets it raised, how many are open and when it was last used; the template picker fills New Ticket, the New Tickets windows on the assets and clients lists and recurring tickets, and project templates use each template's setup and agent; Admin > Ticket Templates rebuilt with search, Current/Archived, Copy, Archive/Restore and New ticket from it, and each template gets a page showing the ticket it starts, its tasks in drag-to-sort order with time estimates, what it sets up, its placeholders and the tickets, recurring tickets and project templates that use it; template handling moved into functions/ticket_template.php with ticketTemplateFinish, tagKeepIds and tagIdsFromValues split out of tagSetForRecord, and template task editing moved to admin/post; fixes editing a template task moving it to the top of the list, client bulk tickets skipping the template's tasks and time estimates, and the client bulk window not validating the agent, priority and category, and adds an option there to raise each client's ticket for its primary contact; changelog updated
2026-10-18 00:01:43 -04:00

31 lines
1.8 KiB
PHP

<?php
/*
* ITFlow - Database update to version 3.1.9 (from 3.1.8)
* Included by admin/database_updates.php - do not access directly
*/
defined('FROM_DB_UPDATER') || die("Direct file access is not allowed");
// A ticket template sets up the whole ticket: its category, priority,
// billing, who it goes to and when it is due, and its tags. NULL priority
// or billable, 0 category, agent or due: the template leaves that alone.
mysqli_query($mysqli, "ALTER TABLE `ticket_templates`
ADD `ticket_template_category_id` int(11) NOT NULL DEFAULT 0 AFTER `ticket_template_details`,
ADD `ticket_template_priority` varchar(20) DEFAULT NULL AFTER `ticket_template_category_id`,
ADD `ticket_template_billable` tinyint(1) DEFAULT NULL AFTER `ticket_template_priority`,
ADD `ticket_template_assigned_to` int(11) NOT NULL DEFAULT 0 AFTER `ticket_template_billable`,
ADD `ticket_template_due_hours` int(11) NOT NULL DEFAULT 0 AFTER `ticket_template_assigned_to`");
mysqli_query($mysqli, "CREATE TABLE `ticket_template_tags` (
`ticket_template_id` int(11) NOT NULL,
`tag_id` int(11) NOT NULL,
PRIMARY KEY (`ticket_template_id`,`tag_id`),
KEY `tag_id` (`tag_id`),
CONSTRAINT `ticket_template_tags_ibfk_1` FOREIGN KEY (`ticket_template_id`) REFERENCES `ticket_templates` (`ticket_template_id`) ON DELETE CASCADE,
CONSTRAINT `ticket_template_tags_ibfk_2` FOREIGN KEY (`tag_id`) REFERENCES `tags` (`tag_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci");
// Which template a ticket was raised from - for the template's use, from now on
mysqli_query($mysqli, "ALTER TABLE `tickets` ADD `ticket_template_id` int(11) NOT NULL DEFAULT 0 AFTER `ticket_recurring_ticket_id`, ADD KEY `ticket_template_id` (`ticket_template_id`)");