Ticket Statuses - the steps a ticket goes through. The five ITFlow * has (New, Open, On Hold, Resolved, Closed) and your own - Waiting on * Vendor, Scheduled, Parts Ordered. Each row shows the status as it looks, * what it is for, how many tickets are in it, whether the SLA's resolution * clock runs in it and what a client's reply does to a ticket in it. In use * are in the order the pickers and the board show them, and can be dragged * into another; switched off ones are kept, but can't be picked. The work is * in functions/ticket_status.php; the handlers are admin/post/ticket_status.php. */ // Default Column Sortby Filter - the order the pickers and the board show them in $sort = "ticket_status_order"; $order = "ASC"; require_once "includes/inc_all_admin.php"; $builtins = ticketStatusBuiltIns(); $views = [ '' => ['label' => 'In use', 'icon' => 'fa-check-circle', 'where' => 'ticket_status_active = 1', 'title' => 'In the pickers and on the board'], 'off' => ['label' => 'Switched off', 'icon' => 'fa-power-off', 'where' => 'ticket_status_active = 0', 'title' => 'Kept, but can\'t be picked'], ]; $show = (string) ($_GET['show'] ?? ''); $show = isset($views[$show]) ? $show : ''; // Only these sort - an unknown column would take the page down $sortable_columns = [ 'ticket_status_order' => "ticket_status_order $order, ticket_status_id ASC", 'ticket_status_name' => "ticket_status_name $order", 'tickets' => "n_tickets $order, ticket_status_order ASC", 'ticket_status_pauses_sla' => "ticket_status_pauses_sla $order, ticket_status_order ASC", ]; if (!isset($sortable_columns[$sort])) { $sort = 'ticket_status_order'; } $filters = "(ticket_status_name LIKE '%$q%'" . (ticketStatusColumnsReady() ? " OR ticket_status_description LIKE '%$q%'" : '') . ")"; $sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS " . ticketStatusColumnsSql() . ", (SELECT COUNT(*) FROM tickets WHERE ticket_status = ticket_status_id AND ticket_archived_at IS NULL) AS n_tickets FROM ticket_statuses WHERE $filters AND {$views[$show]['where']} ORDER BY {$sortable_columns[$sort]} LIMIT $record_from, $record_to"); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); $counts = mysqli_fetch_row(mysqli_query($mysqli, "SELECT " . implode(', ', array_map(function ($view) { return "COALESCE(SUM({$view['where']}), 0)"; }, $views)) . " FROM ticket_statuses WHERE $filters")); $view_counts = array_combine(array_keys($views), $counts); // Dragging into order: the ones in use, in their order, with nothing searched $can_reorder = $show === '' && $sort === 'ticket_status_order' && $order === 'ASC' && $q === '' && $num_rows[0] > 1; $sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { return '' . $label . ($sort === $column ? " $order_icon" : '') . ''; }; $pill_url = function ($view) { return '?' . http_build_query(array_filter(['q' => $_GET['q'] ?? '', 'show' => $view])); }; $csrf = $_SESSION['csrf_token']; ?>
| Order | = $sort_link('ticket_status_name', 'Status') ?> | = $sort_link('tickets', 'Tickets') ?> | = $sort_link('ticket_status_pauses_sla', 'SLA clock') ?> | When the client replies | |
|---|---|---|---|---|---|
|
= ticketStatusBadgeHtml($row['ticket_status_name'], $row['ticket_status_color'], 'list') ?>
Built in
= escapeHtml($about) ?>
= $clock_html ?>
= $reply_html ?>
|
= number_format($tickets) ?> 0 | = $clock_html . $fixed ?> | = $reply_html . $fixed ?> |
|