Assets and Logins

- Show asset location when relating it to a login
- Bugfix: Swap login_id for asset_id on client_assets.php, as login_id won't yet be defined
- Bugfix: Don't show archived assets in the login relation modal
This commit is contained in:
Marcus Hill
2024-03-17 19:19:59 +00:00
parent 064629d499
commit 6788781ee6
3 changed files with 49 additions and 32 deletions

View File

@@ -175,12 +175,19 @@
<option value="">- Asset -</option>
<?php
$sql = mysqli_query($mysqli, "SELECT * FROM assets WHERE asset_client_id = $client_id ORDER BY asset_name ASC");
$sql = mysqli_query($mysqli, "SELECT * FROM assets LEFT JOIN locations on asset_location_id = location_id WHERE asset_client_id = $client_id AND asset_archived_at IS NULL ORDER BY asset_name ASC");
while ($row = mysqli_fetch_array($sql)) {
$asset_id = intval($row['asset_id']);
$asset_name = nullable_htmlentities($row['asset_name']);
$asset_location = nullable_htmlentities($row['location_name']);
$asset_display_string = $asset_name;
if (!empty($asset_location)) {
$asset_display_string = "$asset_name ($asset_location)";
}
?>
<option value="<?php echo $asset_id; ?>"><?php echo $asset_name; ?></option>
<option value="<?php echo $asset_id; ?>"><?php echo $asset_display_string; ?></option>
<?php
}