mirror of
https://github.com/itflow-org/itflow
synced 2026-12-05 10:39:00 +00:00
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:
@@ -912,6 +912,16 @@ function clientExportLinks($client_id, $options) {
|
||||
$rows[] = ['type' => $labels[$ft] ?? ucfirst($ft), 'name' => $fn, 'linked_type' => $labels[$tt] ?? ucfirst($tt), 'linked_name' => $tn];
|
||||
}
|
||||
}
|
||||
// Assets linked to each other (functions/asset_link.php) - once a pair, though it is kept from both sides
|
||||
if (clientExportHas($options, 'assets') && assetLinksReady()) {
|
||||
$archived = $options['archived'] ? '' : ' AND ta.asset_archived_at IS NULL AND tb.asset_archived_at IS NULL';
|
||||
$sql = mysqli_query($mysqli, "SELECT ta.asset_name AS a_name, tb.asset_name AS b_name FROM asset_links l
|
||||
JOIN assets ta ON ta.asset_id = l.asset_id JOIN assets tb ON tb.asset_id = l.linked_asset_id
|
||||
WHERE l.asset_id < l.linked_asset_id AND ta.asset_client_id = $client_id AND tb.asset_client_id = $client_id $archived");
|
||||
while ($sql && ($row = mysqli_fetch_assoc($sql))) {
|
||||
$rows[] = ['type' => 'Asset', 'name' => $row['a_name'], 'linked_type' => 'Asset', 'linked_name' => $row['b_name']];
|
||||
}
|
||||
}
|
||||
usort($rows, function ($x, $y) {
|
||||
return strcmp($x['type'], $y['type']) ?: strcasecmp($x['name'], $y['name']) ?: strcmp($x['linked_type'], $y['linked_type']) ?: strcasecmp($x['linked_name'], $y['linked_name']);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user