From c5eb4bddd29e0ec8d5982f6e4e8373ba85fe919e Mon Sep 17 00:00:00 2001 From: johnnyq Date: Wed, 12 Jul 2023 16:21:42 -0400 Subject: [PATCH] Fix Creating Ticket under Main Ticket - Was assigning the primary contact the old way changed it to the new way --- post/ticket.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/post/ticket.php b/post/ticket.php index 4883de5d..f924bbf8 100644 --- a/post/ticket.php +++ b/post/ticket.php @@ -20,9 +20,9 @@ if (isset($_POST['add_ticket'])) { // If no contact is selected automatically choose the primary contact for the client if ($client_id > 0 && $contact == 0) { - $sql = mysqli_query($mysqli,"SELECT primary_contact FROM clients WHERE client_id = $client_id"); + $sql = mysqli_query($mysqli,"SELECT contact_id FROM contacts WHERE contact_client_id = $client_id AND contact_primary = 1"); $row = mysqli_fetch_array($sql); - $contact = intval($row['primary_contact']); + $contact = intval($row['contact_id']); } //Get the next Ticket Number and add 1 for the new ticket number