diff --git a/calendar_events.php b/calendar_events.php
index 1ce6cafa..65856d1e 100644
--- a/calendar_events.php
+++ b/calendar_events.php
@@ -161,15 +161,14 @@ while ($row = mysqli_fetch_array($sql)) {
$event_title = json_encode($row['ticket_prefix'] . $row['ticket_number'] . " created - " . $row['ticket_subject'] . " " . $username . "{" . $ticket_status . "}");
$event_start = json_encode($row['ticket_created_at']);
-
- if ($ticket_status == "Closed") {
- $event_color = "black";
- } else if ($ticket_status == "Scheduled") {
- $event_color = "grey";
- } else if ($ticket_status == "Pending-Assignment") {
+ if ($ticket_status == "New") {
$event_color = "red";
- } else {
+ } elseif ($ticket_status == "Open") {
$event_color = "blue";
+ } elseif ($ticket_status == "On Hold") {
+ $event_color = "grey";
+ } else {
+ $event_color = "black";
}
echo "{ id: $event_id, title: $event_title, start: $event_start, color: '$event_color', url: 'ticket.php?ticket_id=$event_id' },";
@@ -188,7 +187,7 @@ while ($row = mysqli_fetch_array($sql)) {
}
if (strtotime($row['ticket_schedule']) < time()) {
- if ($row['ticket_status'] == 'Scheduled') {
+ if ($row['ticket_status'] == 'On Hold') {
$event_color = "red";
} else {
$event_color = "green";
@@ -200,7 +199,7 @@ while ($row = mysqli_fetch_array($sql)) {
$ticket_status = strval($row['ticket_status']);
$event_title = json_encode($row['ticket_prefix'] . $row['ticket_number'] . " scheduled - " . $row['ticket_subject'] . " [" . $username . "]{" . $ticket_status . "}");
$event_start = json_encode($row['ticket_schedule']);
-
+
echo "{ id: $event_id, title: $event_title, start: $event_start, color: '$event_color', url: 'ticket.php?ticket_id=$event_id' },";
}
@@ -260,4 +259,4 @@ while ($row = mysqli_fetch_array($sql)) {
// Update the end date field
document.getElementById("event_add_end").value = new_end;
}
-
\ No newline at end of file
+
diff --git a/client_events.php b/client_events.php
index 62bfa6fe..41ae75ff 100644
--- a/client_events.php
+++ b/client_events.php
@@ -161,15 +161,14 @@ while ($row = mysqli_fetch_array($sql)) {
$event_title = json_encode($row['ticket_prefix'] . $row['ticket_number'] . " created - " . $row['ticket_subject'] . " " . $username . "{" . $ticket_status . "}");
$event_start = json_encode($row['ticket_created_at']);
-
- if ($ticket_status == "Closed") {
- $event_color = "black";
- } else if ($ticket_status == "Scheduled") {
- $event_color = "grey";
- } else if ($ticket_status == "Pending-Assignment") {
+ if ($ticket_status == "New") {
$event_color = "red";
- } else {
+ } elseif ($ticket_status == "Open") {
$event_color = "blue";
+ } elseif ($ticket_status == "On Hold") {
+ $event_color = "grey";
+ } else {
+ $event_color = "black";
}
echo "{ id: $event_id, title: $event_title, start: $event_start, color: '$event_color', url: 'ticket.php?ticket_id=$event_id' },";
@@ -200,7 +199,7 @@ while ($row = mysqli_fetch_array($sql)) {
$ticket_status = strval($row['ticket_status']);
$event_title = json_encode($row['ticket_prefix'] . $row['ticket_number'] . " scheduled - " . $row['ticket_subject'] . " [" . $username . "]{" . $ticket_status . "}");
$event_start = json_encode($row['ticket_schedule']);
-
+
echo "{ id: $event_id, title: $event_title, start: $event_start, color: '$event_color', url: 'ticket.php?ticket_id=$event_id' },";
}
diff --git a/client_tickets.php b/client_tickets.php
index 3a37c791..e44ce776 100644
--- a/client_tickets.php
+++ b/client_tickets.php
@@ -160,16 +160,16 @@ $total_scheduled_tickets = intval($row['total_scheduled_tickets']);
}
$ticket_closed_at = nullable_htmlentities($row['ticket_closed_at']);
- if ($ticket_status == "Pending-Assignment") {
+ if ($ticket_status == "New") {
$ticket_status_color = "danger";
- } elseif ($ticket_status == "Assigned") {
+ } elseif ($ticket_status == "Open") {
$ticket_status_color = "primary";
- } elseif ($ticket_status == "In-Progress") {
+ } 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";
- } else{
- $ticket_status_color = "secondary";
}
if ($ticket_priority == "High") {
@@ -181,6 +181,7 @@ $total_scheduled_tickets = intval($row['total_scheduled_tickets']);
} else{
$ticket_priority_display = "-";
}
+
$ticket_assigned_to = intval($row['ticket_assigned_to']);
if (empty($ticket_assigned_to)) {
if ($ticket_status == "Closed") {
diff --git a/cron.php b/cron.php
index 191a7360..411dbe4d 100644
--- a/cron.php
+++ b/cron.php
@@ -219,20 +219,20 @@ foreach ($warranty_alert_array as $day) {
// Logging
//mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Task', log_description = 'Cron created notifications for asset warranties expiring'");
-// Notify of Tickets Pending Assignment
+// Notify of New Tickets
// Get Ticket Pending Assignment
$sql_tickets_pending_assignment = mysqli_query($mysqli,"SELECT ticket_id FROM tickets
- WHERE ticket_status = 'Pending-Assignment'"
+ WHERE ticket_status = 'New'"
);
$tickets_pending_assignment = mysqli_num_rows($sql_tickets_pending_assignment);
if($tickets_pending_assignment > 0){
- mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Pending Tickets', notification = 'There are $tickets_pending_assignment Tickets pending assignment', notification_action = 'tickets.php?status=Pending-Assignment'");
+ mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Pending Tickets', notification = 'There are $tickets_pending_assignment new tickets pending assignment', notification_action = 'tickets.php?status=New'");
// Logging
- mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Task', log_description = 'Cron created notifications for tickets that are pending assignment'");
+ mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Task', log_description = 'Cron created notifications for new tickets that are pending assignment'");
}
// Recurring (Scheduled) tickets
@@ -262,7 +262,7 @@ if (mysqli_num_rows($sql_scheduled_tickets) > 0) {
mysqli_query($mysqli, "UPDATE settings SET config_ticket_next_number = $new_config_ticket_next_number WHERE company_id = 1");
// Raise the ticket
- 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_created_by = $created_id, ticket_contact_id = $contact_id, ticket_client_id = $client_id, ticket_asset_id = $asset_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 = 'New', ticket_created_by = $created_id, ticket_contact_id = $contact_id, ticket_client_id = $client_id, ticket_asset_id = $asset_id");
$id = mysqli_insert_id($mysqli);
// Logging
@@ -366,7 +366,7 @@ if (mysqli_num_rows($sql_scheduled_tickets) > 0) {
// AUTO CLOSE TICKET - CLOSE
// Automatically silently closes tickets 22 hrs after the last chase
-// Check to make sure autoclose is enabled
+// Check to make sure auto-close is enabled
if ($config_ticket_autoclose == 1) {
$sql_tickets_to_chase = mysqli_query(
$mysqli,
@@ -420,7 +420,7 @@ if ($config_ticket_autoclose == 1) {
$ticket_reply = $ticket_reply_row['ticket_reply'];
$subject = "Ticket pending closure - [$ticket_prefix$ticket_number] - $ticket_subject";
- $body = "##- Please type your reply above this line -##
Hello, $contact_name
This is an automatic friendly reminder that your ticket regarding $ticket_subject will be closed, unless you respond.
--------------------------------
$ticket_reply--------------------------------
If your issue is resolved, you can ignore this email - the ticket will automatically close. If you need further assistance, please respond to this email.
Ticket: $ticket_prefix$ticket_number
Subject: $ticket_subject
Status: $ticket_status
Portal: https://$config_base_url/portal/ticket.php?id=$ticket_id
--
$company_name - Support
$config_ticket_from_email
$company_phone";
+ $body = "##- Please type your reply above this line -##
Hello, $contact_name
This is an automatic friendly reminder that your ticket regarding $ticket_subject will be closed, unless you respond.
--------------------------------
$ticket_reply--------------------------------
If your issue is resolved, you can ignore this email - the ticket will automatically close shortly. If you need further assistance, please respond to this email.
Ticket: $ticket_prefix$ticket_number
Subject: $ticket_subject
Status: $ticket_status
Portal: https://$config_base_url/portal/ticket.php?id=$ticket_id
--
$company_name - Support
$config_ticket_from_email
$company_phone";
$data = [
[
diff --git a/cron_ticket_email_parser.php b/cron_ticket_email_parser.php
index b168e405..e45ae046 100644
--- a/cron_ticket_email_parser.php
+++ b/cron_ticket_email_parser.php
@@ -106,7 +106,7 @@ $allowed_extensions = array('jpg', 'jpeg', 'gif', 'png', 'webp', 'pdf', 'txt', '
function addTicket($contact_id, $contact_name, $contact_email, $client_id, $date, $subject, $message, $attachments) {
// Access global variables
- global $mysqli, $company_name, $company_phone, $config_ticket_prefix, $config_ticket_client_general_notifications, $config_ticket_new_ticket_notification_email, $config_base_url, $config_ticket_from_name, $config_ticket_from_email, $config_smtp_host, $config_smtp_port, $config_smtp_encryption, $config_smtp_username, $config_smtp_password, $allowed_extensions;
+ global $mysqli,$config_app_name, $company_name, $company_phone, $config_ticket_prefix, $config_ticket_client_general_notifications, $config_ticket_new_ticket_notification_email, $config_base_url, $config_ticket_from_name, $config_ticket_from_email, $config_smtp_host, $config_smtp_port, $config_smtp_encryption, $config_smtp_username, $config_smtp_password, $allowed_extensions;
// Get the next Ticket Number and add 1 for the new ticket number
$ticket_number_sql = mysqli_fetch_array(mysqli_query($mysqli, "SELECT config_ticket_next_number FROM settings WHERE company_id = 1"));
@@ -118,7 +118,7 @@ function addTicket($contact_id, $contact_name, $contact_email, $client_id, $date
$message = nl2br($message);
$message = mysqli_escape_string($mysqli, "Email from: $contact_email at $date:-
$message");
- mysqli_query($mysqli, "INSERT INTO tickets SET ticket_prefix = '$config_ticket_prefix', ticket_number = $ticket_number, ticket_subject = '$subject', ticket_details = '$message', ticket_priority = 'Low', ticket_status = 'Pending-Assignment', ticket_created_by = 0, ticket_contact_id = $contact_id, 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 = '$message', ticket_priority = 'Low', ticket_status = 'New', ticket_created_by = 0, ticket_contact_id = $contact_id, ticket_client_id = $client_id");
$id = mysqli_insert_id($mysqli);
// Logging
@@ -162,9 +162,9 @@ function addTicket($contact_id, $contact_name, $contact_email, $client_id, $date
$data = [];
// E-mail client notification that ticket has been created
if ($config_ticket_client_general_notifications == 1) {
-
+
$subject_email = "Ticket created - [$config_ticket_prefix$ticket_number] - $subject";
- $body = "##- Please type your reply above this line -##
Hello $contact_name,
Thank you for your email. A ticket regarding \"$subject\" has been automatically created for you.
Ticket: $config_ticket_prefix$ticket_number
Subject: $subject
Status: Open
https://$config_base_url/portal/ticket.php?id=$id
--
$company_name - Support
$config_ticket_from_email
$company_phone";
+ $body = "##- Please type your reply above this line -##
Hello $contact_name,
Thank you for your email. A ticket regarding \"$subject\" has been automatically created for you.
Ticket: $config_ticket_prefix$ticket_number
Subject: $subject
Status: New
https://$config_base_url/portal/ticket.php?id=$id
--
$company_name - Support
$config_ticket_from_email
$company_phone";
$data[] = [
'from' => $config_ticket_from_email,
@@ -184,7 +184,7 @@ function addTicket($contact_id, $contact_name, $contact_email, $client_id, $date
$client_row = mysqli_fetch_array($client_sql);
$client_name = sanitizeInput($client_row['client_name']);
- $email_subject = "ITFlow - New Ticket - $client_name: $subject";
+ $email_subject = "$config_app_name - New Ticket - $client_name: $subject";
$email_body = "Hello,
This is a notification that a new ticket has been raised in ITFlow.
Client: $client_name
Priority: Low (email parsed)
Link: https://$config_base_url/ticket.php?ticket_id=$id
--------------------------------
$subject
$details";
$data[] = [
@@ -209,7 +209,7 @@ function addReply($from_email, $date, $subject, $ticket_number, $message, $attac
// Add email as a comment/reply to an existing ticket
// Access global variables
- global $mysqli, $company_name, $company_phone, $config_ticket_prefix, $config_base_url, $config_ticket_from_name, $config_ticket_from_email, $config_smtp_host, $config_smtp_port, $config_smtp_encryption, $config_smtp_username, $config_smtp_password, $allowed_extensions;
+ global $mysqli, $config_app_name, $company_name, $company_phone, $config_ticket_prefix, $config_base_url, $config_ticket_from_name, $config_ticket_from_email, $config_smtp_host, $config_smtp_port, $config_smtp_encryption, $config_smtp_username, $config_smtp_password, $allowed_extensions;
// Set default reply type
$ticket_reply_type = 'Client';
@@ -221,19 +221,22 @@ function addReply($from_email, $date, $subject, $ticket_number, $message, $attac
$message = mysqli_escape_string($mysqli, "Email from: $from_email at $date:-
$message");
// Lookup the ticket ID
- $row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT ticket_id, ticket_subject, ticket_status, ticket_contact_id, ticket_client_id, contact_email
+ $row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT ticket_id, ticket_subject, ticket_status, ticket_contact_id, ticket_client_id, contact_email, client_name
FROM tickets
LEFT JOIN contacts on tickets.ticket_contact_id = contacts.contact_id
+ LEFT JOIN clients on tickets.ticket_client_id = clients.client_id
WHERE ticket_number = $ticket_number LIMIT 1"));
if ($row) {
// Get ticket details
$ticket_id = intval($row['ticket_id']);
+ $ticket_subject = sanitizeInput($row['ticket_subject']);
$ticket_status = sanitizeInput($row['ticket_status']);
$ticket_reply_contact = intval($row['ticket_contact_id']);
$ticket_contact_email = sanitizeInput($row['contact_email']);
$client_id = intval($row['ticket_client_id']);
+ $client_name = sanitizeInput($row['client_name']);
// Check ticket isn't closed - tickets can't be re-opened
if ($ticket_status == "Closed") {
@@ -241,7 +244,7 @@ function addReply($from_email, $date, $subject, $ticket_number, $message, $attac
$email_subject = "Action required: This ticket is already closed";
$email_body = "Hi there,
You\'ve tried to reply to a ticket that is closed - we won\'t see your response.
Please raise a new ticket by sending a fresh e-mail to our support address below.
--
$company_name - Support
$config_ticket_from_email
$company_phone";
-
+
$data = [
[
'from' => $config_ticket_from_email,
@@ -252,7 +255,7 @@ function addReply($from_email, $date, $subject, $ticket_number, $message, $attac
'body' => $email_body
]
];
-
+
addToMailQueue($mysqli, $data);
return true;
@@ -332,8 +335,8 @@ function addReply($from_email, $date, $subject, $ticket_number, $message, $attac
$tech_email = sanitizeInput($tech_row['user_email']);
$tech_name = sanitizeInput($tech_row['user_name']);
- $subject = "Ticket updated - [$config_ticket_prefix$ticket_number] - $subject";
- $body = "##- Please type your reply above this line -##
Hello $tech_name,
A new reply has been added to the ticket \"$subject\".
Ticket: $config_ticket_prefix$ticket_number
Subject: $subject
Status: Open
https://$config_base_url/portal/ticket.php?id=$ticket_id
--
$company_name - Support
$config_ticket_from_email
$company_phone";
+ $email_subject = "$config_app_name - Ticket updated - [$config_ticket_prefix$ticket_number] $ticket_subject";
+ $email_body = "Hello $tech_name,
A new reply has been added to the below ticket, check ITFlow for full details.
Client: $client_name
Ticket: $config_ticket_prefix$ticket_number
Subject: $ticket_subject
https://$config_base_url/ticket.php?ticket_id=$ticket_id";
$data = [
[
@@ -341,8 +344,8 @@ function addReply($from_email, $date, $subject, $ticket_number, $message, $attac
'from_name' => $config_ticket_from_name,
'recipient' => $tech_email,
'recipient_name' => $tech_name,
- 'subject' => $subject,
- 'body' => $body
+ 'subject' => $email_subject,
+ 'body' => $email_body
]
];
@@ -353,7 +356,7 @@ function addReply($from_email, $date, $subject, $ticket_number, $message, $attac
}
// Update Ticket Last Response Field & set ticket to open as client has replied
- mysqli_query($mysqli, "UPDATE tickets SET ticket_status = 'Client-Replied' WHERE ticket_id = $ticket_id AND ticket_client_id = $client_id LIMIT 1");
+ mysqli_query($mysqli, "UPDATE tickets SET ticket_status = 'Open' WHERE ticket_id = $ticket_id AND ticket_client_id = $client_id LIMIT 1");
echo "Updated existing ticket.
";
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Ticket', log_action = 'Update', log_description = 'Email parser: Client contact $from_email updated ticket $config_ticket_prefix$ticket_number ($subject)', log_client_id = $client_id");
diff --git a/dashboard.php b/dashboard.php
index 19210214..bc4975f8 100644
--- a/dashboard.php
+++ b/dashboard.php
@@ -795,16 +795,17 @@ if ($user_config_dashboard_technical_enable == 1) {
$client_name = nullable_htmlentities($row['client_name']);
$contact_id = intval($row['ticket_contact_id']);
$contact_name = nullable_htmlentities($row['contact_name']);
- if ($ticket_status == "Pending-Assignment") {
+
+ if ($ticket_status == "New") {
$ticket_status_color = "danger";
- } elseif ($ticket_status == "Assigned") {
+ } elseif ($ticket_status == "Open") {
$ticket_status_color = "primary";
- } elseif ($ticket_status == "In-Progress") {
+ } 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";
- } else {
- $ticket_status_color = "secondary";
}
if ($ticket_priority == "High") {
@@ -1326,4 +1327,4 @@ if ($user_config_dashboard_technical_enable == 1) {
}
}
});
-
\ No newline at end of file
+
diff --git a/functions.php b/functions.php
index bf46ea31..f8a974a3 100644
--- a/functions.php
+++ b/functions.php
@@ -727,7 +727,7 @@ function sanitizeInput($input)
global $mysqli;
// Remove HTML and PHP tags
- $input = strip_tags($input);
+ $input = strip_tags((string) $input);
// Remove white space from beginning and end of input
$input = trim($input);
@@ -1029,7 +1029,11 @@ function addToMailQueue($mysqli, $data)
$recipient_name = strval($email['recipient_name']);
$subject = strval($email['subject']);
$body = strval($email['body']);
- $cal_str = mysqli_escape_string($mysqli,$email['cal_str']);
+
+ $cal_str = '';
+ if (isset($email['cal_str'])) {
+ $cal_str = mysqli_escape_string($mysqli,$email['cal_str']);
+ }
// Check if 'email_queued_at' is set and not empty
if (isset($email['queued_at']) && !empty($email['queued_at'])) {
@@ -1110,7 +1114,7 @@ function createiCalStrCancel($originaliCalStr) {
// Import the original iCal string
$cal_event = new ZCiCal($originaliCalStr);
-
+
// Iterate through the iCalendar object to find VEVENT nodes
foreach($cal_event->tree->child as $node) {
if($node->getName() == "VEVENT") {
@@ -1133,4 +1137,4 @@ function createiCalStrCancel($originaliCalStr) {
// Return the modified iCal string
return $cal_event->export();
}
-
+
diff --git a/get_settings.php b/get_settings.php
index 28df3104..5a3dbc2d 100644
--- a/get_settings.php
+++ b/get_settings.php
@@ -238,17 +238,10 @@ $asset_status_array = array (
);
$ticket_status_array = array (
- 'Pending-Assignment',
- 'Assigned',
- 'Client-Replied',
- 'In-Progress',
- 'Pending-Shipment',
- 'Pending-Client',
- 'Pending-Vendor',
- 'Scheduled',
- 'Closed',
'Open',
- 'Auto Close'
+ 'On Hold',
+ 'Auto Close',
+ 'Closed'
);
$industry_select_array = array(
diff --git a/portal/portal_post.php b/portal/portal_post.php
index b15e75c0..2e154385 100644
--- a/portal/portal_post.php
+++ b/portal/portal_post.php
@@ -33,7 +33,7 @@ if (isset($_POST['add_ticket'])) {
$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, "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_created_by = 0, 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 = 'New', ticket_created_by = 0, ticket_contact_id = $contact, ticket_client_id = $client_id");
$id = mysqli_insert_id($mysqli);
// Notify agent DL of the new ticket, if populated with a valid email
@@ -88,6 +88,40 @@ if (isset($_POST['add_ticket_comment'])) {
// Update Ticket Last Response Field & set ticket to open as client has replied
mysqli_query($mysqli, "UPDATE tickets SET ticket_status = 'Open' WHERE ticket_id = $ticket_id AND ticket_client_id = $session_client_id LIMIT 1");
+
+ // Get ticket details & Notify the assigned tech (if any)
+ $ticket_details = mysqli_fetch_array(mysqli_query($mysqli, "SELECT * FROM tickets LEFT JOIN clients ON ticket_client_id = client_id WHERE ticket_id = $ticket_id LIMIT 1"));
+
+ $ticket_number = intval($ticket_details['ticket_number']);
+ $ticket_assigned_to = intval($ticket_details['ticket_assigned_to']);
+ $ticket_subject = sanitizeInput($ticket_details['ticket_subject']);
+ $client_name = sanitizeInput($ticket_details['client_name']);
+
+ if ($ticket_details && $ticket_assigned_to !== 0) {
+
+ // Get tech details
+ $tech_details = mysqli_fetch_array(mysqli_query($mysqli, "SELECT user_email, user_name FROM users WHERE user_id = $ticket_assigned_to LIMIT 1"));
+ $tech_email = sanitizeInput($tech_details['user_email']);
+ $tech_name = sanitizeInput($tech_details['user_name']);
+
+ $subject = "$config_app_name Ticket updated - [$config_ticket_prefix$ticket_number] $ticket_subject";
+ $body = "Hello $tech_name,
A new reply has been added to the below ticket, check ITFlow for full details.
Client: $client_name
Ticket: $config_ticket_prefix$ticket_number
Subject: $ticket_subject
https://$config_base_url/ticket.php?ticket_id=$ticket_id";
+
+ $data = [
+ [
+ 'from' => $config_ticket_from_email,
+ 'from_name' => $config_ticket_from_name,
+ 'recipient' => $tech_email,
+ 'recipient_name' => $tech_name,
+ 'subject' => $subject,
+ 'body' => $body
+ ]
+ ];
+
+ addToMailQueue($mysqli, $data);
+
+ }
+
// Store any attached any files
if (!empty($_FILES)) {
diff --git a/post/ticket.php b/post/ticket.php
index 59e3d969..da61816f 100644
--- a/post/ticket.php
+++ b/post/ticket.php
@@ -11,9 +11,9 @@ if (isset($_POST['add_ticket'])) {
$client_id = intval($_POST['client']);
$assigned_to = intval($_POST['assigned_to']);
if ($assigned_to == 0) {
- $ticket_status = 'Pending-Assignment';
+ $ticket_status = 'New';
} else {
- $ticket_status = 'Assigned';
+ $ticket_status = 'Open';
}
$contact = intval($_POST['contact']);
$subject = sanitizeInput($_POST['subject']);
@@ -329,15 +329,14 @@ if (isset($_POST['assign_ticket'])) {
$ticket_id = intval($_POST['ticket_id']);
$assigned_to = intval($_POST['assigned_to']);
$ticket_status = sanitizeInput($_POST['ticket_status']);
- if ($ticket_status == 'Pending-Assignment' && $assigned_to > 0) {
- $ticket_status = 'Assigned';
+ if ($ticket_status == 'New' && $assigned_to !== 0) {
+ $ticket_status = 'Open';
}
// Allow for un-assigning tickets
if ($assigned_to == 0) {
- $ticket_reply = "Ticket unassigned, pending re-assignment.";
+ $ticket_reply = "Ticket unassigned.";
$agent_name = "No One";
- $ticket_status = "Pending-Assignment";
} else {
// 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");
@@ -356,13 +355,14 @@ if (isset($_POST['assign_ticket'])) {
}
// Get & verify ticket details
- $ticket_details_sql = mysqli_query($mysqli, "SELECT ticket_prefix, ticket_number, ticket_subject, ticket_client_id FROM tickets WHERE ticket_id = '$ticket_id' AND ticket_status != 'Closed'");
+ $ticket_details_sql = mysqli_query($mysqli, "SELECT ticket_prefix, ticket_number, ticket_subject, ticket_client_id, client_name FROM tickets LEFT JOIN clients ON ticket_client_id = client_id WHERE ticket_id = '$ticket_id' AND ticket_status != 'Closed'");
$ticket_details = mysqli_fetch_array($ticket_details_sql);
$ticket_prefix = sanitizeInput($ticket_details['ticket_prefix']);
$ticket_number = intval($ticket_details['ticket_number']);
$ticket_subject = sanitizeInput($ticket_details['ticket_subject']);
$client_id = intval($ticket_details['ticket_client_id']);
+ $client_name = sanitizeInput($ticket_details['client_name']);
if (!$ticket_subject) {
$_SESSION['alert_type'] = "error";
@@ -394,8 +394,8 @@ if (isset($_POST['assign_ticket'])) {
$config_ticket_from_email = sanitizeInput($config_ticket_from_email);
$company_name = sanitizeInput($session_company_name);
- $subject = "$config_app_name - ticket $ticket_prefix$ticket_number assigned to you";
- $body = "Hi $agent_name,
A ticket has been assigned to you!
Ticket Number: $ticket_prefix$ticket_number
Subject: $ticket_subject
Thanks,
$session_name
$company_name";
+ $subject = "$config_app_name - Ticket $ticket_prefix$ticket_number assigned to you - $ticket_subject";
+ $body = "Hi $agent_name,
A ticket has been assigned to you!
Client: $client_name
Ticket Number: $ticket_prefix$ticket_number
Subject: $ticket_subject
https://$config_base_url/ticket.php?ticket_id=$ticket_id
Thanks,
$session_name
$company_name";
// Email Ticket Agent
// Queue Mail
@@ -477,15 +477,14 @@ if (isset($_POST['bulk_assign_ticket'])) {
$ticket_subject = sanitizeInput($row['ticket_subject']);
$client_id = intval($row['ticket_client_id']);
- if ($ticket_status == 'Pending-Assignment' && $assign_to > 0) {
- $ticket_status = 'Assigned';
+ if ($ticket_status == 'New' && $assigned_to !== 0) {
+ $ticket_status = 'Open';
}
// Allow for un-assigning tickets
if ($assign_to == 0) {
$ticket_reply = "Ticket unassigned, pending re-assignment.";
$agent_name = "No One";
- $ticket_status = "Pending-Assignment";
} else {
// 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 = $assign_to AND user_settings.user_role > 1");
@@ -1437,8 +1436,8 @@ if (isset($_POST['set_billable_status'])) {
mysqli_query(
$mysqli,
"UPDATE tickets SET
- ticket_billable = '$billable_status'
- WHERE ticket_id = $ticket_id"
+ ticket_billable = '$billable_status'
+ WHERE ticket_id = $ticket_id"
);
//Logging
@@ -1475,7 +1474,7 @@ if (isset($_POST['edit_ticket_schedule'])) {
"UPDATE tickets SET
ticket_schedule = '$schedule',
ticket_onsite = '$onsite',
- ticket_status = 'Scheduled'
+ ticket_status = 'On Hold'
WHERE ticket_id = $ticket_id"
);
diff --git a/ticket.php b/ticket.php
index 9c57cb40..f42c7e1c 100644
--- a/ticket.php
+++ b/ticket.php
@@ -59,7 +59,7 @@ if (isset($_GET['ticket_id'])) {
$ticket_scheduled_for = nullable_htmlentities($row['ticket_schedule']);
$ticket_onsite = nullable_htmlentities($row['ticket_onsite']);
- //Set Ticket Bage Color based of priority
+ //Set Ticket Badge Color based of priority
if ($ticket_priority == "High") {
$ticket_priority_display = "$ticket_priority";
} elseif ($ticket_priority == "Medium") {
@@ -72,16 +72,16 @@ if (isset($_GET['ticket_id'])) {
$ticket_feedback = nullable_htmlentities($row['ticket_feedback']);
$ticket_status = nullable_htmlentities($row['ticket_status']);
- if ($ticket_status == "Pending-Assignment") {
+ if ($ticket_status == "New") {
$ticket_status_display = "$ticket_status";
- } elseif ($ticket_status == "Assigned") {
+ } elseif ($ticket_status == "Open") {
$ticket_status_display = "$ticket_status";
- } elseif ($ticket_status == "In-Progress") {
+ } elseif ($ticket_status == "On Hold") {
$ticket_status_display = "$ticket_status";
- } elseif ($ticket_status == "Closed") {
+ } elseif ($ticket_status == "Auto Close" || $ticket_status == "Closed") {
$ticket_status_display = "$ticket_status";
} else {
- $ticket_status_display = "$ticket_status";
+ $ticket_status_display = "$ticket_status"; // To be removed
}
$ticket_vendor_ticket_number = nullable_htmlentities($row['ticket_vendor_ticket_number']);
@@ -276,7 +276,7 @@ if (isset($_GET['ticket_id'])) {