From 1a9314964342667ac8b1a8417826c3e182c09c91 Mon Sep 17 00:00:00 2001 From: wrongecho Date: Thu, 15 Jan 2026 14:58:23 +0000 Subject: [PATCH] Basic asset history tracking (transfers) - See https://tasks.dev.itflow.org/task_details.php?task_id=19 --- agent/post/asset.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/agent/post/asset.php b/agent/post/asset.php index 76febcc6..354528b7 100644 --- a/agent/post/asset.php +++ b/agent/post/asset.php @@ -400,6 +400,7 @@ if (isset($_POST['bulk_transfer_client_asset'])) { // Archive/log the current asset $notes = $asset_notes . "\r\n\r\n---\r\n* " . date('Y-m-d H:i:s') . ": Transferred asset $asset_name (old asset ID: $current_asset_id) from $current_client_name to $new_client_name (new asset ID: $new_asset_id)"; mysqli_query($mysqli,"UPDATE assets SET asset_archived_at = NOW() WHERE asset_id = $current_asset_id"); + mysqli_query($mysqli,"INSERT INTO asset_history SET asset_history_status = 'Transferred', asset_history_description = '$session_name transferred $asset_name to $new_client_name', asset_history_asset_id = $current_asset_id"); // Log Archive logAction("Asset", "Archive", "$session_name archived asset $asset_name (via transfer)", $current_client_id, $current_asset_id); @@ -411,6 +412,7 @@ if (isset($_POST['bulk_transfer_client_asset'])) { // Log the new asset $notes = $asset_notes . "\r\n\r\n---\r\n* " . date('Y-m-d H:i:s') . ": Transferred asset $asset_name (old asset ID: $current_asset_id) from $current_client_name to $new_client_name (new asset ID: $new_asset_id)"; logAction("Asset", "Create", "$session_name created asset $name (via transfer)", $new_client_id, $new_asset_id); + mysqli_query($mysqli,"INSERT INTO asset_history SET asset_history_status = 'Transferred', asset_history_description = '$session_name created asset via transfer from $current_client_name', asset_history_asset_id = $new_asset_id"); logAction("Asset", "Transfer", "$session_name Transferred asset $asset_name (old asset ID: $current_asset_id) from $current_client_name to $new_client_name (new asset ID: $new_asset_id)", $new_client_id, $new_asset_id);