diff --git a/client_tickets.php b/client_tickets.php index 0b6881edd..8e4d538c7 100644 --- a/client_tickets.php +++ b/client_tickets.php @@ -160,17 +160,7 @@ } $ticket_closed_at = nullable_htmlentities($row['ticket_closed_at']); - if ($ticket_status == "New") { - $ticket_status_color = "danger"; - } elseif ($ticket_status == "Open") { - $ticket_status_color = "primary"; - } elseif ($ticket_status == "On Hold") { - $ticket_status_color = "success"; - } elseif ($ticket_status == "Auto Close") { - $ticket_status_color = "dark"; - } elseif ($ticket_status == "Closed") { - $ticket_status_color = "dark"; - } + $ticket_status_color = getTicketStatusColor($ticket_status); if ($ticket_priority == "High") { $ticket_priority_display = "$ticket_priority"; @@ -268,8 +258,8 @@
- - + +
diff --git a/functions.php b/functions.php index f8a974a3a..17df05b4b 100644 --- a/functions.php +++ b/functions.php @@ -1138,3 +1138,16 @@ function createiCalStrCancel($originaliCalStr) { return $cal_event->export(); } +function getTicketStatusColor($ticket_status) { + if ($ticket_status == "New") { + return "danger"; + } elseif ($ticket_status == "Open") { + return "primary"; + } elseif ($ticket_status == "On Hold") { + return "success"; + } elseif ($ticket_status == "Auto Close") { + return "dark"; + } elseif ($ticket_status == "Closed") { + return "dark"; + } +} diff --git a/ticket.php b/ticket.php index 9cb2158bd..2b030fd7a 100644 --- a/ticket.php +++ b/ticket.php @@ -77,17 +77,7 @@ $ticket_feedback = nullable_htmlentities($row['ticket_feedback']); $ticket_status = nullable_htmlentities($row['ticket_status']); - if ($ticket_status == "New") { - $ticket_status_display = "$ticket_status"; - } elseif ($ticket_status == "Open") { - $ticket_status_display = "$ticket_status"; - } elseif ($ticket_status == "On Hold") { - $ticket_status_display = "$ticket_status"; - } elseif ($ticket_status == "Auto Close" || $ticket_status == "Closed") { - $ticket_status_display = "$ticket_status"; - } else { - $ticket_status_display = "$ticket_status"; // To be removed - } + $ticket_status_color = getTicketStatusColor($ticket_status); $ticket_vendor_ticket_number = nullable_htmlentities($row['ticket_vendor_ticket_number']); $ticket_created_at = nullable_htmlentities($row['ticket_created_at']); @@ -163,7 +153,7 @@ $row = mysqli_fetch_array($ticket_total_reply_time); $ticket_total_reply_time = nullable_htmlentities($row['ticket_total_reply_time']); - + // Client Tags $client_tag_name_display_array = array(); $client_tag_id_array = array(); @@ -186,13 +176,13 @@ } $client_tags_display = implode(' ', $client_tag_name_display_array); - + // Get the number of ticket Responses $ticket_responses_sql = mysqli_query($mysqli, "SELECT COUNT(ticket_reply_id) AS ticket_responses FROM ticket_replies WHERE ticket_reply_archived_at IS NULL AND ticket_reply_ticket_id = $ticket_id"); $row = mysqli_fetch_array($ticket_responses_sql); $ticket_responses = intval($row['ticket_responses']); - + // Get & format asset warranty expiry $date = date('Y-m-d H:i:s'); $dt_value = $asset_warranty_expire; //sample date @@ -219,7 +209,7 @@ ORDER BY ticket_reply_id DESC" ); - + // Get other tickets for this asset if (!empty($asset_id)) { $sql_asset_tickets = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_asset_id = $asset_id ORDER BY ticket_number DESC"); @@ -237,7 +227,7 @@ AND user_archived_at IS NULL ORDER BY user_name ASC" ); - + // Get Ticket Attachments $sql_ticket_attachments = mysqli_query( @@ -262,7 +252,7 @@
-

Ticket

+

Ticket

@@ -297,7 +287,7 @@
- +
@@ -739,7 +729,7 @@
- +
Asset
@@ -927,8 +917,8 @@ - - + + - +
@@ -977,7 +967,7 @@ ?> - +