mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 19:04:52 +00:00
Only show locations if an entity references the locations. Previously, all locations were listed in the location filter, even if no entites were assigned to them.
This commit is contained in:
10
assets.php
10
assets.php
@@ -210,7 +210,15 @@ if (mysqli_num_rows($os_sql) > 0) {
|
||||
<option value="">- All Locations -</option>
|
||||
|
||||
<?php
|
||||
$sql_locations_filter = mysqli_query($mysqli, "SELECT * FROM locations WHERE location_client_id = $client_id AND location_archived_at IS NULL ORDER BY location_name ASC");
|
||||
$sql_locations_filter = mysqli_query($mysqli, "
|
||||
SELECT DISTINCT location_id, location_name
|
||||
FROM locations
|
||||
LEFT JOIN assets ON asset_location_id = location_id
|
||||
WHERE location_client_id = $client_id
|
||||
AND location_archived_at IS NULL
|
||||
AND asset_location_id != 0
|
||||
ORDER BY location_name ASC
|
||||
");
|
||||
while ($row = mysqli_fetch_array($sql_locations_filter)) {
|
||||
$location_id = intval($row['location_id']);
|
||||
$location_name = nullable_htmlentities($row['location_name']);
|
||||
|
||||
Reference in New Issue
Block a user