diff --git a/post/ticket.php b/post/ticket.php index f2df705b..a1dd2151 100644 --- a/post/ticket.php +++ b/post/ticket.php @@ -466,6 +466,28 @@ if (isset($_GET['delete_ticket'])) { } +if (isset($_POST['bulk_assign_ticket'])) { + + // Role check + validateTechRole(); + + // POST variables + $assign_to = intval($_POST['assign_to']); + + // Assign Tech to Selected Tickets + if (!empty($_POST['ticket_ids'])) { + foreach($_POST['ticket_ids'] as $ticket_id) { + $ticket_id = intval($ticket_id); + mysqli_query($mysqli,"UPDATE tickets SET ticket_assigned_to = $assign_to WHERE ticket_id = $ticket_id"); + } + } + + $_SESSION['alert_message'] = "Bulk Assigned Tickets"; + + header("Location: " . $_SERVER["HTTP_REFERER"]); + +} + if (isset($_POST['add_ticket_reply'])) { validateTechRole(); diff --git a/ticket_bulk_assign_modal.php b/ticket_bulk_assign_modal.php new file mode 100644 index 00000000..6393a351 --- /dev/null +++ b/ticket_bulk_assign_modal.php @@ -0,0 +1,46 @@ + diff --git a/tickets.php b/tickets.php index 24ee725a..1c34e155 100644 --- a/tickets.php +++ b/tickets.php @@ -102,11 +102,9 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
-
- -
+
@@ -123,19 +121,34 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
-
- -
@@ -235,196 +248,210 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);

-
- - "> - - - - - -
Number - Subject - Client / Contact - Billable +
+ +
+ + "> + + + + + - - - - - - - - - - - Never

"; - } else { - $ticket_updated_at_display = "

Never

"; - } - } else { - $ticket_updated_at_display = "$ticket_updated_at_time_ago
$ticket_updated_at"; - } - $ticket_closed_at = nullable_htmlentities($row['ticket_closed_at']); - $client_id = intval($row['ticket_client_id']); - $client_name = nullable_htmlentities($row['client_name']); - $contact_id = intval($row['ticket_contact_id']); - $contact_name = nullable_htmlentities($row['contact_name']); - $contact_title = nullable_htmlentities($row['contact_title']); - $contact_email = nullable_htmlentities($row['contact_email']); - $contact_phone = formatPhoneNumber($row['contact_phone']); - $contact_extension = nullable_htmlentities($row['contact_extension']); - $contact_mobile = formatPhoneNumber($row['contact_mobile']); - if ($ticket_status == "Pending-Assignment") { - $ticket_status_color = "danger"; - } elseif ($ticket_status == "Assigned") { - $ticket_status_color = "primary"; - } elseif ($ticket_status == "In-Progress") { - $ticket_status_color = "success"; - } elseif ($ticket_status == "Closed") { - $ticket_status_color = "dark"; - } elseif ($ticket_status == "Auto Close") { - $ticket_status_color = "dark"; - } elseif ($ticket_status == "Client-Replied") { - $ticket_status_color = "warning"; - } else{ - $ticket_status_color = "secondary"; - } - - if ($ticket_priority == "High") { - $ticket_priority_color = "danger"; - } elseif ($ticket_priority == "Medium") { - $ticket_priority_color = "warning"; - } else{ - $ticket_priority_color = "info"; - } - $ticket_assigned_to = intval($row['ticket_assigned_to']); - if (empty($ticket_assigned_to)) { - if ($ticket_status == "Closed") { - $ticket_assigned_to_display = "

Not Assigned

"; - } else { - $ticket_assigned_to_display = "

Not Assigned

"; - } - } else { - $ticket_assigned_to_display = nullable_htmlentities($row['user_name']); - } - - if (empty($contact_name)) { - $contact_display = "-"; - } else { - $contact_display = "$contact_name
$contact_email"; - } - - $asset_id = intval($row['ticket_asset_id']); - $vendor_id = intval($row['ticket_vendor_id']); - - ?> - - "> - - - - $"; - } else { - echo "X"; - } - ?> - - - - - - - + + + + + + + + Never

"; + } else { + $ticket_updated_at_display = "

Never

"; + } + } else { + $ticket_updated_at_display = "$ticket_updated_at_time_ago
$ticket_updated_at"; + } + $ticket_closed_at = nullable_htmlentities($row['ticket_closed_at']); + $client_id = intval($row['ticket_client_id']); + $client_name = nullable_htmlentities($row['client_name']); + $contact_id = intval($row['ticket_contact_id']); + $contact_name = nullable_htmlentities($row['contact_name']); + $contact_title = nullable_htmlentities($row['contact_title']); + $contact_email = nullable_htmlentities($row['contact_email']); + $contact_phone = formatPhoneNumber($row['contact_phone']); + $contact_extension = nullable_htmlentities($row['contact_extension']); + $contact_mobile = formatPhoneNumber($row['contact_mobile']); + if ($ticket_status == "Pending-Assignment") { + $ticket_status_color = "danger"; + } elseif ($ticket_status == "Assigned") { + $ticket_status_color = "primary"; + } elseif ($ticket_status == "In-Progress") { + $ticket_status_color = "success"; + } elseif ($ticket_status == "Closed") { + $ticket_status_color = "dark"; + } elseif ($ticket_status == "Auto Close") { + $ticket_status_color = "dark"; + } elseif ($ticket_status == "Client-Replied") { + $ticket_status_color = "warning"; + } else{ + $ticket_status_color = "secondary"; + } - require "ticket_assign_modal.php"; + if ($ticket_priority == "High") { + $ticket_priority_color = "danger"; + } elseif ($ticket_priority == "Medium") { + $ticket_priority_color = "warning"; + } else{ + $ticket_priority_color = "info"; + } + $ticket_assigned_to = intval($row['ticket_assigned_to']); + if (empty($ticket_assigned_to)) { + if ($ticket_status == "Closed") { + $ticket_assigned_to_display = "

Not Assigned

"; + } else { + $ticket_assigned_to_display = "

Not Assigned

"; + } + } else { + $ticket_assigned_to_display = nullable_htmlentities($row['user_name']); + } - require "ticket_edit_priority_modal.php"; + if (empty($contact_name)) { + $contact_display = "-"; + } else { + $contact_display = "$contact_name
$contact_email"; + } + + $asset_id = intval($row['ticket_asset_id']); + $vendor_id = intval($row['ticket_vendor_id']); + + ?> + + "> + + + + + + + + + + + + + + + - ?> - - -
+
+ +
+
Number + Subject + Client / Contact Priority - Status - Assigned - Last Response - Created -
- - - - - - - - -
-
- + ?> + Billable + - -
- -
Priority + Status + Assigned + Last Response + Created +
+
+ +
+
+ + + + + + + + +
+
+ + $"; + } else { + echo "X"; + } + ?> + +
+ +
-
+ +
+
+ + + +