diff --git a/client_contact_details.php b/client_contact_details.php index 2685a3a3..95706c34 100644 --- a/client_contact_details.php +++ b/client_contact_details.php @@ -43,6 +43,17 @@ if (isset($_GET['contact_id'])) { $sql_related_assets = mysqli_query($mysqli, "SELECT * FROM assets LEFT JOIN asset_interfaces ON interface_asset_id = asset_id AND interface_primary = 1 WHERE asset_contact_id = $contact_id ORDER BY asset_name DESC"); $asset_count = mysqli_num_rows($sql_related_assets); + // Linked Software Licenses + $sql_linked_software = mysqli_query($mysqli, "SELECT * FROM software_contacts, software + WHERE software_contacts.contact_id = $contact_id + AND software_contacts.software_id = software.software_id + AND software_archived_at IS NULL + ORDER BY software_name ASC" + ); + $software_count = mysqli_num_rows($sql_linked_software); + + $linked_software = array(); + // Related Logins Query 1 to 1 relationship $sql_related_logins = mysqli_query($mysqli, "SELECT * FROM logins LEFT JOIN login_tags ON login_tags.login_id = logins.login_id @@ -53,18 +64,6 @@ if (isset($_GET['contact_id'])) { "); $login_count = mysqli_num_rows($sql_related_logins); - // Related Software Query - many to many relationship - //$sql_related_software = mysqli_query($mysqli, "SELECT * FROM software, software_contacts WHERE software.software_id = software_contacts.software_id AND software_contacts.contact_id = $contact_id ORDER BY software.software_id DESC"); - $sql_related_software = mysqli_query( - $mysqli, - "SELECT * FROM software_contacts - LEFT JOIN software ON software_contacts.software_id = software.software_id - WHERE software_contacts.contact_id = $contact_id - ORDER BY software.software_id DESC" - ); - - $software_count = mysqli_num_rows($sql_related_software); - // Related Tickets Query - 1 to 1 relationship $sql_related_tickets = mysqli_query($mysqli, "SELECT * FROM tickets LEFT JOIN users ON ticket_assigned_to = user_id @@ -242,7 +241,7 @@ if (isset($_GET['contact_id'])) { Asset
- + License @@ -545,8 +544,13 @@ if (isset($_GET['contact_id'])) {