mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 21:54:14 -08:00
Make 'pending' assets properly requestable; use requestable scope
This commit is contained in:
parent
cfb64be9a4
commit
ef463a37d8
|
@ -937,7 +937,7 @@ class AssetsController extends Controller
|
|||
|
||||
$assets = Company::scopeCompanyables(Asset::select('assets.*'), 'company_id', 'assets')
|
||||
->with('location', 'assetstatus', 'assetlog', 'company', 'defaultLoc','assignedTo',
|
||||
'model.category', 'model.manufacturer', 'model.fieldset', 'supplier')->where('assets.requestable', '=', '1');
|
||||
'model.category', 'model.manufacturer', 'model.fieldset', 'supplier')->requestableAssets();
|
||||
|
||||
$offset = request('offset', 0);
|
||||
$limit = $request->input('limit', 50);
|
||||
|
|
|
@ -1167,9 +1167,10 @@ class Asset extends Depreciable
|
|||
{
|
||||
return Company::scopeCompanyables($query->where('requestable', '=', 1))
|
||||
->whereHas('assetstatus', function ($query) {
|
||||
$query->where('deployable', '=', 1)
|
||||
->where('pending', '=', 0)
|
||||
->where('archived', '=', 0);
|
||||
$query->where(function ($query) {
|
||||
$query->where('deployable', '=', 1)
|
||||
->where('archived', '=', 0); // you definitely can't request something that's archived
|
||||
})->orWhere('pending', '=', 1); // we've decided that even though an asset may be 'pending', you can still request it
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue