From 097891ed96f7d39f682750842f54ff42f6829c7d Mon Sep 17 00:00:00 2001 From: johnnyq Date: Fri, 28 Aug 2026 00:26:40 -0400 Subject: [PATCH] Add Primary Location / Contact if missing link modals --- agent/clients.php | 20 ++++++++++++++++++-- agent/includes/inc_client_top_head.php | 24 +++++++++++++++++++++++- agent/modals/contact/contact_add.php | 6 +++++- agent/modals/location/location_add.php | 6 +++++- 4 files changed, 51 insertions(+), 5 deletions(-) diff --git a/agent/clients.php b/agent/clients.php index c6706b4b1..406c7f8ec 100644 --- a/agent/clients.php +++ b/agent/clients.php @@ -458,7 +458,15 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); = 2) { ?> + + Add Primary Contact + + - + + = 2) { ?> + + Add Primary Location + + + = 1) && $config_module_enable_accounting == 1) { ?> diff --git a/agent/includes/inc_client_top_head.php b/agent/includes/inc_client_top_head.php index ec8923451..acd936f05 100644 --- a/agent/includes/inc_client_top_head.php +++ b/agent/includes/inc_client_top_head.php @@ -69,7 +69,21 @@
Primary Location
- + = 2 to + match enforceUserPermission() in agent/post/location.php; + without that a read-only user would get a link that 403s. */ ?> + = 2) { ?> +
+ + Add Primary Location + +
+
" target="_blank"> @@ -101,6 +115,14 @@
Primary Contact
= 2) { ?> +
+ + Add Primary Contact + +
+
diff --git a/agent/modals/contact/contact_add.php b/agent/modals/contact/contact_add.php index 94b419f43..91cf43ec9 100644 --- a/agent/modals/contact/contact_add.php +++ b/agent/modals/contact/contact_add.php @@ -4,6 +4,10 @@ require_once '../../../includes/modal_header.php'; $client_id = intval($_GET['client_id'] ?? 0); +// Opened from an "Add Primary Contact" link, so the box below starts ticked. +// A default, not a lock - it is still a normal checkbox. +$contact_primary_default = !empty($_GET['primary']); + if ($client_id) { $sql_location_select = mysqli_query($mysqli, "SELECT location_id, location_name FROM locations WHERE location_archived_at IS NULL AND location_client_id = $client_id ORDER BY location_name ASC"); } else { @@ -91,7 +95,7 @@ ob_start();
- + >
diff --git a/agent/modals/location/location_add.php b/agent/modals/location/location_add.php index da96ea507..2b8e82192 100644 --- a/agent/modals/location/location_add.php +++ b/agent/modals/location/location_add.php @@ -4,6 +4,10 @@ require_once '../../../includes/modal_header.php'; $client_id = intval($_GET['client_id'] ?? 0); +// Opened from an "Add Primary Location" link, so the box below starts ticked. +// A default, not a lock - it is still a normal checkbox. +$location_primary_default = !empty($_GET['primary']); + ob_start(); ?> @@ -70,7 +74,7 @@ ob_start();
- + >