Nothing to see here

Go Back"; require_once "../includes/footer.php"; exit(); } $contact_row = mysqli_fetch_assoc($sql); // raw, for the helpers - $row gets reused below $row = $contact_row; $client_id = intval($row['client_id']); $client_name = escapeHtml($row['client_name']); $contact_name = escapeHtml($row['contact_name']); $contact_title = escapeHtml($row['contact_title']); $contact_department = escapeHtml($row['contact_department']); $contact_email = escapeHtml($row['contact_email']); $contact_pin = escapeHtml($row['contact_pin']); $contact_notes = escapeHtml($row['contact_notes']); $contact_primary = intval($row['contact_primary']); $contact_archived_at = $row['contact_archived_at']; $contact_created_at = escapeHtml($row['contact_created_at']); $contact_phone_link = contactPhoneLink($row['contact_phone'], $row['contact_phone_country_code'], $row['contact_extension']); $contact_mobile_link = contactPhoneLink($row['contact_mobile'], $row['contact_mobile_country_code']); $contact_phone_copy = escapeHtml(formatPhoneNumber($row['contact_phone'], $row['contact_phone_country_code'])); $contact_mobile_copy = escapeHtml(formatPhoneNumber($row['contact_mobile'], $row['contact_mobile_country_code'])); $contact_dial = $row['contact_phone'] ? 'phone' : ($row['contact_mobile'] ? 'mobile' : ''); $contact_portal = contactPortalAccess($row['contact_user_id'], $row['user_auth_method']); $contact_role_line = implode(' · ', array_filter([$contact_title, $contact_department])); $can_edit = lookupUserPermission('module_client') >= 2; $can_delete = lookupUserPermission('module_client') >= 3; $can_credentials = lookupUserPermission('module_credential') >= 1; $can_support = lookupUserPermission('module_support') >= 1; $can_support_edit = lookupUserPermission('module_support') >= 2; // Override Tab Title // No Sanitizing needed as this var will only be used in the tab title $page_title = $row['contact_name']; // Tags - functions/tags.php $contact_tags_display = tagPills('contact', $contact_id, tagsForRecord('contact', $contact_id), "contacts.php?client_id=$client_id&"); // Assets assigned to them $sql_related_assets = mysqli_query($mysqli, "SELECT asset_id, asset_name, asset_description, asset_type, asset_make, asset_model, asset_serial, asset_status, asset_favorite, interface_ip FROM assets LEFT JOIN asset_interfaces ON interface_asset_id = asset_id AND interface_primary = 1 WHERE asset_contact_id = $contact_id AND asset_archived_at IS NULL ORDER BY asset_name ASC" ); $asset_count = mysqli_num_rows($sql_related_assets); // Credentials - only for agents who may see them $credential_count = 0; if ($can_credentials) { $sql_related_credentials = mysqli_query($mysqli, "SELECT credential_id, credential_name, credential_description, credential_uri, credential_username, credential_otp_secret FROM credentials WHERE credential_contact_id = $contact_id AND credential_archived_at IS NULL ORDER BY credential_name ASC" ); $credential_count = mysqli_num_rows($sql_related_credentials); } // Tickets they raised or are the contact on - open ones first $related_tickets = []; $ticket_open_count = 0; if ($can_support) { $sql_related_tickets = mysqli_query($mysqli, "SELECT ticket_id, ticket_prefix, ticket_number, ticket_subject, ticket_priority, ticket_created_at, ticket_updated_at, ticket_resolved_at, ticket_closed_at, ticket_assigned_to, user_name, user_avatar, ticket_status_name, ticket_status_color FROM tickets LEFT JOIN users ON ticket_assigned_to = user_id LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id WHERE ticket_contact_id = $contact_id AND ticket_archived_at IS NULL ORDER BY (ticket_resolved_at IS NULL AND ticket_closed_at IS NULL) DESC, ticket_number DESC" ); while ($row = mysqli_fetch_assoc($sql_related_tickets)) { $row['is_open'] = empty($row['ticket_resolved_at']) && empty($row['ticket_closed_at']); $ticket_open_count += $row['is_open'] ? 1 : 0; $related_tickets[] = $row; } } $ticket_count = count($related_tickets); // Recurring tickets $recurring_ticket_count = 0; if ($can_support) { $sql_related_recurring_tickets = mysqli_query($mysqli, "SELECT recurring_ticket_id, recurring_ticket_subject, recurring_ticket_priority, recurring_ticket_frequency, recurring_ticket_next_run FROM recurring_tickets WHERE recurring_ticket_contact_id = $contact_id ORDER BY recurring_ticket_next_run ASC" ); $recurring_ticket_count = mysqli_num_rows($sql_related_recurring_tickets); } // Licenses, with seats in use counted in the same query instead of two queries per license $sql_linked_software = mysqli_query($mysqli, "SELECT software.software_id, software_name, software_version, software_type, software_license_type, software_seats, software_expire, (SELECT COUNT(*) FROM software_assets AS sa WHERE sa.software_id = software.software_id) + (SELECT COUNT(*) FROM software_contacts AS sc WHERE sc.software_id = software.software_id) AS seats_used FROM software_contacts JOIN software ON software.software_id = software_contacts.software_id WHERE software_contacts.contact_id = $contact_id AND software_archived_at IS NULL ORDER BY software_name ASC" ); $software_count = mysqli_num_rows($sql_linked_software); // Documents $sql_linked_documents = mysqli_query($mysqli, "SELECT documents.document_id, document_name, document_description, document_created_at, document_updated_at, user_name FROM contact_documents JOIN documents ON documents.document_id = contact_documents.document_id LEFT JOIN users ON document_created_by = user_id WHERE contact_documents.contact_id = $contact_id AND document_archived_at IS NULL ORDER BY document_name ASC" ); $document_count = mysqli_num_rows($sql_linked_documents); // Files $sql_linked_files = mysqli_query($mysqli, "SELECT files.file_id, file_name, file_description, file_ext, file_size, file_created_at FROM contact_files JOIN files ON files.file_id = contact_files.file_id WHERE contact_files.contact_id = $contact_id AND file_archived_at IS NULL ORDER BY file_name ASC" ); $file_count = mysqli_num_rows($sql_linked_files); // Services $sql_linked_services = mysqli_query($mysqli, "SELECT services.service_id, service_name, service_description, service_category, service_importance FROM service_contacts JOIN services ON services.service_id = service_contacts.service_id WHERE service_contacts.contact_id = $contact_id ORDER BY service_name ASC" ); $service_count = mysqli_num_rows($sql_linked_services); // Notes $sql_related_notes = mysqli_query($mysqli, "SELECT contact_note, contact_note_created_at, contact_note_id, contact_note_type, user_name FROM contact_notes LEFT JOIN users ON contact_note_created_by = user_id WHERE contact_note_contact_id = $contact_id AND contact_note_archived_at IS NULL ORDER BY contact_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 = []; $sql_note_type_icons = mysqli_query($mysqli, "SELECT category_name, category_icon FROM categories WHERE category_type = 'contact_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 $contact_tabs = [ 'assets' => ['label' => 'Assets', 'icon' => 'fa-desktop', 'count' => $asset_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' => $file_count], 'services' => ['label' => 'Services', 'icon' => 'fa-stream', 'count' => $service_count], 'notes' => ['label' => 'Notes', 'icon' => 'fa-sticky-note', 'count' => $note_count], ]; if (!$can_credentials) { unset($contact_tabs['credentials']); } if (!$can_support) { unset($contact_tabs['tickets'], $contact_tabs['recurring']); } ?>
" target="_blank" rel="noopener" title="Open photo">

Archived

Reach

Phone
Mobile
Email
No phone or email recorded.

Details

Location
PIN
to verify them on a call
Portal
$contact_portal" : 'No access' ?>
Added

Quick notes