Fix Creating Ticket under Main Ticket - Was assigning the primary contact the old way changed it to the new way

This commit is contained in:
johnnyq 2023-07-12 16:21:42 -04:00
parent cb20894fc0
commit c5eb4bddd2
1 changed files with 2 additions and 2 deletions

View File

@ -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