diff --git a/admin/database_updates/2.7.1.php b/admin/database_updates/2.7.1.php new file mode 100644 index 000000000..771d2c061 --- /dev/null +++ b/admin/database_updates/2.7.1.php @@ -0,0 +1,17 @@ + Settings > Company Details sets it. + // + // 0 means no client is designated, which is every existing install - nothing changes + // until an administrator chooses one. + mysqli_query($mysqli, "ALTER TABLE `settings` + ADD COLUMN `config_internal_client_id` int(11) NOT NULL DEFAULT 0"); diff --git a/admin/post/settings_company.php b/admin/post/settings_company.php index 9c38c92f2..e8cdbb767 100644 --- a/admin/post/settings_company.php +++ b/admin/post/settings_company.php @@ -42,8 +42,18 @@ if (isset($_POST['edit_company'])) { } } + // The client record standing in for this company. Verified against the clients table + // rather than trusted from the POST, so a stale or hand-made value cannot leave the + // sidebar pointing at a client that no longer exists. 0 clears the designation. + $internal_client_id = intval($_POST['internal_client_id'] ?? 0); + if ($internal_client_id !== 0 && !mysqli_num_rows(mysqli_query($mysqli, "SELECT client_id FROM clients WHERE client_id = $internal_client_id LIMIT 1"))) { + $internal_client_id = 0; + } + mysqli_query($mysqli,"UPDATE companies SET company_name = '$name', company_address = '$address', company_city = '$city', company_state = '$state', company_zip = '$zip', company_country = '$country', company_phone_country_code = '$phone_country_code', company_phone = '$phone', company_email = '$email', company_website = '$website', company_tax_id = '$tax_id' WHERE company_id = 1"); + mysqli_query($mysqli,"UPDATE settings SET config_internal_client_id = $internal_client_id WHERE company_id = 1"); + logAudit("Settings", "Edit", "$session_name edited company details"); flashAlert("Company $name edited"); diff --git a/admin/settings_company.php b/admin/settings_company.php index 231b00453..8d44de1fa 100644 --- a/admin/settings_company.php +++ b/admin/settings_company.php @@ -141,6 +141,27 @@ $company_initials = escapeHtml(initials($company_name));
+
+ +
+ + +
+ If you keep a client record for your own company - for internal tickets, documentation, assets and credentials - point it out here. Your company name in the sidebar then links straight to it. +
+ +
+ diff --git a/agent/includes/side_nav.php b/agent/includes/side_nav.php index 45acd7e0b..b97cd2026 100644 --- a/agent/includes/side_nav.php +++ b/agent/includes/side_nav.php @@ -1,8 +1,21 @@