mirror of
https://github.com/itflow-org/itflow
synced 2026-03-06 13:54:51 +00:00
Feature Show who last replied in ticket listings
This commit is contained in:
@@ -215,6 +215,31 @@ $total_scheduled_tickets = intval($row['total_scheduled_tickets']);
|
|||||||
$asset_id = intval($row['ticket_asset_id']);
|
$asset_id = intval($row['ticket_asset_id']);
|
||||||
$vendor_id = intval($row['ticket_vendor_id']);
|
$vendor_id = intval($row['ticket_vendor_id']);
|
||||||
|
|
||||||
|
|
||||||
|
// Get Ticket Last updated By in the last ticket reply to be show in the last Response column
|
||||||
|
$sql_ticket_reply = mysqli_query($mysqli, "SELECT * FROM ticket_replies
|
||||||
|
LEFT JOIN users ON ticket_reply_by = user_id
|
||||||
|
LEFT JOIN contacts ON ticket_reply_by = contact_id
|
||||||
|
WHERE ticket_reply_ticket_id = $ticket_id
|
||||||
|
AND ticket_reply_archived_at IS NULL
|
||||||
|
ORDER BY ticket_reply_id DESC LIMIT 1"
|
||||||
|
);
|
||||||
|
$row = mysqli_fetch_array($sql_ticket_reply);
|
||||||
|
$ticket_reply_type = nullable_htmlentities($row['ticket_reply_type']);
|
||||||
|
$ticket_reply_by = intval($row['ticket_reply_by']);
|
||||||
|
if ($ticket_reply_type == "Client") {
|
||||||
|
$ticket_reply_by_display = nullable_htmlentities($row['contact_name']);
|
||||||
|
$user_initials = initials($row['contact_name']);
|
||||||
|
$user_avatar = nullable_htmlentities($row['contact_photo']);
|
||||||
|
$avatar_link = "uploads/clients/$client_id/$user_avatar";
|
||||||
|
} else {
|
||||||
|
$ticket_reply_by_display = nullable_htmlentities($row['user_name']);
|
||||||
|
$user_id = intval($row['user_id']);
|
||||||
|
$user_avatar = nullable_htmlentities($row['user_avatar']);
|
||||||
|
$user_initials = initials($row['user_name']);
|
||||||
|
$avatar_link = "uploads/users/$user_id/$user_avatar";
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<tr class="<?php if(empty($ticket_updated_at)) { echo "text-bold"; }?>">
|
<tr class="<?php if(empty($ticket_updated_at)) { echo "text-bold"; }?>">
|
||||||
@@ -240,7 +265,11 @@ $total_scheduled_tickets = intval($row['total_scheduled_tickets']);
|
|||||||
<td><a href="#" data-toggle="modal" data-target="#editTicketPriorityModal<?php echo $ticket_id; ?>"><?php echo $ticket_priority_display; ?></a></td>
|
<td><a href="#" data-toggle="modal" data-target="#editTicketPriorityModal<?php echo $ticket_id; ?>"><?php echo $ticket_priority_display; ?></a></td>
|
||||||
<td><span class='p-2 badge badge-pill badge-<?php echo $ticket_status_color; ?>'><?php echo $ticket_status; ?></span></td>
|
<td><span class='p-2 badge badge-pill badge-<?php echo $ticket_status_color; ?>'><?php echo $ticket_status; ?></span></td>
|
||||||
<td><a href="#" data-toggle="modal" data-target="#assignTicketModal<?php echo $ticket_id; ?>"><?php echo $ticket_assigned_to_display; ?></a></td>
|
<td><a href="#" data-toggle="modal" data-target="#assignTicketModal<?php echo $ticket_id; ?>"><?php echo $ticket_assigned_to_display; ?></a></td>
|
||||||
<td><?php echo $ticket_updated_at_display; ?></td>
|
<td>
|
||||||
|
<div><?php echo $ticket_updated_at_display; ?></div>
|
||||||
|
<div><?php echo $ticket_reply_by_display; ?></div>
|
||||||
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php echo $ticket_created_at_time_ago; ?>
|
<?php echo $ticket_created_at_time_ago; ?>
|
||||||
<br>
|
<br>
|
||||||
|
|||||||
24
ticket.php
24
ticket.php
@@ -162,8 +162,8 @@ if (isset($_GET['ticket_id'])) {
|
|||||||
$row = mysqli_fetch_array($ticket_total_reply_time);
|
$row = mysqli_fetch_array($ticket_total_reply_time);
|
||||||
$ticket_total_reply_time = nullable_htmlentities($row['ticket_total_reply_time']);
|
$ticket_total_reply_time = nullable_htmlentities($row['ticket_total_reply_time']);
|
||||||
|
|
||||||
|
|
||||||
// Client Tags
|
// Client Tags
|
||||||
|
|
||||||
$client_tag_name_display_array = array();
|
$client_tag_name_display_array = array();
|
||||||
$client_tag_id_array = array();
|
$client_tag_id_array = array();
|
||||||
$sql_client_tags = mysqli_query($mysqli, "SELECT * FROM client_tags LEFT JOIN tags ON client_tags.client_tag_tag_id = tags.tag_id WHERE client_tags.client_tag_client_id = $client_id ORDER BY tag_name ASC");
|
$sql_client_tags = mysqli_query($mysqli, "SELECT * FROM client_tags LEFT JOIN tags ON client_tags.client_tag_tag_id = tags.tag_id WHERE client_tags.client_tag_client_id = $client_id ORDER BY tag_name ASC");
|
||||||
@@ -185,16 +185,17 @@ if (isset($_GET['ticket_id'])) {
|
|||||||
}
|
}
|
||||||
$client_tags_display = implode(' ', $client_tag_name_display_array);
|
$client_tags_display = implode(' ', $client_tag_name_display_array);
|
||||||
|
|
||||||
// Get the number of responses
|
|
||||||
|
// 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");
|
$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);
|
$row = mysqli_fetch_array($ticket_responses_sql);
|
||||||
$ticket_responses = intval($row['ticket_responses']);
|
$ticket_responses = intval($row['ticket_responses']);
|
||||||
|
|
||||||
|
|
||||||
// Get & format asset warranty expiry
|
// Get & format asset warranty expiry
|
||||||
$date = date('Y-m-d H:i:s');
|
$date = date('Y-m-d H:i:s');
|
||||||
$dt_value = $asset_warranty_expire; //sample date
|
$dt_value = $asset_warranty_expire; //sample date
|
||||||
$warranty_check = date('m/d/Y', strtotime('-8 hours'));
|
$warranty_check = date('m/d/Y', strtotime('-8 hours'));
|
||||||
|
|
||||||
if ($dt_value <= $date) {
|
if ($dt_value <= $date) {
|
||||||
$dt_value = "Expired on $asset_warranty_expire";
|
$dt_value = "Expired on $asset_warranty_expire";
|
||||||
$warranty_status_color = 'red';
|
$warranty_status_color = 'red';
|
||||||
@@ -207,16 +208,25 @@ if (isset($_GET['ticket_id'])) {
|
|||||||
$warranty_status_color = 'red';
|
$warranty_status_color = 'red';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get all ticket replies
|
|
||||||
$sql_ticket_replies = mysqli_query($mysqli, "SELECT * FROM ticket_replies LEFT JOIN users ON ticket_reply_by = user_id LEFT JOIN contacts ON ticket_reply_by = contact_id WHERE ticket_reply_ticket_id = $ticket_id AND ticket_reply_archived_at IS NULL ORDER BY ticket_reply_id DESC");
|
|
||||||
|
|
||||||
|
// Get all ticket replies
|
||||||
|
$sql_ticket_replies = mysqli_query($mysqli, "SELECT * FROM ticket_replies
|
||||||
|
LEFT JOIN users ON ticket_reply_by = user_id
|
||||||
|
LEFT JOIN contacts ON ticket_reply_by = contact_id
|
||||||
|
WHERE ticket_reply_ticket_id = $ticket_id
|
||||||
|
AND ticket_reply_archived_at IS NULL
|
||||||
|
ORDER BY ticket_reply_id DESC"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Get other tickets for this asset
|
// Get other tickets for this asset
|
||||||
if (!empty($asset_id)) {
|
if (!empty($asset_id)) {
|
||||||
$sql_asset_tickets = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_asset_id = $asset_id ORDER BY ticket_number DESC");
|
$sql_asset_tickets = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_asset_id = $asset_id ORDER BY ticket_number DESC");
|
||||||
$ticket_asset_count = mysqli_num_rows($sql_asset_tickets);
|
$ticket_asset_count = mysqli_num_rows($sql_asset_tickets);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get technicians to assign the ticket to
|
|
||||||
|
// Get Technicians to assign the ticket to
|
||||||
$sql_assign_to_select = mysqli_query(
|
$sql_assign_to_select = mysqli_query(
|
||||||
$mysqli,
|
$mysqli,
|
||||||
"SELECT users.user_id, user_name FROM users
|
"SELECT users.user_id, user_name FROM users
|
||||||
@@ -226,7 +236,9 @@ if (isset($_GET['ticket_id'])) {
|
|||||||
AND user_archived_at IS NULL
|
AND user_archived_at IS NULL
|
||||||
ORDER BY user_name ASC"
|
ORDER BY user_name ASC"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Get Ticket Attachments
|
||||||
$sql_ticket_attachments = mysqli_query(
|
$sql_ticket_attachments = mysqli_query(
|
||||||
$mysqli,
|
$mysqli,
|
||||||
"SELECT * FROM ticket_attachments
|
"SELECT * FROM ticket_attachments
|
||||||
|
|||||||
30
tickets.php
30
tickets.php
@@ -398,6 +398,31 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
|
|||||||
$asset_id = intval($row['ticket_asset_id']);
|
$asset_id = intval($row['ticket_asset_id']);
|
||||||
$vendor_id = intval($row['ticket_vendor_id']);
|
$vendor_id = intval($row['ticket_vendor_id']);
|
||||||
|
|
||||||
|
|
||||||
|
// Get Ticket Last updated By in the last ticket reply to be show in the last Response column
|
||||||
|
$sql_ticket_reply = mysqli_query($mysqli, "SELECT * FROM ticket_replies
|
||||||
|
LEFT JOIN users ON ticket_reply_by = user_id
|
||||||
|
LEFT JOIN contacts ON ticket_reply_by = contact_id
|
||||||
|
WHERE ticket_reply_ticket_id = $ticket_id
|
||||||
|
AND ticket_reply_archived_at IS NULL
|
||||||
|
ORDER BY ticket_reply_id DESC LIMIT 1"
|
||||||
|
);
|
||||||
|
$row = mysqli_fetch_array($sql_ticket_reply);
|
||||||
|
$ticket_reply_type = nullable_htmlentities($row['ticket_reply_type']);
|
||||||
|
$ticket_reply_by = intval($row['ticket_reply_by']);
|
||||||
|
if ($ticket_reply_type == "Client") {
|
||||||
|
$ticket_reply_by_display = nullable_htmlentities($row['contact_name']);
|
||||||
|
$user_initials = initials($row['contact_name']);
|
||||||
|
$user_avatar = nullable_htmlentities($row['contact_photo']);
|
||||||
|
$avatar_link = "uploads/clients/$client_id/$user_avatar";
|
||||||
|
} else {
|
||||||
|
$ticket_reply_by_display = nullable_htmlentities($row['user_name']);
|
||||||
|
$user_id = intval($row['user_id']);
|
||||||
|
$user_avatar = nullable_htmlentities($row['user_avatar']);
|
||||||
|
$user_initials = initials($row['user_name']);
|
||||||
|
$avatar_link = "uploads/users/$user_id/$user_avatar";
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<tr class="<?php if (empty($ticket_updated_at)) {
|
<tr class="<?php if (empty($ticket_updated_at)) {
|
||||||
@@ -440,7 +465,10 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
|
|||||||
<td><a href="#" data-toggle="modal" data-target="#editTicketPriorityModal<?php echo $ticket_id; ?>"><span class='p-2 badge badge-pill badge-<?php echo $ticket_priority_color; ?>'><?php echo $ticket_priority; ?></span></a></td>
|
<td><a href="#" data-toggle="modal" data-target="#editTicketPriorityModal<?php echo $ticket_id; ?>"><span class='p-2 badge badge-pill badge-<?php echo $ticket_priority_color; ?>'><?php echo $ticket_priority; ?></span></a></td>
|
||||||
<td><span class='p-2 badge badge-pill badge-<?php echo $ticket_status_color; ?>'><?php echo $ticket_status; ?></span> <?php if ($ticket_status == 'On Hold' && isset ($ticket_scheduled_for)) { echo "<div class=\"mt-1\"> <small class='text-secondary'> $ticket_scheduled_for </small></div>"; } ?></td>
|
<td><span class='p-2 badge badge-pill badge-<?php echo $ticket_status_color; ?>'><?php echo $ticket_status; ?></span> <?php if ($ticket_status == 'On Hold' && isset ($ticket_scheduled_for)) { echo "<div class=\"mt-1\"> <small class='text-secondary'> $ticket_scheduled_for </small></div>"; } ?></td>
|
||||||
<td><a href="#" data-toggle="modal" data-target="#assignTicketModal<?php echo $ticket_id; ?>"><?php echo $ticket_assigned_to_display; ?></a></td>
|
<td><a href="#" data-toggle="modal" data-target="#assignTicketModal<?php echo $ticket_id; ?>"><?php echo $ticket_assigned_to_display; ?></a></td>
|
||||||
<td><?php echo $ticket_updated_at_display; ?></td>
|
<td>
|
||||||
|
<div><?php echo $ticket_updated_at_display; ?></div>
|
||||||
|
<div><?php echo $ticket_reply_by_display; ?></div>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?php echo $ticket_created_at_time_ago; ?>
|
<?php echo $ticket_created_at_time_ago; ?>
|
||||||
<br>
|
<br>
|
||||||
|
|||||||
Reference in New Issue
Block a user