From fe2d880b51ebaadfd40cb419aab312e08593a7a1 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sat, 21 Nov 2026 16:25:16 -0500 Subject: [PATCH] QoL 72: assets list badges for any flagged date of your own asset types alongside the UPS battery, and the AI client document listing firewalls, servers, NAS, virtual machines, switches and access points ahead of other types --- admin/modals/asset_type/asset_type_form.php | 2 +- agent/assets.php | 15 ++++++++++----- functions/ai_document.php | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/admin/modals/asset_type/asset_type_form.php b/admin/modals/asset_type/asset_type_form.php index c3bd3c9b6..a446283b9 100644 --- a/admin/modals/asset_type/asset_type_form.php +++ b/admin/modals/asset_type/asset_type_form.php @@ -59,7 +59,7 @@ $t_detail_row = function ($key, array $d) { Unit -
+
>
diff --git a/agent/assets.php b/agent/assets.php index cac4f0046..eacbf152c 100644 --- a/agent/assets.php +++ b/agent/assets.php @@ -200,7 +200,7 @@ $assets = []; while ($row = mysqli_fetch_assoc($sql)) { $assets[intval($row['asset_id'])] = $row; } -// Each one's details - its type's (functions/asset_type.php): a UPS battery due is flagged like a warranty, and Details lists them +// Each one's details - its type's (functions/asset_type.php): a UPS battery or another flagged date due is flagged like a warranty, and Details lists them $asset_list_specs = assetSpecsFor(array_keys($assets)); // Tags, rack positions and what its RMM says of each for the whole page in three queries, not three per row @@ -569,7 +569,10 @@ $search_noun = $type_filter ? $asset_type_tabs[$type_filter]['label'] : 'assets' $asset_tone = assetTypeTone($row['asset_type']); $device_icon = getAssetIcon($row['asset_type']); $asset_spec_rows = assetSpecRows($row['asset_type'], $asset_list_specs[$asset_id] ?? [], $client_id); - $asset_battery = $asset_spec_rows['battery_replace']['flag'] ?? null; + // Dates its type flags as they near - a UPS battery, or one of your own types' - each a badge once due soon or past + $asset_flags = array_filter($asset_spec_rows, function ($spec_row) { + return $spec_row['flag'] && $spec_row['flag']['tone'] !== 'success'; + }); $contact_name = escapeHtml($row['contact_name']); $contact_archived = !empty($row['contact_archived_at']); @@ -627,9 +630,11 @@ $search_noun = $type_filter ? $asset_type_tabs[$type_filter]['label'] : 'assets' Warranty - - - Battery + $flag_row) { + $flag = $flag_row['flag']; + $battery = $flag_key === 'battery_replace'; ?> + > + diff --git a/functions/ai_document.php b/functions/ai_document.php index fb8d416fc..139d96a81 100644 --- a/functions/ai_document.php +++ b/functions/ai_document.php @@ -76,7 +76,7 @@ function aiClientProfile($client_id) { } $list('Servers and network gear', "SELECT asset_name, asset_type, asset_make, asset_model, asset_os FROM assets WHERE asset_client_id = $client_id AND asset_archived_at IS NULL AND (" . assetTypeGroupSql('server') . " OR " . assetTypeGroupSql('virtual') . " OR " . assetTypeGroupSql('network') . " OR " . assetTypeGroupSql('power') . ") - ORDER BY FIELD(asset_type, 'Firewall/Router', 'Server', 'NAS', 'Virtual Machine', 'Switch', 'Access Point'), asset_name LIMIT 25", + ORDER BY FIELD(asset_type, 'Firewall/Router', 'Server', 'NAS', 'Virtual Machine', 'Switch', 'Access Point') = 0, FIELD(asset_type, 'Firewall/Router', 'Server', 'NAS', 'Virtual Machine', 'Switch', 'Access Point'), asset_type, asset_name LIMIT 25", function ($r) { return $r['asset_name'] . ' - ' . $r['asset_type'] . (trim($r['asset_make'] . ' ' . $r['asset_model']) !== '' ? ', ' . trim($r['asset_make'] . ' ' . $r['asset_model']) : '') . ($r['asset_os'] ? ", {$r['asset_os']}" : ''); }); $list('Networks', "SELECT network_name, network_type, network_vlan, network, network_gateway FROM networks WHERE network_client_id = $client_id AND network_archived_at IS NULL ORDER BY network_name LIMIT 15", function ($r) { return $r['network_name'] . ($r['network_type'] ? " ({$r['network_type']})" : '') . ($r['network'] ? " - {$r['network']}" : '') . ($r['network_vlan'] ? ", VLAN {$r['network_vlan']}" : '') . ($r['network_gateway'] ? ", gateway {$r['network_gateway']}" : ''); });