Merge pull request #13114 from inietov/fixes/broken_sorting_manufacturers

Fixed Broken order by manufacturer in Assets table [sc-23313]
This commit is contained in:
snipe 2023-06-01 19:40:16 +01:00 committed by GitHub
commit ff480a7247
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1667,7 +1667,7 @@ class Asset extends Depreciable
public function scopeOrderManufacturer($query, $order)
{
return $query->join('models as order_asset_model', 'assets.model_id', '=', 'order_asset_model.id')
->join('manufacturers as manufacturer_order', 'order_asset_model.manufacturer_id', '=', 'manufacturer_order.id')
->leftjoin('manufacturers as manufacturer_order', 'order_asset_model.manufacturer_id', '=', 'manufacturer_order.id')
->orderBy('manufacturer_order.name', $order);
}