Feature: Designate a client record as your organization currently only provdes a direct link when you click company name in top of the side nav

This commit is contained in:
johnnyq
2026-08-15 20:36:56 -04:00
parent 1514934726
commit 35ddd1a64d
8 changed files with 101 additions and 2 deletions

View File

@@ -1,8 +1,21 @@
<!-- Main Sidebar Container -->
<aside class="app-sidebar shadow d-print-none" data-bs-theme="dark">
<?php
/*
* The company name goes to your own company's client record once one is designated in
* Admin > Settings > Company Details, and falls back to the dashboard otherwise. The
* access check keeps a restricted agent from being sent to a client they would only be
* bounced off, and costs no query - the permission arrays are already in the session.
*/
$brand_link = "/agent/dashboard.php";
if (!empty($config_internal_client_id) && lookupUserPermission("module_client") >= 1 && hasClientAccess($config_internal_client_id)) {
$brand_link = "/agent/client_overview.php?client_id=" . intval($config_internal_client_id);
}
?>
<div class="sidebar-brand">
<a class="brand-link" href="/agent/dashboard.php">
<a class="brand-link" href="<?= $brand_link ?>">
<span class="brand-text h4 mb-0"><?= escapeHtml($session_company_name) ?></span>
</a>
</div>

View File

@@ -348,6 +348,9 @@ if (isset($_GET['delete_client'])) {
//Finally Remove the Client
mysqli_query($mysqli, "DELETE FROM clients WHERE client_id = $client_id");
// Don't leave the company's own-client designation pointing at a client that is gone
mysqli_query($mysqli, "UPDATE settings SET config_internal_client_id = 0 WHERE config_internal_client_id = $client_id");
logAudit("Client", "Deleted", "$session_name deleted Client $client_name and all associated data");
flashAlert("Client <strong>$client_name</strong> deleted along with all associated data", 'error');