mirror of
https://github.com/itflow-org/itflow
synced 2026-11-19 19:07:23 +00:00
Rebuild Admin > Ticket Statuses: list on the standard pattern with In use and Switched off tabs, search, sortable headers, ticket counts linking to the tickets, SLA clock and client-reply columns and drag ordering for the pickers and board; one New/Edit window with badge preview, colour swatches and a description shown on hover across the app; per-status choice of whether a client reply by email or portal moves the ticket back to Open or leaves it; switch off and delete move a status's tickets to a chosen status with ticket history and SLA sync, and clear canned responses that set it; built-in statuses keep their names, stay on and have fixed SLA and reply behaviour enforced server-side; badges use readable text colour; the tickets filter keeps a switched-off status; database 3.4.0 adds ticket_status_description and ticket_status_client_reply; new functions/ticket_status.php
This commit is contained in:
48
admin/database_updates/3.4.0.php
Normal file
48
admin/database_updates/3.4.0.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* ITFlow - Database update to version 3.4.0 (from 3.3.9)
|
||||
* Included by admin/database_updates.php - do not access directly
|
||||
*/
|
||||
|
||||
defined('FROM_DB_UPDATER') || die("Direct file access is not allowed");
|
||||
|
||||
$itflow_column = function ($table, $column) use ($mysqli) {
|
||||
$result = mysqli_query($mysqli, "SELECT 1 FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = '$table' AND COLUMN_NAME = '$column' LIMIT 1");
|
||||
return $result && mysqli_num_rows($result) > 0;
|
||||
};
|
||||
|
||||
// What a ticket status is for - shown when it is hovered, in the pickers and on the board
|
||||
if (!$itflow_column('ticket_statuses', 'ticket_status_description')) {
|
||||
mysqli_query($mysqli, "ALTER TABLE `ticket_statuses` ADD `ticket_status_description` varchar(255) DEFAULT NULL AFTER `ticket_status_color`");
|
||||
}
|
||||
|
||||
// What a client's reply does to a ticket in the status - 1 moves it back to Open (as every reply always has), 0 leaves it there
|
||||
if (!$itflow_column('ticket_statuses', 'ticket_status_client_reply')) {
|
||||
mysqli_query($mysqli, "ALTER TABLE `ticket_statuses` ADD `ticket_status_client_reply` tinyint(1) NOT NULL DEFAULT 1 AFTER `ticket_status_pauses_sla`");
|
||||
}
|
||||
|
||||
// The five built-in statuses say what they are for - only where nothing is written yet
|
||||
$itflow_descriptions = [
|
||||
1 => 'Just come in - nobody has picked it up yet.',
|
||||
2 => 'Being worked on.',
|
||||
3 => 'Waiting on someone else - the client, a vendor or a part.',
|
||||
4 => 'Fixed, and waiting to be closed - a reply from the client reopens it.',
|
||||
5 => 'Finished - it can\'t be replied to.',
|
||||
];
|
||||
foreach ($itflow_descriptions as $itflow_status_id => $itflow_description) {
|
||||
mysqli_query($mysqli, "UPDATE ticket_statuses SET ticket_status_description = '" . mysqli_real_escape_string($mysqli, $itflow_description) . "'
|
||||
WHERE ticket_status_id = $itflow_status_id AND (ticket_status_description IS NULL OR ticket_status_description = '')");
|
||||
}
|
||||
|
||||
// Number the statuses 1, 2, 3... in the order they already show in (most are all 0, and ties go by id),
|
||||
// so they can be dragged into another
|
||||
$itflow_position = 0;
|
||||
$itflow_statuses = mysqli_query($mysqli, "SELECT ticket_status_id FROM ticket_statuses ORDER BY ticket_status_order ASC, ticket_status_id ASC");
|
||||
while ($itflow_status = mysqli_fetch_row($itflow_statuses)) {
|
||||
$itflow_position++;
|
||||
mysqli_query($mysqli, "UPDATE ticket_statuses SET ticket_status_order = $itflow_position WHERE ticket_status_id = " . intval($itflow_status[0]));
|
||||
}
|
||||
|
||||
unset($itflow_column, $itflow_descriptions, $itflow_status_id, $itflow_description, $itflow_position, $itflow_statuses, $itflow_status);
|
||||
Reference in New Issue
Block a user