Skip to content

A free open source IT asset/license management system

ref #2737 prevent assets with "rtd_location_id" null values to be removed on location sort (#4283)

Nicolai Essig3a302fe2d7dd
diff --git a/app/Models/Asset.php b/app/Models/Asset.php
index 1ab2f41a76..c8437681e2 100644
--- a/app/Models/Asset.php
+++ b/app/Models/Asset.php
@@ -1060,7 +1060,7 @@ class Asset extends Depreciable
*/
public function scopeOrderLocation($query, $order)
{
- return $query->join('locations', 'locations.id', '=', 'assets.rtd_location_id')->orderBy('locations.name', $order);
+ return $query->leftJoin('locations', 'locations.id', '=', 'assets.rtd_location_id')->orderBy('locations.name', $order);
}