Update logic for adding and editing primary location

This commit is contained in:
johnnyq
2023-07-03 17:40:14 -04:00
parent 18274d532e
commit 567c01ce3f
3 changed files with 17 additions and 7 deletions

View File

@@ -21,7 +21,7 @@ if (isset($_POST['add_contact'])) {
$contact_id = mysqli_insert_id($mysqli);
//Update Primary contact in clients if primary contact is checked
if ($contact_primary > 0) {
if ($contact_primary == 1) {
// Old way of adding contact_primary Set for Removal
mysqli_query($mysqli,"UPDATE clients SET primary_contact = $contact_id WHERE client_id = $client_id");
@@ -79,7 +79,7 @@ if (isset($_POST['edit_contact'])) {
mysqli_query($mysqli,"UPDATE contacts SET contact_name = '$name', contact_title = '$title', contact_phone = '$phone', contact_extension = '$extension', contact_mobile = '$mobile', contact_email = '$email', contact_pin = '$pin', contact_notes = '$notes', contact_important = $contact_important, contact_billing = $contact_billing, contact_technical = $contact_technical, contact_auth_method = '$auth_method', contact_department = '$department', contact_location_id = $location_id WHERE contact_id = $contact_id");
// Update Primary contact in clients if primary contact is checked
if ($contact_primary > 0) {
if ($contact_primary == 1) {
// Old way of adding contact_primary Set for Removal
mysqli_query($mysqli,"UPDATE clients SET primary_contact = $contact_id WHERE client_id = $client_id");