0 LEFT JOIN products ON product_id = asset_product_id AND asset_product_id > 0 WHERE asset_id = $asset_id " . clientScopeSql('asset_client_id') . " $client_query LIMIT 1 "); if (mysqli_num_rows($sql) == 0) { echo "

Nothing to see here

Go Back
"; } else { $row = mysqli_fetch_assoc($sql); $asset_row = $row; // raw, for the quick pickers - $row gets reused below $client_id = intval($row['client_id']); $client_name = escapeHtml($row['client_name']); $asset_id = intval($row['asset_id']); $asset_type = escapeHtml($row['asset_type']); $asset_name = escapeHtml($row['asset_name']); $asset_description = escapeHtml($row['asset_description']); $asset_make_model = escapeHtml(trim($row['asset_make'] . ' ' . $row['asset_model'])); $asset_serial = escapeHtml($row['asset_serial']); $asset_os = escapeHtml($row['asset_os']); $asset_os_icon = assetOsIcon($row['asset_os']); $asset_links = assetLinks($row['asset_uri'], $row['asset_uri_2'], $row['asset_uri_client']); $asset_status_pill = assetStatusPill($row['asset_status']); $asset_purchase_reference = escapeHtml($row['asset_purchase_reference']); $asset_purchase_date = escapeHtml($row['asset_purchase_date']); $asset_purchase_age = assetAge($row['asset_purchase_date']); $asset_install_date = escapeHtml($row['asset_install_date']); $asset_install_age = assetAge($row['asset_install_date']); $asset_warranty = assetWarranty($row['asset_warranty_expire']); $asset_photo = escapeHtml($row['asset_photo']); $asset_physical_location = escapeHtml($row['asset_physical_location']); $asset_notes = escapeHtml($row['asset_notes']); $asset_favorite = intval($row['asset_favorite']); $asset_created_at = escapeHtml($row['asset_created_at']); $asset_archived_at = escapeHtml($row['asset_archived_at']); $asset_vendor_id = intval($row['asset_vendor_id']); $asset_contact_id = intval($row['asset_contact_id']); $asset_tone = assetTypeTone($row['asset_type']); // Its type's details, what its OS field is called on it, and the fields it has (functions/asset_type.php) $asset_spec_rows = assetSpecRows($row['asset_type'], assetSpecs($asset_id), intval($row['asset_client_id'])); $asset_os_label = assetTypeOsLabel($row['asset_type']) === 'Firmware' ? 'Firmware' : 'OS'; $asset_has_contact = assetTypeHasField($row['asset_type'], 'contact'); $asset_has_warranty = assetTypeHasField($row['asset_type'], 'warranty'); // The virtual machines that run on it $asset_guests = assetGuests($asset_id, intval($row['asset_client_id'])); // Sold to the client on one of our invoices, from a catalog product $can_sales = lookupUserPermission('module_sales') >= 1; $asset_invoice_id = intval($row['asset_invoice_id']); $asset_sold_number = $row['invoice_number'] !== null ? escapeHtml($row['invoice_prefix'] . $row['invoice_number']) : ''; $asset_sold_date = escapeHtml((string) $row['invoice_date']); $asset_product_id = intval($row['asset_product_id']); $asset_product_name = escapeHtml((string) $row['product_name']); $device_icon = getAssetIcon($row['asset_type']); $asset_ip = escapeHtml($row['interface_ip']); $asset_ipv6 = escapeHtml($row['interface_ipv6']); $asset_nat_ip = escapeHtml($row['interface_nat_ip']); $asset_mac = escapeHtml($row['interface_mac']); $asset_network_id = intval($row['interface_network_id']); $asset_network_type = networkType($row); $network_name = escapeHtml($row['network_name']); $vendor_name = escapeHtml($row['vendor_name']); $contact_name = escapeHtml($row['contact_name']); $contact_archived = !empty($row['contact_archived_at']); $location_name = escapeHtml($row['location_name']); $location_archived = !empty($row['location_archived_at']); $can_edit = lookupUserPermission('module_support') >= 2; $can_delete = lookupUserPermission('module_support') >= 3; $can_credentials = lookupUserPermission('module_credential') >= 1; $can_credentials_edit = lookupUserPermission('module_credential') >= 2; // The rack it sits in, if any $asset_rack = rackPositionForAsset($asset_id); if ($asset_rack) { $asset_rack_id = intval($asset_rack['rack_id']); $asset_rack_name = escapeHtml($asset_rack['rack_name']); $asset_rack_position = rackPositionLabel($asset_rack['unit_start_number'], $asset_rack['unit_end_number']) . ', ' . ($asset_rack['unit_face'] === 'rear' ? 'rear' : 'front'); } // Override Tab Title // No Sanitizing needed as this var will opnly be used in the tab title $page_title = $row['asset_name']; // Tags - functions/tags.php $asset_tags_display = tagPills('asset', $asset_id, tagsForRecord('asset', $asset_id), "assets.php?client_id=$client_id&"); // Tickets - linked as the ticket's asset or as one of its other assets (functions/ticket.php) $related_tickets = ticketRows(ticketAssetSql($asset_id)); $ticket_count = count($related_tickets); $ticket_open_count = count(array_filter(array_column($related_tickets, 'is_open'))); // Recurring tickets $sql_related_recurring_tickets = mysqli_query($mysqli, "SELECT recurring_tickets.recurring_ticket_id, recurring_ticket_subject, recurring_ticket_priority, recurring_ticket_frequency, recurring_ticket_next_run, recurring_ticket_paused_at FROM recurring_tickets LEFT JOIN recurring_ticket_assets ON recurring_tickets.recurring_ticket_id = recurring_ticket_assets.recurring_ticket_id WHERE recurring_ticket_asset_id = $asset_id OR recurring_ticket_assets.asset_id = $asset_id GROUP BY recurring_tickets.recurring_ticket_id ORDER BY recurring_ticket_next_run ASC" ); $recurring_ticket_count = mysqli_num_rows($sql_related_recurring_tickets); // Network interfaces, in port order, and what each one is plugged into (functions/asset_interface.php) $interfaces = []; $sql_related_interfaces = mysqli_query($mysqli, "SELECT asset_interfaces.*, network_name, network, network_type, network_description, network_archived_at FROM asset_interfaces LEFT JOIN networks ON network_id = interface_network_id AND interface_network_id > 0 WHERE interface_asset_id = $asset_id AND interface_archived_at IS NULL"); while ($row = mysqli_fetch_assoc($sql_related_interfaces)) { $interfaces[intval($row['interface_id'])] = $row; } $interface_links = interfaceLinks(array_keys($interfaces)); interfaceSort($interfaces); $interface_count = count($interfaces); // A switch, firewall or access point with a few ports is drawn as its ports too $interface_port_map = in_array(html_entity_decode($asset_type, ENT_QUOTES, 'UTF-8'), INTERFACE_PORT_MAP_TYPES, true) && $interface_count >= 4; // Files $sql_related_files = mysqli_query($mysqli, "SELECT file_created_at, file_description, file_ext, files.file_id, file_name FROM asset_files LEFT JOIN files ON asset_files.file_id = files.file_id WHERE asset_files.asset_id = $asset_id AND file_archived_at IS NULL ORDER BY file_name ASC" ); $files_count = mysqli_num_rows($sql_related_files); // Documents $sql_related_documents = mysqli_query($mysqli, "SELECT document_created_at, document_description, documents.document_id, document_name, document_updated_at, user_name FROM asset_documents, documents LEFT JOIN users ON document_created_by = user_id WHERE asset_documents.asset_id = $asset_id AND asset_documents.document_id = documents.document_id AND document_archived_at IS NULL ORDER BY document_name ASC" ); $document_count = mysqli_num_rows($sql_related_documents); // Credentials $related_credentials = $can_credentials ? credentialRows("credential_asset_id = $asset_id AND credential_client_id = $client_id") : []; $credential_count = count($related_credentials); // Licenses it holds a seat on, with each one's seats in use and the key it was given $held_software = softwareHeldBy('asset', $asset_id); $software_count = count($held_software); // The services it is part of - most important first $linked_services = servicesFor('asset', $asset_id); $service_count = count($linked_services); // Notes - 1 to many relationship $sql_related_notes = mysqli_query($mysqli, "SELECT asset_note, asset_note_created_at, asset_note_id, asset_note_type, user_name FROM asset_notes LEFT JOIN users ON asset_note_created_by = user_id WHERE asset_note_asset_id = $asset_id AND asset_note_archived_at IS NULL ORDER BY asset_note_created_at DESC" ); $note_count = mysqli_num_rows($sql_related_notes); // Note type icons, read from the categories list so the seeded icons // stay the single source of truth $note_type_icons = array(); $sql_note_type_icons = mysqli_query($mysqli, "SELECT category_name, category_icon FROM categories WHERE category_type = 'asset_note_type'"); while ($row = mysqli_fetch_assoc($sql_note_type_icons)) { $note_type_icons[escapeHtml($row['category_name'])] = escapeHtml($row['category_icon']); } // The tabs, in the order a tech reaches for them // Its history, from the audit log $history = auditLogHistory('Asset', $asset_id); $asset_tabs = [ 'interfaces' => ['label' => 'Interfaces', 'icon' => 'fa-ethernet', 'count' => $interface_count], 'credentials' => ['label' => 'Credentials', 'icon' => 'fa-key', 'count' => $credential_count], 'tickets' => ['label' => 'Tickets', 'icon' => 'fa-life-ring', 'count' => $ticket_count, 'badge' => $ticket_open_count], 'recurring' => ['label' => 'Recurring', 'icon' => 'fa-redo-alt', 'count' => $recurring_ticket_count], 'licenses' => ['label' => 'Licenses', 'icon' => 'fa-cube', 'count' => $software_count], 'documents' => ['label' => 'Documents', 'icon' => 'fa-file-alt', 'count' => $document_count], 'files' => ['label' => 'Files', 'icon' => 'fa-paperclip', 'count' => $files_count], 'services' => ['label' => 'Services', 'icon' => 'fa-stream', 'count' => $service_count], 'notes' => ['label' => 'Notes', 'icon' => 'fa-sticky-note', 'count' => $note_count], 'history' => ['label' => 'History', 'icon' => 'fa-history', 'count' => $history['count']], ]; if (!$can_credentials) { unset($asset_tabs['credentials']); } ?>
" target="_blank" rel="noopener" title="Open photo"> " alt="Photo of ">

Archived

Network

IP
NAT
IPv6
MAC
Network
$asset_network_type]) ?>

Hardware

Model
Serial
$spec_row) { ?>
Runs
$guest_name) { ?>
Warranty
Not recorded
Purchased
old
Installed
in service
Vendor
Sold on
$asset_sold_number" : $asset_sold_number ?>
Our invoice,
Product
$asset_product_name" : $asset_product_name ?>
Order ref
Added

Where & who

Location
> -
Rack
Assigned
true, 'archived' => $contact_archived]) ?> Nobody

Quick notes