mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -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')
|
$assets = Company::scopeCompanyables(Asset::select('assets.*'), 'company_id', 'assets')
|
||||||
->with('location', 'assetstatus', 'assetlog', 'company', 'defaultLoc','assignedTo',
|
->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);
|
$offset = request('offset', 0);
|
||||||
$limit = $request->input('limit', 50);
|
$limit = $request->input('limit', 50);
|
||||||
|
|
|
@ -1167,9 +1167,10 @@ class Asset extends Depreciable
|
||||||
{
|
{
|
||||||
return Company::scopeCompanyables($query->where('requestable', '=', 1))
|
return Company::scopeCompanyables($query->where('requestable', '=', 1))
|
||||||
->whereHas('assetstatus', function ($query) {
|
->whereHas('assetstatus', function ($query) {
|
||||||
|
$query->where(function ($query) {
|
||||||
$query->where('deployable', '=', 1)
|
$query->where('deployable', '=', 1)
|
||||||
->where('pending', '=', 0)
|
->where('archived', '=', 0); // you definitely can't request something that's archived
|
||||||
->where('archived', '=', 0);
|
})->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