Merge branch 'develop' of github.com:snipe/snipe-it into develop

This commit is contained in:
snipe 2017-10-24 19:24:39 -07:00
commit a305b1ea2d

View file

@ -59,7 +59,18 @@ class Location extends SnipeModel
public function locationAssets()
{
return $this->hasMany('\App\Models\Asset', 'rtd_location_id')->orHas('assignedAssets');
/* This used to have an ...->orHas() clause that referred to
assignedAssets, and that was probably incorrect, as well as
definitely was setting fire to the query-planner. So don't do that.
It is arguable that we should have a '...->whereNull('assigned_to')
bit in there, but that isn't always correct either (in the case
where a user has no location, for example).
In all likelyhood, we need to denorm an "effective_location" column
into Assets to make this slightly less miserable.
*/
return $this->hasMany('\App\Models\Asset', 'rtd_location_id');
}
public function parent()