From 41ac390173215c59bf4be2d22df5f73d8a6adafc Mon Sep 17 00:00:00 2001 From: johnnyq Date: Tue, 11 Jun 2024 21:36:03 -0400 Subject: [PATCH] MAJOR Feature Update - Backup before updating Migrated Asset Network info to a seperate table to allow for multiple interfaces per asset --- client_asset_details.php | 129 ++++++++++++++++++- client_asset_interface_add_modal.php | 174 ++++++++++++-------------- client_asset_interface_edit_modal.php | 102 +++++++++++++++ client_assets.php | 14 ++- client_contact_details.php | 15 +-- database_updates.php | 56 ++++++++- database_version.php | 2 +- db.sql | 56 ++++----- global_search.php | 3 +- post/asset.php | 109 +++++++++++++++- post/client.php | 31 ++--- ticket.php | 3 +- 12 files changed, 524 insertions(+), 170 deletions(-) create mode 100644 client_asset_interface_edit_modal.php diff --git a/client_asset_details.php b/client_asset_details.php index b2af0f9d..557a7c9a 100644 --- a/client_asset_details.php +++ b/client_asset_details.php @@ -8,7 +8,8 @@ if (isset($_GET['asset_id'])) { $sql = mysqli_query($mysqli, "SELECT * FROM assets LEFT JOIN contacts ON asset_contact_id = contact_id - LEFT JOIN locations ON asset_location_id = location_id + LEFT JOIN locations ON asset_location_id = location_id + LEFT JOIN asset_interfaces ON interface_asset_id = asset_id AND interface_primary = 1 WHERE asset_id = $asset_id AND asset_client_id = $client_id "); @@ -22,10 +23,6 @@ if (isset($_GET['asset_id'])) { $asset_model = nullable_htmlentities($row['asset_model']); $asset_serial = nullable_htmlentities($row['asset_serial']); $asset_os = nullable_htmlentities($row['asset_os']); - $asset_ip = nullable_htmlentities($row['asset_ip']); - $asset_ipv6 = nullable_htmlentities($row['asset_ipv6']); - $asset_nat_ip = nullable_htmlentities($row['asset_nat_ip']); - $asset_mac = nullable_htmlentities($row['asset_mac']); $asset_uri = nullable_htmlentities($row['asset_uri']); $asset_uri_2 = nullable_htmlentities($row['asset_uri_2']); $asset_status = nullable_htmlentities($row['asset_status']); @@ -37,7 +34,12 @@ if (isset($_GET['asset_id'])) { $asset_vendor_id = intval($row['asset_vendor_id']); $asset_location_id = intval($row['asset_location_id']); $asset_contact_id = intval($row['asset_contact_id']); - $asset_network_id = intval($row['asset_network_id']); + + $asset_ip = nullable_htmlentities($row['interface_ip']); + $asset_ipv6 = nullable_htmlentities($row['interface_ipv6']); + $asset_nat_ip = nullable_htmlentities($row['interface_nat_ip']); + $asset_mac = nullable_htmlentities($row['interface_mac']); + $asset_network_id = intval($row['interface_network_id']); $device_icon = getAssetIcon($asset_type); @@ -80,6 +82,15 @@ if (isset($_GET['asset_id'])) { ); $document_count = mysqli_num_rows($sql_related_documents); + // Network Interfaces + $sql_related_interfaces = mysqli_query($mysqli, "SELECT * FROM asset_interfaces + LEFT JOIN assets ON asset_id = interface_asset_id + LEFT JOIN networks ON network_id = interface_network_id + WHERE asset_id = $asset_id + AND interface_archived_at IS NULL + ORDER BY interface_name DESC" + ); + $interface_count = mysqli_num_rows($sql_related_interfaces); // Related Files $sql_related_files = mysqli_query($mysqli, "SELECT * FROM asset_files @@ -239,6 +250,109 @@ if (isset($_GET['asset_id'])) { +
+
+

Network Interfaces

+
+ +
+
+
+
+ + "> + + + + + + + + + + + $network_name"; + } else { + $network_name_display = "-"; + } + $interface_notes = nullable_htmlentities($row['interface_notes']); + + + ?> + + + + + + + + + + + + +
NameMACIPPortConnected ToAction
+ + + + + + +
+
+ +
+
+
">

Passwords

@@ -633,5 +747,8 @@ if (isset($_GET['asset_id'])) { " tabindex="-1"> +