From abcd983503573409b7b9ea7cdd92caf952f9d63c Mon Sep 17 00:00:00 2001 From: Alex <40072887+alexdcrane@users.noreply.github.com> Date: Fri, 3 Oct 2025 15:36:43 -0700 Subject: [PATCH] Contact Edit: Fix primary setting default values (#7549) * Contact Edit: Fix primary setting default values * Update contact_address_edit.php * Update contact_attachment_edit.php * Update contact_edit.php * Update contact_email_edit.php * Update contact_phone_edit.php * Update contact_setting_edit.php * Update contact_url_edit.php * Update contact_edit.php --- core/contacts/contact_address_edit.php | 3 +++ core/contacts/contact_attachment_edit.php | 3 +++ core/contacts/contact_edit.php | 8 ++++---- core/contacts/contact_email_edit.php | 3 +++ core/contacts/contact_phone_edit.php | 6 ++++-- core/contacts/contact_setting_edit.php | 8 +++++--- core/contacts/contact_url_edit.php | 4 +++- 7 files changed, 25 insertions(+), 10 deletions(-) diff --git a/core/contacts/contact_address_edit.php b/core/contacts/contact_address_edit.php index 2e6209af2a..3fff4e40b2 100644 --- a/core/contacts/contact_address_edit.php +++ b/core/contacts/contact_address_edit.php @@ -217,6 +217,9 @@ unset($sql, $parameters, $row); } +//set the defaults + if ($address_primary === null) { $address_primary = false; } + //create token $object = new token; $token = $object->create($_SERVER['PHP_SELF']); diff --git a/core/contacts/contact_attachment_edit.php b/core/contacts/contact_attachment_edit.php index 48c995b64c..db1c00072a 100644 --- a/core/contacts/contact_attachment_edit.php +++ b/core/contacts/contact_attachment_edit.php @@ -182,6 +182,9 @@ unset($sql, $parameters, $row); } +//set the defaults + if ($attachment_primary === null) { $attachment_primary = false; } + //create token $object = new token; $token = $object->create($_SERVER['PHP_SELF']); diff --git a/core/contacts/contact_edit.php b/core/contacts/contact_edit.php index acadde5953..c0a7883dd4 100644 --- a/core/contacts/contact_edit.php +++ b/core/contacts/contact_edit.php @@ -740,7 +740,7 @@ $contact_phones[$x]['phone_country_code'] = ''; $contact_phones[$x]['phone_number'] = ''; $contact_phones[$x]['phone_extension'] = ''; - $contact_phones[$x]['phone_primary'] = ''; + $contact_phones[$x]['phone_primary'] = false; $contact_phones[$x]['phone_description'] = ''; } @@ -778,7 +778,7 @@ $contact_addresses[$x]['address_country'] = ''; $contact_addresses[$x]['address_latitude'] = ''; $contact_addresses[$x]['address_longitude'] = ''; - $contact_addresses[$x]['address_primary'] = ''; + $contact_addresses[$x]['address_primary'] = false; $contact_addresses[$x]['address_description'] = ''; } @@ -806,7 +806,7 @@ $contact_emails[$x]['contact_email_uuid'] = uuid(); $contact_emails[$x]['email_label'] = ''; $contact_emails[$x]['email_address'] = ''; - $contact_emails[$x]['email_primary'] = ''; + $contact_emails[$x]['email_primary'] = false; $contact_emails[$x]['email_description'] = ''; } @@ -836,7 +836,7 @@ $contact_urls[$x]['url_type'] = ''; $contact_urls[$x]['url_label'] = ''; $contact_urls[$x]['url_address'] = ''; - $contact_urls[$x]['url_primary'] = ''; + $contact_urls[$x]['url_primary'] = false; $contact_urls[$x]['url_description'] = ''; } diff --git a/core/contacts/contact_email_edit.php b/core/contacts/contact_email_edit.php index eba842766e..8c7f3d6aea 100644 --- a/core/contacts/contact_email_edit.php +++ b/core/contacts/contact_email_edit.php @@ -180,6 +180,9 @@ if (!empty($_GET["contact_uuid"]) && is_uuid($_GET["contact_uuid"])) { unset($sql, $parameters, $row); } +//set the defaults + if ($email_primary === null) { $email_primary = false; } + //create token $object = new token; $token = $object->create($_SERVER['PHP_SELF']); diff --git a/core/contacts/contact_phone_edit.php b/core/contacts/contact_phone_edit.php index b088b5e342..83f49c4209 100644 --- a/core/contacts/contact_phone_edit.php +++ b/core/contacts/contact_phone_edit.php @@ -53,7 +53,6 @@ $phone_country_code = ''; $phone_number = ''; $phone_extension = ''; - $phone_primary = ''; $phone_description = ''; //action add or update @@ -243,6 +242,9 @@ unset($sql, $parameters, $row); } +//set the defaults + if ($phone_primary === null) { $phone_primary = false; } + //create token $object = new token; $token = $object->create($_SERVER['PHP_SELF']); @@ -395,8 +397,8 @@ echo " \n"; } echo " \n"; if ($input_toggle_style_switch) { echo " \n"; diff --git a/core/contacts/contact_setting_edit.php b/core/contacts/contact_setting_edit.php index a4a3d8b503..26e94fd180 100644 --- a/core/contacts/contact_setting_edit.php +++ b/core/contacts/contact_setting_edit.php @@ -48,7 +48,6 @@ $contact_setting_name = ''; $contact_setting_value = ''; $contact_setting_order = ''; - $contact_setting_enabled = ''; $contact_setting_description = ''; //action add or update @@ -75,7 +74,7 @@ $contact_setting_name = strtolower($_POST["contact_setting_name"]); $contact_setting_value = $_POST["contact_setting_value"]; $contact_setting_order = $_POST["contact_setting_order"] ?? null; - $contact_setting_enabled = strtolower($_POST["contact_setting_enabled"]) ?? false; + $contact_setting_enabled = strtolower($_POST["contact_setting_enabled"]); $contact_setting_description = $_POST["contact_setting_description"]; } @@ -195,6 +194,9 @@ unset($sql, $parameters, $row); } +//set the defaults + if ($contact_setting_enabled === null) { $contact_setting_enabled = true; } + //create token $object = new token; $token = $object->create($_SERVER['PHP_SELF']); @@ -309,8 +311,8 @@ echo " \n"; } echo " \n"; if ($input_toggle_style_switch) { echo " \n"; diff --git a/core/contacts/contact_url_edit.php b/core/contacts/contact_url_edit.php index 0f123eb50d..986247406d 100644 --- a/core/contacts/contact_url_edit.php +++ b/core/contacts/contact_url_edit.php @@ -46,7 +46,6 @@ $url_label = ''; $url_label_custom = ''; $url_address = ''; - $url_primary = ''; $url_description = ''; //action add or update @@ -183,6 +182,9 @@ unset($sql, $parameters, $row); } +//set the defaults + if ($url_primary === null) { $url_primary = false; } + //create token $object = new token; $token = $object->create($_SERVER['PHP_SELF']);