From c98be4c3441351d567212c1c48fed25a185699ae Mon Sep 17 00:00:00 2001 From: Marcus Hill Date: Sat, 8 Jan 2022 16:40:04 +0000 Subject: [PATCH] Add support for public/internal updates, using the existing 'email update to client' checkbox --- post.php | 11 +++++-- ticket.php | 88 ++++++++++++++++++++++++++++-------------------------- 2 files changed, 55 insertions(+), 44 deletions(-) diff --git a/post.php b/post.php index f11de2ee..a634c9b0 100644 --- a/post.php +++ b/post.php @@ -4919,7 +4919,7 @@ if(isset($_POST['assign_ticket'])){ mysqli_query($mysqli,"UPDATE tickets SET ticket_updated_at = NOW(), ticket_assigned_to = $assigned_to WHERE ticket_id = $ticket_id AND company_id = $session_company_id"); - mysqli_query($mysqli,"INSERT INTO ticket_replies SET ticket_reply = 'Ticket re-assigned', ticket_reply_created_at = NOW(), ticket_reply_by = $session_user_id, ticket_reply_ticket_id = $ticket_id, company_id = $session_company_id") or die(mysqli_error($mysqli)); + mysqli_query($mysqli,"INSERT INTO ticket_replies SET ticket_reply = 'Ticket re-assigned', ticket_reply_type = 'Internal', ticket_reply_created_at = NOW(), ticket_reply_by = $session_user_id, ticket_reply_ticket_id = $ticket_id, company_id = $session_company_id") or die(mysqli_error($mysqli)); //Logging mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Ticket', log_action = 'Modified', log_description = '$subject', log_created_at = NOW(), company_id = $session_company_id, log_user_id = $session_user_id"); @@ -4951,7 +4951,14 @@ if(isset($_POST['add_ticket_reply'])){ $ticket_status = trim(mysqli_real_escape_string($mysqli,$_POST['status'])); $ticket_reply_time_worked = trim(mysqli_real_escape_string($mysqli,$_POST['time'])); - mysqli_query($mysqli,"INSERT INTO ticket_replies SET ticket_reply = '$ticket_reply', ticket_reply_time_worked = '$ticket_reply_time_worked', ticket_reply_created_at = NOW(), ticket_reply_by = $session_user_id, ticket_reply_ticket_id = $ticket_id, company_id = $session_company_id") or die(mysqli_error($mysqli)); + if(isset($_POST['public_reply_type'])){ + $ticket_reply_type = 'Public'; + } + else{ + $ticket_reply_type = 'Internal'; + } + + mysqli_query($mysqli,"INSERT INTO ticket_replies SET ticket_reply = '$ticket_reply', ticket_reply_time_worked = '$ticket_reply_time_worked', ticket_reply_type = '$ticket_reply_type', ticket_reply_created_at = NOW(), ticket_reply_by = $session_user_id, ticket_reply_ticket_id = $ticket_id, company_id = $session_company_id") or die(mysqli_error($mysqli)); //UPDATE Ticket Last Response Field mysqli_query($mysqli,"UPDATE tickets SET ticket_status = '$ticket_status', ticket_updated_at = NOW() WHERE ticket_id = $ticket_id AND company_id = $session_company_id") or die(mysqli_error($mysqli)); diff --git a/ticket.php b/ticket.php index ad8fa89d..230d698c 100644 --- a/ticket.php +++ b/ticket.php @@ -1,7 +1,7 @@ -

Nothing to see here

Go Back"; include("footer.php"); - + }else{ $row = mysqli_fetch_array($sql); @@ -31,7 +31,7 @@ if(isset($_GET['ticket_id'])){ $client_net_terms = $config_default_net_terms; } - + $ticket_prefix = $row['ticket_prefix']; $ticket_number = $row['ticket_number']; $ticket_category = $row['ticket_category']; @@ -69,7 +69,7 @@ if(isset($_GET['ticket_id'])){ $contact_phone = formatPhoneNumber($row['contact_phone']); $contact_extension = $row['contact_extension']; $contact_mobile = formatPhoneNumber($row['contact_mobile']); - + $asset_id = $row['asset_id']; $asset_name = htmlentities($row['asset_name']); $asset_type = htmlentities($row['asset_type']); @@ -149,6 +149,7 @@ if(isset($_GET['ticket_id'])){ while($row = mysqli_fetch_array($sql)){; $ticket_reply_id = $row['ticket_reply_id']; $ticket_reply = $row['ticket_reply']; + $ticket_reply_type = $row['ticket_reply_type']; $ticket_reply_created_at = $row['ticket_reply_created_at']; $ticket_reply_updated_at = $row['ticket_reply_updated_at']; $ticket_reply_by = $row['ticket_reply_by']; @@ -159,8 +160,9 @@ if(isset($_GET['ticket_id'])){ $ticket_reply_time_worked = date_create($row['ticket_reply_time_worked']); ?> -
- +
mb-3"> + +

@@ -171,7 +173,7 @@ if(isset($_GET['ticket_id'])){ - @@ -184,7 +186,7 @@ if(isset($_GET['ticket_id'])){

- +
@@ -234,38 +236,40 @@ if(isset($_GET['ticket_id'])){
- +
+
+ +
+
-
-
-
- - + + +
+
+
+ + +
-
- + -
- -
-
- + - +
-
+

Client

@@ -276,7 +280,7 @@ if(isset($_GET['ticket_id'])){
-
+

Contact


@@ -303,16 +307,16 @@ if(isset($_GET['ticket_id'])){ ?>
-
-
@@ -324,7 +328,7 @@ if(isset($_GET['ticket_id'])){
-
+

Asset


@@ -349,8 +353,8 @@ if(isset($_GET['ticket_id'])){ ?>
-
@@ -358,7 +362,7 @@ if(isset($_GET['ticket_id'])){ -
+

Details

@@ -375,15 +379,15 @@ if(isset($_GET['ticket_id'])){