mirror of https://github.com/itflow-org/itflow
Updated ticket status color capabilities to use multiple color instead of a select few, added activate disable ticket statuses, fixed ticket status Left joins in a few more areas
This commit is contained in:
parent
912e2774f8
commit
f1833e1083
|
|
@ -27,7 +27,20 @@
|
|||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-paint-brush"></i></span>
|
||||
</div>
|
||||
<input type="color" class="form-control col-3" name="color" value="<?php echo $tag_color; ?>" required>
|
||||
<input type="color" class="form-control col-3" name="color" value="<?php echo $ticket_status_color; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Status <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-info-circle"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="status" required>
|
||||
<option <?php if ($ticket_status_active == 1) { echo "selected"; } ?> value="1">Active</option>
|
||||
<option <?php if ($ticket_status_active == 0) { echo "selected"; } ?> value="0">Disabled</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
<tr>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_status_name&order=<?php echo $disp; ?>">Name</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_status_color&order=<?php echo $disp; ?>">Color</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_status_arctive&order=<?php echo $disp; ?>">Status</a></th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
@ -62,15 +63,23 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
$ticket_status_id = intval($row['ticket_status_id']);
|
||||
$ticket_status_name = nullable_htmlentities($row['ticket_status_name']);
|
||||
$ticket_status_color = nullable_htmlentities($row['ticket_status_color']);
|
||||
$ticket_status_active = intval($row['ticket_status_active']);
|
||||
if ($ticket_status_active) {
|
||||
$ticket_status_display = "<div class='text-success text-bold'>Active</div>";
|
||||
} else {
|
||||
$ticket_status_display = "<div class='text-secondary'>Disabled</div>";
|
||||
}
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="#" data-toggle="modal" data-target="#editTicketStatusModal<?php echo $ticket_status_id; ?>">
|
||||
<span class="badge text-light p-2 mr-1 bg-<?php echo $ticket_status_color; ?>"><?php echo $ticket_status_name; ?></span>
|
||||
<?php echo $ticket_status_name; ?>
|
||||
</a>
|
||||
</td>
|
||||
<td><i class="fas fa-circle fa-2x text-<?php echo $ticket_status_color; ?>"></i></td>
|
||||
<td>
|
||||
<span class='badge badge-pill text-light p-2' style="background-color: <?php echo $ticket_status_color; ?>"><?php echo $ticket_status_name; ?></span>
|
||||
<td><?php echo $ticket_status_display; ?></td>
|
||||
<td>
|
||||
<?php if ( $ticket_status_id > 5 ) { ?>
|
||||
<div class="dropdown dropleft text-center">
|
||||
|
|
|
|||
|
|
@ -472,7 +472,7 @@ if (isset($_GET['asset_id'])) {
|
|||
<td><a href="ticket.php?ticket_id=<?php echo $ticket_id; ?>"><?php echo $ticket_subject; ?></a></td>
|
||||
<td><?php echo $ticket_priority_display; ?></td>
|
||||
<td>
|
||||
<span class="p-2 badge badge-<?php echo $ticket_status_color; ?>"><?php echo $ticket_status_name; ?></span>
|
||||
<span class='badge badge-pill text-light p-2' style="background-color: <?php echo $ticket_status_color; ?>"><?php echo $ticket_status_name; ?></span>
|
||||
</td>
|
||||
<td><?php echo $ticket_assigned_to_display; ?></td>
|
||||
<td><?php echo $ticket_updated_at_display; ?></td>
|
||||
|
|
|
|||
|
|
@ -53,7 +53,10 @@ if (isset($_GET['contact_id'])) {
|
|||
$software_count = mysqli_num_rows($sql_related_software);
|
||||
|
||||
// Related Tickets Query
|
||||
$sql_related_tickets = mysqli_query($mysqli, "SELECT * FROM tickets LEFT JOIN users on ticket_assigned_to = user_id WHERE ticket_contact_id = $contact_id ORDER BY ticket_id DESC");
|
||||
$sql_related_tickets = mysqli_query($mysqli, "SELECT * FROM tickets
|
||||
LEFT JOIN users ON ticket_assigned_to = user_id
|
||||
LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id
|
||||
WHERE ticket_contact_id = $contact_id ORDER BY ticket_id DESC");
|
||||
$ticket_count = mysqli_num_rows($sql_related_tickets);
|
||||
|
||||
?>
|
||||
|
|
@ -479,9 +482,11 @@ if (isset($_GET['contact_id'])) {
|
|||
$ticket_id = intval($row['ticket_id']);
|
||||
$ticket_prefix = nullable_htmlentities($row['ticket_prefix']);
|
||||
$ticket_number = intval($row['ticket_number']);
|
||||
$ticket_subject = nullable_htmlentities($row['ticket_subject']);
|
||||
$ticket_subject = intval($row['ticket_subject']);
|
||||
$ticket_priority = nullable_htmlentities($row['ticket_priority']);
|
||||
$ticket_status = nullable_htmlentities($row['ticket_status']);
|
||||
$ticket_status_name = nullable_htmlentities($row['ticket_status_name']);
|
||||
$ticket_status_color = nullable_htmlentities($row['ticket_status_color']);
|
||||
$ticket_created_at = nullable_htmlentities($row['ticket_created_at']);
|
||||
$ticket_updated_at = nullable_htmlentities($row['ticket_updated_at']);
|
||||
if (empty($ticket_updated_at)) {
|
||||
|
|
@ -495,14 +500,6 @@ if (isset($_GET['contact_id'])) {
|
|||
}
|
||||
$ticket_closed_at = nullable_htmlentities($row['ticket_closed_at']);
|
||||
|
||||
if ($ticket_status == "Open") {
|
||||
$ticket_status_display = "<span class='p-2 badge badge-primary'>$ticket_status</span>";
|
||||
} elseif ($ticket_status == "Working") {
|
||||
$ticket_status_display = "<span class='p-2 badge badge-success'>$ticket_status</span>";
|
||||
} else {
|
||||
$ticket_status_display = "<span class='p-2 badge badge-secondary'>$ticket_status</span>";
|
||||
}
|
||||
|
||||
if ($ticket_priority == "High") {
|
||||
$ticket_priority_display = "<span class='p-2 badge badge-danger'>$ticket_priority</span>";
|
||||
} elseif ($ticket_priority == "Medium") {
|
||||
|
|
@ -529,7 +526,7 @@ if (isset($_GET['contact_id'])) {
|
|||
<td><a href="ticket.php?ticket_id=<?php echo $ticket_id; ?>"><span class="badge badge-pill badge-secondary p-3"><?php echo "$ticket_prefix$ticket_number"; ?></span></a></td>
|
||||
<td><a href="ticket.php?ticket_id=<?php echo $ticket_id; ?>"><?php echo $ticket_subject; ?></a></td>
|
||||
<td><?php echo $ticket_priority_display; ?></td>
|
||||
<td><?php echo $ticket_status_display; ?></td>
|
||||
<td><span class='badge badge-pill text-light p-2' style="background-color: <?php echo $ticket_status_color; ?>"><?php echo $ticket_status_name; ?></span></td>
|
||||
<td><?php echo $ticket_assigned_to_display; ?></td>
|
||||
<td><?php echo $ticket_updated_at_display; ?></td>
|
||||
<td><?php echo $ticket_created_at; ?></td>
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ $total_scheduled_tickets = intval($row['total_scheduled_tickets']);
|
|||
|
||||
<!-- Ticket Status -->
|
||||
<td>
|
||||
<span class='p-2 badge badge-pill badge-<?php echo $ticket_status_color; ?>'><?php echo $ticket_status_name; ?></span>
|
||||
<span class='badge badge-pill text-light p-2' style="background-color: <?php echo $ticket_status_color; ?>"><?php echo $ticket_status_name; ?></span>
|
||||
</td>
|
||||
|
||||
<!-- Ticket Assigned agent -->
|
||||
|
|
|
|||
|
|
@ -644,12 +644,13 @@ if ($user_config_dashboard_technical_enable == 1) {
|
|||
$sql_your_tickets = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM tickets
|
||||
LEFT JOIN clients ON ticket_client_id = client_id
|
||||
LEFT JOIN contacts ON ticket_contact_id = contact_id
|
||||
WHERE ticket_assigned_to = $session_user_id
|
||||
AND ticket_closed_at IS NULL
|
||||
ORDER BY ticket_number DESC"
|
||||
);
|
||||
LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id
|
||||
LEFT JOIN clients ON ticket_client_id = client_id
|
||||
LEFT JOIN contacts ON ticket_contact_id = contact_id
|
||||
WHERE ticket_assigned_to = $session_user_id
|
||||
AND ticket_closed_at IS NULL
|
||||
ORDER BY ticket_number DESC"
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
|
|
@ -773,7 +774,8 @@ if ($user_config_dashboard_technical_enable == 1) {
|
|||
$ticket_subject = nullable_htmlentities($row['ticket_subject']);
|
||||
$ticket_priority = nullable_htmlentities($row['ticket_priority']);
|
||||
$ticket_status_id = intval($row['ticket_status']);
|
||||
$ticket_status_name = sanitizeInput(getTicketStatusName($row['ticket_status']));
|
||||
$ticket_status_name = nullable_htmlentities($row['ticket_status_name']);
|
||||
$ticket_status_color = nullable_htmlentities($row['ticket_status_color']);
|
||||
$ticket_created_at = nullable_htmlentities($row['ticket_created_at']);
|
||||
$ticket_created_at_time_ago = timeAgo($row['ticket_created_at']);
|
||||
$ticket_updated_at = nullable_htmlentities($row['ticket_updated_at']);
|
||||
|
|
@ -792,7 +794,7 @@ if ($user_config_dashboard_technical_enable == 1) {
|
|||
$contact_id = intval($row['ticket_contact_id']);
|
||||
$contact_name = nullable_htmlentities($row['contact_name']);
|
||||
|
||||
$ticket_status_color = getTicketStatusColor($ticket_status_id);
|
||||
|
||||
|
||||
if ($ticket_priority == "High") {
|
||||
$ticket_priority_color = "danger";
|
||||
|
|
@ -822,7 +824,9 @@ if ($user_config_dashboard_technical_enable == 1) {
|
|||
</td>
|
||||
<td><?php echo $contact_display; ?></td>
|
||||
<td><span class='p-2 badge badge-pill badge-<?php echo $ticket_priority_color; ?>'><?php echo $ticket_priority; ?></span></td>
|
||||
<td><span class='p-2 badge badge-pill badge-<?php echo $ticket_status_color; ?>'><?php echo $ticket_status_name; ?></span></td>
|
||||
<td>
|
||||
<span class='badge badge-pill text-light p-2' style="background-color: <?php echo $ticket_status_color; ?>"><?php echo $ticket_status_name; ?></span>
|
||||
</td>
|
||||
<td><?php echo $ticket_updated_at_display; ?></td>
|
||||
</tr>
|
||||
|
||||
|
|
|
|||
|
|
@ -1795,10 +1795,21 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
|
|||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.1.8'");
|
||||
}
|
||||
|
||||
// if (CURRENT_DATABASE_VERSION == '1.1.8') {
|
||||
// // Insert queries here required to update to DB version 1.1.9
|
||||
if (CURRENT_DATABASE_VERSION == '1.1.8') {
|
||||
// Update Ticket Status color to use colors to allow more predefined colors
|
||||
mysqli_query($mysqli, "UPDATE ticket_statuses SET ticket_status_color = '#dc3545' WHERE ticket_status_id = 1"); // New
|
||||
mysqli_query($mysqli, "UPDATE ticket_statuses SET ticket_status_color = '#007bff' WHERE ticket_status_id = 2"); // Open
|
||||
mysqli_query($mysqli, "UPDATE ticket_statuses SET ticket_status_color = '#28a745' WHERE ticket_status_id = 3"); // On Hold
|
||||
mysqli_query($mysqli, "UPDATE ticket_statuses SET ticket_status_color = '#343a40' WHERE ticket_status_id = 4"); // Auto Close
|
||||
mysqli_query($mysqli, "UPDATE ticket_statuses SET ticket_status_color = '#343a40' WHERE ticket_status_id = 5"); // Closed
|
||||
|
||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.1.9'");
|
||||
}
|
||||
|
||||
// if (CURRENT_DATABASE_VERSION == '1.1.9') {
|
||||
// // Insert queries here required to update to DB version 1.2.0
|
||||
// // Then, update the database to the next sequential version
|
||||
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.1.9");
|
||||
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.2.0");
|
||||
// }
|
||||
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -5,4 +5,4 @@
|
|||
* It is used in conjunction with database_updates.php
|
||||
*/
|
||||
|
||||
DEFINE("LATEST_DATABASE_VERSION", "1.1.8");
|
||||
DEFINE("LATEST_DATABASE_VERSION", "1.1.9");
|
||||
|
|
|
|||
2
db.sql
2
db.sql
|
|
@ -1881,4 +1881,4 @@ CREATE TABLE `vendors` (
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2024-03-31 13:55:08
|
||||
-- Dump completed on 2024-04-01 16:24:03
|
||||
|
|
|
|||
|
|
@ -220,8 +220,9 @@ if (isset($_POST['edit_ticket_status'])) {
|
|||
$ticket_status_id = intval($_POST['ticket_status_id']);
|
||||
$name = sanitizeInput($_POST['name']);
|
||||
$color = sanitizeInput($_POST['color']);
|
||||
$status = intval($_POST['status']);
|
||||
|
||||
mysqli_query($mysqli, "UPDATE ticket_statuses SET ticket_status_name = '$name', ticket_status_color = '$color' WHERE ticket_status_id = $ticket_status_id");
|
||||
mysqli_query($mysqli, "UPDATE ticket_statuses SET ticket_status_name = '$name', ticket_status_color = '$color', ticket_status_active = $status WHERE ticket_status_id = $ticket_status_id");
|
||||
|
||||
$ticket_status_id = mysqli_insert_id($mysqli);
|
||||
|
||||
|
|
|
|||
|
|
@ -280,7 +280,7 @@ if (isset($_GET['project_id'])) {
|
|||
|
||||
<!-- Ticket Status -->
|
||||
<td>
|
||||
<span class='p-2 badge badge-pill badge-<?php echo $ticket_status_color; ?>'><?php echo $ticket_status_name; ?></span>
|
||||
<span class='badge badge-pill text-light p-2' style="background-color: <?php echo $ticket_status_color; ?>"><?php echo $ticket_status_name; ?></span>
|
||||
</td>
|
||||
|
||||
<!-- Ticket Assigned agent -->
|
||||
|
|
|
|||
10
setup.php
10
setup.php
|
|
@ -296,11 +296,11 @@ if (isset($_POST['add_company_settings'])) {
|
|||
mysqli_query($mysqli,"INSERT INTO calendars SET calendar_name = 'Default', calendar_color = 'blue'");
|
||||
|
||||
// Add default ticket statuses
|
||||
mysqli_query($mysqli, "INSERT INTO ticket_statuses SET ticket_status_name = 'New', ticket_status_color = 'danger'"); // Default ID for new tickets is 1
|
||||
mysqli_query($mysqli, "INSERT INTO ticket_statuses SET ticket_status_name = 'Open', ticket_status_color = 'primary'"); // 2
|
||||
mysqli_query($mysqli, "INSERT INTO ticket_statuses SET ticket_status_name = 'On Hold', ticket_status_color = 'success'"); // 3
|
||||
mysqli_query($mysqli, "INSERT INTO ticket_statuses SET ticket_status_name = 'Auto Close', ticket_status_color = 'success'"); // 4
|
||||
mysqli_query($mysqli, "INSERT INTO ticket_statuses SET ticket_status_name = 'Closed', ticket_status_color = 'dark'"); // 5
|
||||
mysqli_query($mysqli, "INSERT INTO ticket_statuses SET ticket_status_name = 'New', ticket_status_color = '#dc3545'"); // Default ID for new tickets is 1
|
||||
mysqli_query($mysqli, "INSERT INTO ticket_statuses SET ticket_status_name = 'Open', ticket_status_color = '#007bff'"); // 2
|
||||
mysqli_query($mysqli, "INSERT INTO ticket_statuses SET ticket_status_name = 'On Hold', ticket_status_color = '#28a745'"); // 3
|
||||
mysqli_query($mysqli, "INSERT INTO ticket_statuses SET ticket_status_name = 'Auto Close', ticket_status_color = '#343a40'"); // 4
|
||||
mysqli_query($mysqli, "INSERT INTO ticket_statuses SET ticket_status_name = 'Closed', ticket_status_color = '#343a40'"); // 5
|
||||
|
||||
|
||||
$_SESSION['alert_message'] = "Company <strong>$name</strong> created!";
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ if (isset($_GET['ticket_id'])) {
|
|||
<div class="row">
|
||||
|
||||
<div class="col-7">
|
||||
<h3><i class="fas fa-fw fa-life-ring text-secondary mr-2"></i>Ticket <?php echo "$ticket_prefix$ticket_number"; ?> <span class='p-2 badge badge-<?php echo $ticket_status_color; ?>'><?php echo $ticket_status_name ?></span></h3>
|
||||
<h3><i class="fas fa-fw fa-life-ring text-secondary mr-2"></i>Ticket <?php echo "$ticket_prefix$ticket_number"; ?> <span class='badge badge-pill text-light p-2' style="background-color: <?php echo $ticket_status_color; ?>"><?php echo $ticket_status_name; ?></span></h3>
|
||||
</div>
|
||||
|
||||
<div class="col-5">
|
||||
|
|
|
|||
|
|
@ -448,7 +448,8 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
|
|||
|
||||
<!-- Ticket Status -->
|
||||
<td>
|
||||
<span class='p-2 badge badge-pill badge-<?php echo $ticket_status_color; ?>'><?php echo $ticket_status_name; ?></span> <?php if (isset ($ticket_scheduled_for)) { echo "<div class=\"mt-1\"> <small class='text-secondary'> $ticket_scheduled_for </small></div>"; } ?>
|
||||
<span class='badge badge-pill text-light p-2' style="background-color: <?php echo $ticket_status_color; ?>"><?php echo $ticket_status_name; ?></span>
|
||||
<?php if (isset ($ticket_scheduled_for)) { echo "<div class=\"mt-1\"> <small class='text-secondary'> $ticket_scheduled_for </small></div>"; } ?>
|
||||
</td>
|
||||
|
||||
<!-- Ticket Assigned agent -->
|
||||
|
|
|
|||
Loading…
Reference in New Issue