When Adding new client add contact as important as well, when assigning a new contact as primary contact label them as important updated the logic add and edit logic to include the new field primary contact field under contacts

This commit is contained in:
johnnyq
2023-07-03 17:31:37 -04:00
parent 70a080a24e
commit 18274d532e
3 changed files with 15 additions and 7 deletions

View File

@@ -36,7 +36,7 @@ if (isset($_POST['add_client'])) {
//Add Location
if (!empty($location_phone) || !empty($address) || !empty($city) || !empty($state) || !empty($zip)) {
mysqli_query($mysqli, "INSERT INTO locations SET location_name = 'Primary', location_address = '$address', location_city = '$city', location_state = '$state', location_zip = '$zip', location_phone = '$location_phone', location_country = '$country', location_client_id = $client_id");
mysqli_query($mysqli, "INSERT INTO locations SET location_name = 'Primary', location_address = '$address', location_city = '$city', location_state = '$state', location_zip = '$zip', location_phone = '$location_phone', location_country = '$country', location_primary = 1, location_client_id = $client_id");
//Update Primay location in clients
$location_id = mysqli_insert_id($mysqli);
@@ -49,7 +49,7 @@ if (isset($_POST['add_client'])) {
//Add Contact
if (!empty($contact) || !empty($title) || !empty($contact_phone) || !empty($contact_mobile) || !empty($contact_email)) {
mysqli_query($mysqli, "INSERT INTO contacts SET contact_name = '$contact', contact_title = '$title', contact_phone = '$contact_phone', contact_extension = '$contact_extension', contact_mobile = '$contact_mobile', contact_email = '$contact_email', contact_client_id = $client_id");
mysqli_query($mysqli, "INSERT INTO contacts SET contact_name = '$contact', contact_title = '$title', contact_phone = '$contact_phone', contact_extension = '$contact_extension', contact_mobile = '$contact_mobile', contact_email = '$contact_email', contact_primary = 1, contact_important = 1, contact_client_id = $client_id");
//Update Primary contact in clients
$contact_id = mysqli_insert_id($mysqli);