From 8fa74490846fc1fdb42e9e82f768d4b00fbed421 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Wed, 12 Jul 2023 16:32:34 -0400 Subject: [PATCH] Fix Creating Scheduled Tickets under Main Scheduled Tickets - Was assigning the primary contact the old way changed it to the new way --- post/ticket.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/post/ticket.php b/post/ticket.php index f924bbf8..5ec11533 100644 --- a/post/ticket.php +++ b/post/ticket.php @@ -655,10 +655,11 @@ if (isset($_POST['add_scheduled_ticket'])) { require_once('post/scheduled_ticket_model.php'); $start_date = sanitizeInput($_POST['start_date']); + // If no contact is selected automatically choose the primary contact for the client if ($client_id > 0 && $contact_id == 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_id = intval($row['primary_contact']); + $contact_id = intval($row['contact_id']); } // Add scheduled ticket