From 9fe0d8417b73a55d0e3d3f8ac3726020b6965ddf Mon Sep 17 00:00:00 2001 From: johnnyq Date: Thu, 31 Jul 2025 15:54:07 -0400 Subject: [PATCH] Feature: Added Client URI field to Assets which is exposed in the client portal can be used for remote desktop links etc --- admin/database_updates.php | 5 +++++ client/assets.php | 9 +++++++++ client/index.php | 4 +++- db.sql | 3 ++- includes/check_login.php | 2 +- includes/database_version.php | 2 +- user/ajax/ajax_asset_details.php | 5 +++++ user/ajax/ajax_asset_edit.php | 12 +++++++++++- user/asset_details.php | 9 +++++++-- user/assets.php | 11 +++++++++-- user/modals/asset_add_modal.php | 10 ++++++++++ user/post/asset.php | 4 ++-- user/post/asset_model.php | 1 + 13 files changed, 66 insertions(+), 11 deletions(-) diff --git a/admin/database_updates.php b/admin/database_updates.php index 0a23409c..c2b8b2df 100644 --- a/admin/database_updates.php +++ b/admin/database_updates.php @@ -3804,6 +3804,11 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) { mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.2.5'"); } + if (CURRENT_DATABASE_VERSION == '2.2.5') { + mysqli_query($mysqli, "ALTER TABLE `assets` ADD `asset_uri_client` VARCHAR(500) NULL DEFAULT NULL AFTER `asset_uri_2`"); + mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.2.6'"); + } + /* 2025-07-21 - JQ For next release Pauyment Provider Switch Over if (CURRENT_DATABASE_VERSION == '2.2.4') { diff --git a/client/assets.php b/client/assets.php index e62120cf..e67b09b2 100644 --- a/client/assets.php +++ b/client/assets.php @@ -37,6 +37,7 @@ $assets_sql = mysqli_query($mysqli, "SELECT * FROM assets LEFT JOIN contacts ON Purchase Warranty Status + URI @@ -54,6 +55,7 @@ $assets_sql = mysqli_query($mysqli, "SELECT * FROM assets LEFT JOIN contacts ON $asset_warranty_expire = nullable_htmlentities($row['asset_warranty_expire'] ?? "-"); $assigned_to = nullable_htmlentities($row['contact_name'] ?? "-"); $asset_status = nullable_htmlentities($row['asset_status']); + $asset_uri_client = sanitize_url($row['asset_uri_client']); ?> @@ -70,6 +72,13 @@ $assets_sql = mysqli_query($mysqli, "SELECT * FROM assets LEFT JOIN contacts ON + + + + + - + + diff --git a/client/index.php b/client/index.php index 7556c1bf..bde28073 100644 --- a/client/index.php +++ b/client/index.php @@ -266,10 +266,12 @@ if ($session_contact_primary == 1 || $session_contact_is_technical_contact) { while ($row = mysqli_fetch_array($sql_assigned_assets)) { $asset_name = nullable_htmlentities($row['asset_name']); $asset_type = nullable_htmlentities($row['asset_type']); + $asset_uri_client = sanitize_url($row['asset_uri_client']); + ?> - + ()
+ +
Client URI:
+ diff --git a/user/ajax/ajax_asset_edit.php b/user/ajax/ajax_asset_edit.php index f2b725ae..a4fc7d85 100644 --- a/user/ajax/ajax_asset_edit.php +++ b/user/ajax/ajax_asset_edit.php @@ -25,6 +25,7 @@ $asset_nat_ip = nullable_htmlentities($row['interface_nat_ip']); $asset_mac = nullable_htmlentities($row['interface_mac']); $asset_uri = nullable_htmlentities($row['asset_uri']); $asset_uri_2 = nullable_htmlentities($row['asset_uri_2']); +$asset_uri_client = nullable_htmlentities($row['asset_uri_client']); $asset_status = nullable_htmlentities($row['asset_status']); $asset_purchase_reference = nullable_htmlentities($row['asset_purchase_reference']); $asset_purchase_date = nullable_htmlentities($row['asset_purchase_date']); @@ -266,7 +267,16 @@ ob_start();
- + + + +
+ +
+
+ +
+
diff --git a/user/asset_details.php b/user/asset_details.php index b62f4beb..b8269607 100644 --- a/user/asset_details.php +++ b/user/asset_details.php @@ -36,6 +36,7 @@ if (isset($_GET['asset_id'])) { $asset_os = nullable_htmlentities($row['asset_os']); $asset_uri = sanitize_url($row['asset_uri']); $asset_uri_2 = sanitize_url($row['asset_uri_2']); + $asset_uri_client = sanitize_url($row['asset_uri_client']); $asset_status = nullable_htmlentities($row['asset_status']); $asset_purchase_reference = nullable_htmlentities($row['asset_purchase_reference']); $asset_purchase_date = nullable_htmlentities($row['asset_purchase_date']); @@ -291,10 +292,14 @@ if (isset($_GET['asset_id'])) {
-
+
-
+
+ + +
Client URI:
diff --git a/user/assets.php b/user/assets.php index 50f6942d..e923ac7d 100644 --- a/user/assets.php +++ b/user/assets.php @@ -504,6 +504,7 @@ if (mysqli_num_rows($os_sql) > 0) { $asset_mac = nullable_htmlentities(getFallBack($row['interface_mac'])); $asset_uri = sanitize_url($row['asset_uri']); $asset_uri_2 = sanitize_url($row['asset_uri_2']); + $asset_uri_client = sanitize_url($row['asset_uri_client']); $asset_status = nullable_htmlentities($row['asset_status']); $asset_purchase_reference = nullable_htmlentities($row['asset_purchase_reference']); $asset_purchase_date = nullable_htmlentities($row['asset_purchase_date']); @@ -646,13 +647,19 @@ if (mysqli_num_rows($os_sql) > 0) { diff --git a/user/modals/asset_add_modal.php b/user/modals/asset_add_modal.php index f5607821..fe52e0ad 100644 --- a/user/modals/asset_add_modal.php +++ b/user/modals/asset_add_modal.php @@ -241,6 +241,16 @@ +
+ +
+
+ +
+ +
+
+
diff --git a/user/post/asset.php b/user/post/asset.php index 272dc023..6fba2985 100644 --- a/user/post/asset.php +++ b/user/post/asset.php @@ -16,7 +16,7 @@ if (isset($_POST['add_asset'])) { $alert_extended = ""; - mysqli_query($mysqli,"INSERT INTO assets SET asset_name = '$name', asset_description = '$description', asset_type = '$type', asset_make = '$make', asset_model = '$model', asset_serial = '$serial', asset_os = '$os', asset_uri = '$uri', asset_uri_2 = '$uri_2', asset_location_id = $location, asset_vendor_id = $vendor, asset_contact_id = $contact, asset_status = '$status', asset_purchase_reference = '$purchase_reference', asset_purchase_date = $purchase_date, asset_warranty_expire = $warranty_expire, asset_install_date = $install_date, asset_physical_location = '$physical_location', asset_notes = '$notes', asset_client_id = $client_id"); + mysqli_query($mysqli,"INSERT INTO assets SET asset_name = '$name', asset_description = '$description', asset_type = '$type', asset_make = '$make', asset_model = '$model', asset_serial = '$serial', asset_os = '$os', asset_uri = '$uri', asset_uri_2 = '$uri_2', asset_uri_client = '$uri_client', asset_location_id = $location, asset_vendor_id = $vendor, asset_contact_id = $contact, asset_status = '$status', asset_purchase_reference = '$purchase_reference', asset_purchase_date = $purchase_date, asset_warranty_expire = $warranty_expire, asset_install_date = $install_date, asset_physical_location = '$physical_location', asset_notes = '$notes', asset_client_id = $client_id"); $asset_id = mysqli_insert_id($mysqli); @@ -83,7 +83,7 @@ if (isset($_POST['edit_asset'])) { $row = mysqli_fetch_array($sql); $existing_file_name = sanitizeInput($row['asset_photo']); - mysqli_query($mysqli,"UPDATE assets SET asset_name = '$name', asset_description = '$description', asset_type = '$type', asset_make = '$make', asset_model = '$model', asset_serial = '$serial', asset_os = '$os', asset_uri = '$uri', asset_uri_2 = '$uri_2', asset_location_id = $location, asset_vendor_id = $vendor, asset_contact_id = $contact, asset_status = '$status', asset_purchase_reference = '$purchase_reference', asset_purchase_date = $purchase_date, asset_warranty_expire = $warranty_expire, asset_install_date = $install_date, asset_physical_location = '$physical_location', asset_notes = '$notes' WHERE asset_id = $asset_id"); + mysqli_query($mysqli,"UPDATE assets SET asset_name = '$name', asset_description = '$description', asset_type = '$type', asset_make = '$make', asset_model = '$model', asset_serial = '$serial', asset_os = '$os', asset_uri = '$uri', asset_uri_2 = '$uri_2', asset_uri_client = '$uri_client', asset_location_id = $location, asset_vendor_id = $vendor, asset_contact_id = $contact, asset_status = '$status', asset_purchase_reference = '$purchase_reference', asset_purchase_date = $purchase_date, asset_warranty_expire = $warranty_expire, asset_install_date = $install_date, asset_physical_location = '$physical_location', asset_notes = '$notes' WHERE asset_id = $asset_id"); $sql_interfaces = mysqli_query($mysqli, "SELECT * FROM asset_interfaces WHERE interface_asset_id = $asset_id AND interface_primary = 1"); diff --git a/user/post/asset_model.php b/user/post/asset_model.php index 144d1ad0..5a5ea88f 100644 --- a/user/post/asset_model.php +++ b/user/post/asset_model.php @@ -18,6 +18,7 @@ $nat_ip = sanitizeInput($_POST['nat_ip']); $mac = sanitizeInput($_POST['mac']); $uri = sanitizeInput($_POST['uri']); $uri_2 = sanitizeInput($_POST['uri_2']); +$uri_client = sanitizeInput($_POST['uri_client']); $status = sanitizeInput($_POST['status']); $location = intval($_POST['location'] ?? 0); $physical_location = sanitizeInput($_POST['physical_location']);