Ticket Templates - tickets ready to raise: a subject, details and * tasks, and how the ticket is set up (category, priority, billing, agent, due * time and tags). Each row shows what it sets up, its tasks and their time, * and how often it has been used. A template can be changed, copied as the * start of another, archived - kept for the recurring tickets and project * templates that use it, not offered for new tickets - or deleted. The work is * in functions/ticket_template.php; the handlers are admin/post/ticket_template.php. */ require_once "includes/inc_all_admin.php"; $show_archived = isset($_GET['archived']); $search = trim((string) ($_GET['q'] ?? '')); $search_sql = escapeSql($search); $templates = []; $sql = mysqli_query($mysqli, "SELECT ticket_templates.*, category_name, category_color, category_icon, user_name AS assignee_name, (SELECT COUNT(*) FROM task_templates WHERE task_template_ticket_template_id = ticket_templates.ticket_template_id) AS task_count, (SELECT COALESCE(SUM(task_template_completion_estimate), 0) FROM task_templates WHERE task_template_ticket_template_id = ticket_templates.ticket_template_id) AS task_minutes, (SELECT COUNT(*) FROM recurring_tickets WHERE recurring_ticket_ticket_template_id = ticket_templates.ticket_template_id) AS recurring_count, (SELECT COUNT(*) FROM project_template_ticket_templates WHERE project_template_ticket_templates.ticket_template_id = ticket_templates.ticket_template_id) AS project_count FROM ticket_templates LEFT JOIN categories ON category_id = ticket_template_category_id AND ticket_template_category_id > 0 LEFT JOIN users ON user_id = ticket_template_assigned_to AND ticket_template_assigned_to > 0 WHERE ticket_template_archived_at IS " . ($show_archived ? 'NOT NULL' : 'NULL') . " " . ($search !== '' ? "AND (ticket_template_name LIKE '%$search_sql%' OR ticket_template_description LIKE '%$search_sql%' OR ticket_template_subject LIKE '%$search_sql%')" : '') . " ORDER BY ticket_template_name ASC"); while ($row = mysqli_fetch_assoc($sql)) { $templates[intval($row['ticket_template_id'])] = $row; } $usage = ticketTemplateUsage(array_keys($templates)); $archived_count = intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT COUNT(*) FROM ticket_templates WHERE ticket_template_archived_at IS NOT NULL"))[0]); $tag_rows = []; $sql_tags = mysqli_query($mysqli, "SELECT ticket_template_id, tags.* FROM ticket_template_tags JOIN tags ON tags.tag_id = ticket_template_tags.tag_id ORDER BY tag_name"); while ($row = mysqli_fetch_assoc($sql_tags)) { $tag_rows[intval($row['ticket_template_id'])][] = $row; } // This page with some of its query changed - null drops a key $page_url = function (array $change = []) use ($show_archived, $search) { $query = array_merge(['q' => $search !== '' ? $search : null, 'archived' => $show_archived ? 1 : null], $change); return 'ticket_templates.php' . (($query = http_build_query(array_filter($query, function ($v) { return $v !== null; }))) ? "?$query" : ''); }; $csrf = $_SESSION['csrf_token']; ?>
A ticket ready to raise - its subject, details and tasks, and how it is set up. Pick one on New Ticket, when raising tickets for several assets or clients, and on recurring tickets; project templates raise theirs. [Client], [Contact], [Month] and the like are filled in when a ticket is raised.
| Template | Sets up | Tasks | Used | Action |
|---|---|---|---|---|
|
= $name ?>
= escapeHtml($row['ticket_template_description']) ?>
= escapeHtml($row['ticket_template_subject']) ?>
Archived = date('M j, Y', strtotime($row['ticket_template_archived_at'])) ?>
= $set_up ?>
= $used_html ?>
|
= $set_up !== '' ? $set_up : 'Just the subject and details' ?> |
= $task_count ?> task= $task_count === 1 ? '' : 's' ?>
= escapeHtml(ticketTemplateMinutesText($minutes)) ?>
None
|
= $used_html ?> |
|