Skip to content

A free open source IT asset/license management system

Fixed location sorting location instead of rtd

snipe897bd2c56e75
diff --git a/app/Models/Asset.php b/app/Models/Asset.php
index e71ae82b6a..148b97c010 100644
--- a/app/Models/Asset.php
+++ b/app/Models/Asset.php
@@ -1147,7 +1147,7 @@ class Asset extends Depreciable
*/
public function scopeOrderLocation($query, $order)
{
- return $query->leftJoin('locations as asset_locations', 'asset_locations.id', '=', 'assets.rtd_location_id')->orderBy('asset_locations.name', $order);
+ return $query->leftJoin('locations as asset_locations', 'asset_locations.id', '=', 'assets.location_id')->orderBy('asset_locations.name', $order);
}
@@ -1175,7 +1175,7 @@ class Asset extends Depreciable
public function scopeByLocationId($query, $search)
{
return $query->where(function ($query) use ($search) {
- $query->whereHas('defaultLoc', function ($query) use ($search) {
+ $query->whereHas('location', function ($query) use ($search) {
$query->where('locations.id', '=', $search);
});
});