mirror of
https://github.com/itflow-org/itflow
synced 2026-03-04 12:54:51 +00:00
Removed Ticket assignment through edit ticket, has to be done within the ticket itself, properly update the status to assigned and pending-assignment based off whos assigned to the ticket
This commit is contained in:
@@ -101,12 +101,16 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
}
|
}
|
||||||
$ticket_closed_at = nullable_htmlentities($row['ticket_closed_at']);
|
$ticket_closed_at = nullable_htmlentities($row['ticket_closed_at']);
|
||||||
|
|
||||||
if ($ticket_status == "Open") {
|
if ($ticket_status == "Pending-Assignment") {
|
||||||
$ticket_status_display = "<span class='p-2 badge badge-primary'>$ticket_status</span>";
|
$ticket_status_color = "danger";
|
||||||
} elseif ($ticket_status == "Working") {
|
} elseif ($ticket_status == "Assigned") {
|
||||||
$ticket_status_display = "<span class='p-2 badge badge-success'>$ticket_status</span>";
|
$ticket_status_color = "primary";
|
||||||
} else {
|
} elseif ($ticket_status == "In-Progress") {
|
||||||
$ticket_status_display = "<span class='p-2 badge badge-secondary'>$ticket_status</span>";
|
$ticket_status_color = "success";
|
||||||
|
} elseif ($ticket_status == "Closed") {
|
||||||
|
$ticket_status_color = "dark";
|
||||||
|
} else{
|
||||||
|
$ticket_status_color = "secondary";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ticket_priority == "High") {
|
if ($ticket_priority == "High") {
|
||||||
@@ -160,7 +164,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</td>
|
</td>
|
||||||
<td><?php echo $contact_display; ?></td>
|
<td><?php echo $contact_display; ?></td>
|
||||||
<td><?php echo $ticket_priority_display; ?></td>
|
<td><?php echo $ticket_priority_display; ?></td>
|
||||||
<td><?php echo $ticket_status_display; ?></td>
|
<td><span class='p-2 badge badge-pill badge-<?php echo $ticket_status_color; ?>'><?php echo $ticket_status; ?></span></td>
|
||||||
<td><?php echo $ticket_assigned_to_display; ?></td>
|
<td><?php echo $ticket_assigned_to_display; ?></td>
|
||||||
<td><?php echo $ticket_updated_at_display; ?></td>
|
<td><?php echo $ticket_updated_at_display; ?></td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
@@ -10,6 +10,11 @@ if (isset($_POST['add_ticket'])) {
|
|||||||
|
|
||||||
$client_id = intval($_POST['client']);
|
$client_id = intval($_POST['client']);
|
||||||
$assigned_to = intval($_POST['assigned_to']);
|
$assigned_to = intval($_POST['assigned_to']);
|
||||||
|
if($assigned_to == 0){
|
||||||
|
$ticket_status = 'Pending-Assignment';
|
||||||
|
}else{
|
||||||
|
$ticket_status = 'Assigned';
|
||||||
|
}
|
||||||
$contact = intval($_POST['contact']);
|
$contact = intval($_POST['contact']);
|
||||||
$subject = sanitizeInput($_POST['subject']);
|
$subject = sanitizeInput($_POST['subject']);
|
||||||
$priority = sanitizeInput($_POST['priority']);
|
$priority = sanitizeInput($_POST['priority']);
|
||||||
@@ -30,7 +35,7 @@ if (isset($_POST['add_ticket'])) {
|
|||||||
$new_config_ticket_next_number = $config_ticket_next_number + 1;
|
$new_config_ticket_next_number = $config_ticket_next_number + 1;
|
||||||
mysqli_query($mysqli,"UPDATE settings SET config_ticket_next_number = $new_config_ticket_next_number WHERE company_id = 1");
|
mysqli_query($mysqli,"UPDATE settings SET config_ticket_next_number = $new_config_ticket_next_number WHERE company_id = 1");
|
||||||
|
|
||||||
mysqli_query($mysqli,"INSERT INTO tickets SET ticket_prefix = '$config_ticket_prefix', ticket_number = $ticket_number, ticket_subject = '$subject', ticket_details = '$details', ticket_priority = '$priority', ticket_status = 'Open', ticket_vendor_ticket_number = '$vendor_ticket_number', ticket_vendor_id = $vendor_id, ticket_asset_id = $asset_id, ticket_created_by = $session_user_id, ticket_assigned_to = $assigned_to, ticket_contact_id = $contact, ticket_client_id = $client_id");
|
mysqli_query($mysqli,"INSERT INTO tickets SET ticket_prefix = '$config_ticket_prefix', ticket_number = $ticket_number, ticket_subject = '$subject', ticket_details = '$details', ticket_priority = '$priority', ticket_status = '$ticket_status', ticket_vendor_ticket_number = '$vendor_ticket_number', ticket_vendor_id = $vendor_id, ticket_asset_id = $asset_id, ticket_created_by = $session_user_id, ticket_assigned_to = $assigned_to, ticket_contact_id = $contact, ticket_client_id = $client_id");
|
||||||
|
|
||||||
$ticket_id = mysqli_insert_id($mysqli);
|
$ticket_id = mysqli_insert_id($mysqli);
|
||||||
|
|
||||||
@@ -115,7 +120,6 @@ if (isset($_POST['edit_ticket'])) {
|
|||||||
validateTechRole();
|
validateTechRole();
|
||||||
|
|
||||||
$ticket_id = intval($_POST['ticket_id']);
|
$ticket_id = intval($_POST['ticket_id']);
|
||||||
$assigned_to = intval($_POST['assigned_to']);
|
|
||||||
$contact_id = intval($_POST['contact']);
|
$contact_id = intval($_POST['contact']);
|
||||||
$subject = sanitizeInput($_POST['subject']);
|
$subject = sanitizeInput($_POST['subject']);
|
||||||
$priority = sanitizeInput($_POST['priority']);
|
$priority = sanitizeInput($_POST['priority']);
|
||||||
@@ -126,7 +130,7 @@ if (isset($_POST['edit_ticket'])) {
|
|||||||
$client_id = intval($_POST['client_id']);
|
$client_id = intval($_POST['client_id']);
|
||||||
$ticket_number = intval($_POST['ticket_number']);
|
$ticket_number = intval($_POST['ticket_number']);
|
||||||
|
|
||||||
mysqli_query($mysqli,"UPDATE tickets SET ticket_subject = '$subject', ticket_priority = '$priority', ticket_details = '$details', ticket_vendor_ticket_number = '$vendor_ticket_number', ticket_assigned_to = $assigned_to, ticket_contact_id = $contact_id, ticket_vendor_id = $vendor_id, ticket_asset_id = $asset_id WHERE ticket_id = $ticket_id");
|
mysqli_query($mysqli,"UPDATE tickets SET ticket_subject = '$subject', ticket_priority = '$priority', ticket_details = '$details', ticket_vendor_ticket_number = '$vendor_ticket_number', ticket_contact_id = $contact_id, ticket_vendor_id = $vendor_id, ticket_asset_id = $asset_id WHERE ticket_id = $ticket_id");
|
||||||
|
|
||||||
// Add Watchers
|
// Add Watchers
|
||||||
if (!empty($_POST['watchers'])) {
|
if (!empty($_POST['watchers'])) {
|
||||||
@@ -158,12 +162,16 @@ if (isset($_POST['assign_ticket'])) {
|
|||||||
// POST variables
|
// POST variables
|
||||||
$ticket_id = intval($_POST['ticket_id']);
|
$ticket_id = intval($_POST['ticket_id']);
|
||||||
$assigned_to = intval($_POST['assigned_to']);
|
$assigned_to = intval($_POST['assigned_to']);
|
||||||
|
$ticket_status = sanitizeInput($_POST['ticket_status']);
|
||||||
|
if($ticket_status == 'Pending-Assignment' && $assigned_to > 0){
|
||||||
|
$ticket_status = 'Assigned';
|
||||||
|
}
|
||||||
|
|
||||||
// Allow for un-assigning tickets
|
// Allow for un-assigning tickets
|
||||||
if ($assigned_to == 0) {
|
if ($assigned_to == 0) {
|
||||||
$ticket_reply = "Ticket unassigned.";
|
$ticket_reply = "Ticket unassigned.";
|
||||||
$agent_name = "No One";
|
$agent_name = "No One";
|
||||||
|
$ticket_status = "Pending-Assignment";
|
||||||
} else {
|
} else {
|
||||||
// Get & verify assigned agent details
|
// Get & verify assigned agent details
|
||||||
$agent_details_sql = mysqli_query($mysqli, "SELECT user_name, user_email FROM users LEFT JOIN user_settings ON users.user_id = user_settings.user_id WHERE users.user_id = $assigned_to AND user_settings.user_role > 1");
|
$agent_details_sql = mysqli_query($mysqli, "SELECT user_name, user_email FROM users LEFT JOIN user_settings ON users.user_id = user_settings.user_id WHERE users.user_id = $assigned_to AND user_settings.user_role > 1");
|
||||||
@@ -209,7 +217,7 @@ if (isset($_POST['assign_ticket'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update ticket & insert reply
|
// Update ticket & insert reply
|
||||||
mysqli_query($mysqli,"UPDATE tickets SET ticket_assigned_to = $assigned_to WHERE ticket_id = $ticket_id");
|
mysqli_query($mysqli,"UPDATE tickets SET ticket_assigned_to = $assigned_to, ticket_status = '$ticket_status' WHERE ticket_id = $ticket_id");
|
||||||
|
|
||||||
mysqli_query($mysqli,"INSERT INTO ticket_replies SET ticket_reply = '$ticket_reply_escaped', ticket_reply_type = 'Internal', ticket_reply_time_worked = '00:01:00', ticket_reply_by = $session_user_id, ticket_reply_ticket_id = $ticket_id");
|
mysqli_query($mysqli,"INSERT INTO ticket_replies SET ticket_reply = '$ticket_reply_escaped', ticket_reply_type = 'Internal', ticket_reply_time_worked = '00:01:00', ticket_reply_by = $session_user_id, ticket_reply_ticket_id = $ticket_id");
|
||||||
|
|
||||||
|
|||||||
@@ -726,6 +726,7 @@ if (isset($_GET['ticket_id'])) {
|
|||||||
|
|
||||||
<form action="post.php" method="post">
|
<form action="post.php" method="post">
|
||||||
<input type="hidden" name="ticket_id" value="<?php echo $ticket_id; ?>">
|
<input type="hidden" name="ticket_id" value="<?php echo $ticket_id; ?>">
|
||||||
|
<input type="hidden" name="ticket_status" value="<?php echo $ticket_status; ?>">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Assigned to</label>
|
<label>Assigned to</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
|
|||||||
@@ -62,35 +62,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Assigned to</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
|
||||||
</div>
|
|
||||||
<select class="form-control select2" name="assigned_to">
|
|
||||||
<option value="0">Not Assigned</option>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$sql_assign_to_select = mysqli_query(
|
|
||||||
$mysqli,
|
|
||||||
"SELECT users.user_id, user_name FROM users
|
|
||||||
LEFT JOIN user_settings on users.user_id = user_settings.user_id
|
|
||||||
WHERE user_role > 1 AND user_archived_at IS NULL ORDER BY user_name ASC"
|
|
||||||
);
|
|
||||||
while ($row = mysqli_fetch_array($sql_assign_to_select)) {
|
|
||||||
$user_id = intval($row['user_id']);
|
|
||||||
$user_name = nullable_htmlentities($row['user_name']);
|
|
||||||
?>
|
|
||||||
<option <?php if ($ticket_assigned_to == $user_id) { echo "selected"; } ?> value="<?php echo $user_id; ?>"><?php echo $user_name; ?></option>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tab-pane fade" id="pills-contacts<?php echo $ticket_id; ?>">
|
<div class="tab-pane fade" id="pills-contacts<?php echo $ticket_id; ?>">
|
||||||
|
|||||||
@@ -307,10 +307,14 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
|
|||||||
$contact_phone = formatPhoneNumber($row['contact_phone']);
|
$contact_phone = formatPhoneNumber($row['contact_phone']);
|
||||||
$contact_extension = nullable_htmlentities($row['contact_extension']);
|
$contact_extension = nullable_htmlentities($row['contact_extension']);
|
||||||
$contact_mobile = formatPhoneNumber($row['contact_mobile']);
|
$contact_mobile = formatPhoneNumber($row['contact_mobile']);
|
||||||
if ($ticket_status == "Open") {
|
if ($ticket_status == "Pending-Assignment") {
|
||||||
|
$ticket_status_color = "danger";
|
||||||
|
} elseif ($ticket_status == "Assigned") {
|
||||||
$ticket_status_color = "primary";
|
$ticket_status_color = "primary";
|
||||||
} elseif ($ticket_status == "Working") {
|
} elseif ($ticket_status == "In-Progress") {
|
||||||
$ticket_status_color = "success";
|
$ticket_status_color = "success";
|
||||||
|
} elseif ($ticket_status == "Closed") {
|
||||||
|
$ticket_status_color = "dark";
|
||||||
} else{
|
} else{
|
||||||
$ticket_status_color = "secondary";
|
$ticket_status_color = "secondary";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user