Link assets to each other: a Linked assets card on the asset page with the link picker for any of the client's other assets, links kept both ways in asset_links (database 4.4.7) and written to both assets' History and the audit log, a menu on a linked asset at another site to move either one to the other's site, linked names on the assets list and quick look, links in the client export, and links kept between assets transferred to another client together; 26.12.6 changelog

This commit is contained in:
johnnyq
2026-12-05 02:24:14 -05:00
parent ac089c6af8
commit f750e3c00b
12 changed files with 395 additions and 3 deletions

View File

@@ -0,0 +1,25 @@
<?php
/*
* ITFlow - Database update to version 4.4.7 (from 4.4.6)
* Included by admin/database_updates.php - do not access directly
*
* Assets linked to each other (functions/asset_link.php) - a label printer and the knife unit on
* it, a server and its disk shelf: asset_links, one row from each side of a link, so either reads
* it the same. A link goes when either asset is deleted.
*
* Re-runnable: the table is made only where it isn't there.
*/
defined('FROM_DB_UPDATER') || die("Direct file access is not allowed");
mysqli_query($mysqli, "CREATE TABLE IF NOT EXISTS `asset_links` (
`asset_id` int(11) NOT NULL,
`linked_asset_id` int(11) NOT NULL,
`asset_link_created_by` int(11) NOT NULL DEFAULT 0,
`asset_link_created_at` datetime NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`asset_id`,`linked_asset_id`),
KEY `asset_links_linked` (`linked_asset_id`),
CONSTRAINT `asset_links_asset` FOREIGN KEY (`asset_id`) REFERENCES `assets` (`asset_id`) ON DELETE CASCADE,
CONSTRAINT `asset_links_linked_asset` FOREIGN KEY (`linked_asset_id`) REFERENCES `assets` (`asset_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;");