Merge pull request #9861 from inietov/fixes/consumables_accessories_not_correctly_displayed_via_locations

Fixes #9853 Consumables/Accessories not correctly displayed via Locations
This commit is contained in:
snipe 2021-07-26 14:49:05 -07:00 committed by GitHub
commit d2fc98b685
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View file

@ -51,6 +51,10 @@ class AccessoriesController extends Controller
$accessories->where('supplier_id','=',$request->input('supplier_id'));
}
if ($request->filled('location_id')) {
$accessories->where('location_id','=',$request->input('location_id'));
}
// Set the offset to the API call's offset, unless the offset is higher than the actual count of items in which
// case we override with the actual count, so we should return 0 items.
$offset = (($accessories) && ($request->get('offset') > $accessories->count())) ? $accessories->count() : $request->get('offset', 0);

View file

@ -46,6 +46,10 @@ class ConsumablesController extends Controller
$consumables->where('manufacturer_id','=',$request->input('manufacturer_id'));
}
if ($request->filled('location_id')) {
$consumables->where('location_id','=',$request->input('location_id'));
}
// Set the offset to the API call's offset, unless the offset is higher than the actual count of items in which
// case we override with the actual count, so we should return 0 items.