mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 21:24:13 -08:00
Changes offset to use the actual item count as override instead of 0 (#7788)
This commit is contained in:
parent
e27a9b137b
commit
3361b859c0
|
@ -49,7 +49,9 @@ class AccessoriesController extends Controller
|
||||||
$accessories->where('supplier_id','=',$request->input('supplier_id'));
|
$accessories->where('supplier_id','=',$request->input('supplier_id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$offset = (($accessories) && (request('offset') > $accessories->count())) ? 0 : request('offset', 0);
|
// 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);
|
||||||
|
|
||||||
// Check to make sure the limit is not higher than the max allowed
|
// Check to make sure the limit is not higher than the max allowed
|
||||||
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
||||||
|
|
|
@ -44,7 +44,9 @@ class AssetMaintenancesController extends Controller
|
||||||
$maintenances->where('asset_id', '=', $request->input('asset_id'));
|
$maintenances->where('asset_id', '=', $request->input('asset_id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$offset = (($maintenances) && (request('offset') > $maintenances->count())) ? 0 : request('offset', 0);
|
// 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 = (($maintenances) && ($request->get('offset') > $maintenances->count())) ? $maintenances->count() : $request->get('offset', 0);
|
||||||
|
|
||||||
// Check to make sure the limit is not higher than the max allowed
|
// Check to make sure the limit is not higher than the max allowed
|
||||||
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
||||||
|
|
|
@ -60,7 +60,9 @@ class AssetModelsController extends Controller
|
||||||
$assetmodels->TextSearch($request->input('search'));
|
$assetmodels->TextSearch($request->input('search'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$offset = (($assetmodels) && (request('offset') > $assetmodels->count())) ? 0 : request('offset', 0);
|
// 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 = (($assetmodels) && ($request->get('offset') > $assetmodels->count())) ? $assetmodels->count() : $request->get('offset', 0);
|
||||||
|
|
||||||
// Check to make sure the limit is not higher than the max allowed
|
// Check to make sure the limit is not higher than the max allowed
|
||||||
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
||||||
|
|
|
@ -144,7 +144,11 @@ class AssetsController extends Controller
|
||||||
|
|
||||||
$request->filled('order_number') ? $assets = $assets->where('assets.order_number', '=', e($request->get('order_number'))) : '';
|
$request->filled('order_number') ? $assets = $assets->where('assets.order_number', '=', e($request->get('order_number'))) : '';
|
||||||
|
|
||||||
$offset = (($assets) && (request('offset') > $assets->count())) ? 0 : request('offset', 0);
|
|
||||||
|
// 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 = (($assets) && ($request->get('offset') > $assets->count())) ? $assets->count() : $request->get('offset', 0);
|
||||||
|
|
||||||
|
|
||||||
// Check to make sure the limit is not higher than the max allowed
|
// Check to make sure the limit is not higher than the max allowed
|
||||||
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
||||||
|
|
|
@ -30,7 +30,9 @@ class CategoriesController extends Controller
|
||||||
$categories = $categories->TextSearch($request->input('search'));
|
$categories = $categories->TextSearch($request->input('search'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$offset = (($categories) && (request('offset') > $categories->count())) ? 0 : request('offset', 0);
|
// 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 = (($categories) && ($request->get('offset') > $categories->count())) ? $categories->count() : $request->get('offset', 0);
|
||||||
|
|
||||||
// Check to make sure the limit is not higher than the max allowed
|
// Check to make sure the limit is not higher than the max allowed
|
||||||
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
||||||
|
|
|
@ -41,7 +41,9 @@ class CompaniesController extends Controller
|
||||||
$companies->TextSearch($request->input('search'));
|
$companies->TextSearch($request->input('search'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$offset = (($companies) && (request('offset') > $companies->count())) ? 0 : request('offset', 0);
|
// 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 = (($companies) && ($request->get('offset') > $companies->count())) ? $companies->count() : $request->get('offset', 0);
|
||||||
|
|
||||||
// Check to make sure the limit is not higher than the max allowed
|
// Check to make sure the limit is not higher than the max allowed
|
||||||
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
||||||
|
|
|
@ -43,7 +43,9 @@ class ComponentsController extends Controller
|
||||||
$components->where('location_id','=',$request->input('location_id'));
|
$components->where('location_id','=',$request->input('location_id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$offset = (($components) && (request('offset') > $components->count())) ? 0 : request('offset', 0);
|
// 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 = (($components) && ($request->get('offset') > $components->count())) ? $components->count() : $request->get('offset', 0);
|
||||||
|
|
||||||
// Check to make sure the limit is not higher than the max allowed
|
// Check to make sure the limit is not higher than the max allowed
|
||||||
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
||||||
|
|
|
@ -44,7 +44,9 @@ class ConsumablesController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$offset = (($consumables) && (request('offset') > $consumables->count())) ? 0 : request('offset', 0);
|
// 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 = (($consumables) && ($request->get('offset') > $consumables->count())) ? $consumables->count() : $request->get('offset', 0);
|
||||||
|
|
||||||
// Check to make sure the limit is not higher than the max allowed
|
// Check to make sure the limit is not higher than the max allowed
|
||||||
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
||||||
|
|
|
@ -39,7 +39,9 @@ class DepartmentsController extends Controller
|
||||||
$departments = $departments->TextSearch($request->input('search'));
|
$departments = $departments->TextSearch($request->input('search'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$offset = (($departments) && (request('offset') > $departments->count())) ? 0 : request('offset', 0);
|
// 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 = (($departments) && ($request->get('offset') > $departments->count())) ? $departments->count() : $request->get('offset', 0);
|
||||||
|
|
||||||
// Check to make sure the limit is not higher than the max allowed
|
// Check to make sure the limit is not higher than the max allowed
|
||||||
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
||||||
|
|
|
@ -28,7 +28,9 @@ class DepreciationsController extends Controller
|
||||||
$depreciations = $depreciations->TextSearch($request->input('search'));
|
$depreciations = $depreciations->TextSearch($request->input('search'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$offset = (($depreciations) && (request('offset') > $depreciations->count())) ? 0 : request('offset', 0);
|
// 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 = (($depreciations) && ($request->get('offset') > $depreciations->count())) ? $depreciations->count() : $request->get('offset', 0);
|
||||||
|
|
||||||
// Check to make sure the limit is not higher than the max allowed
|
// Check to make sure the limit is not higher than the max allowed
|
||||||
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
||||||
|
|
|
@ -28,7 +28,9 @@ class GroupsController extends Controller
|
||||||
$groups = $groups->TextSearch($request->input('search'));
|
$groups = $groups->TextSearch($request->input('search'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$offset = (($groups) && (request('offset') > $groups->count())) ? 0 : request('offset', 0);
|
// 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 = (($groups) && ($request->get('offset') > $groups->count())) ? $groups->count() : $request->get('offset', 0);
|
||||||
|
|
||||||
// Check to make sure the limit is not higher than the max allowed
|
// Check to make sure the limit is not higher than the max allowed
|
||||||
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
||||||
|
|
|
@ -82,7 +82,9 @@ class LicensesController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$offset = (($licenses) && (request('offset') > $licenses->count())) ? 0 : request('offset', 0);
|
// 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 = (($licenses) && ($request->get('offset') > $licenses->count())) ? $licenses->count() : $request->get('offset', 0);
|
||||||
|
|
||||||
// Check to make sure the limit is not higher than the max allowed
|
// Check to make sure the limit is not higher than the max allowed
|
||||||
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
||||||
|
|
|
@ -52,8 +52,9 @@ class LocationsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Set the offset to the API call's offset, unless the offset is higher than the actual count of items in which
|
||||||
$offset = (($locations) && (request('offset') > $locations->count())) ? 0 : request('offset', 0);
|
// case we override with the actual count, so we should return 0 items.
|
||||||
|
$offset = (($locations) && ($request->get('offset') > $locations->count())) ? $locations->count() : $request->get('offset', 0);
|
||||||
|
|
||||||
// Check to make sure the limit is not higher than the max allowed
|
// Check to make sure the limit is not higher than the max allowed
|
||||||
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
||||||
|
|
|
@ -37,9 +37,9 @@ class ManufacturersController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 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 = (($manufacturers) && (request('offset') > $manufacturers->count())) ? 0 : request('offset', 0);
|
$offset = (($manufacturers) && ($request->get('offset') > $manufacturers->count())) ? $manufacturers->count() : $request->get('offset', 0);
|
||||||
|
|
||||||
// Check to make sure the limit is not higher than the max allowed
|
// Check to make sure the limit is not higher than the max allowed
|
||||||
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
||||||
|
|
|
@ -30,7 +30,9 @@ class StatuslabelsController extends Controller
|
||||||
$statuslabels = $statuslabels->TextSearch($request->input('search'));
|
$statuslabels = $statuslabels->TextSearch($request->input('search'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$offset = (($statuslabels) && (request('offset') > $statuslabels->count())) ? 0 : request('offset', 0);
|
// 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 = (($statuslabels) && ($request->get('offset') > $statuslabels->count())) ? $statuslabels->count() : $request->get('offset', 0);
|
||||||
|
|
||||||
// Check to make sure the limit is not higher than the max allowed
|
// Check to make sure the limit is not higher than the max allowed
|
||||||
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
||||||
|
|
|
@ -33,7 +33,9 @@ class SuppliersController extends Controller
|
||||||
$suppliers = $suppliers->TextSearch($request->input('search'));
|
$suppliers = $suppliers->TextSearch($request->input('search'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$offset = (($suppliers) && (request('offset') > $suppliers->count())) ? 0 : request('offset', 0);
|
// 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 = (($suppliers) && ($request->get('offset') > $suppliers->count())) ? $suppliers->count() : $request->get('offset', 0);
|
||||||
|
|
||||||
// Check to make sure the limit is not higher than the max allowed
|
// Check to make sure the limit is not higher than the max allowed
|
||||||
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
||||||
|
|
|
@ -88,7 +88,10 @@ class UsersController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
|
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
|
||||||
$offset = (($users) && (request('offset') > $users->count())) ? 0 : request('offset', 0);
|
|
||||||
|
// 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 = (($users) && ($request->get('offset') > $users->count())) ? $users->count() : $request->get('offset', 0);
|
||||||
|
|
||||||
// Check to make sure the limit is not higher than the max allowed
|
// Check to make sure the limit is not higher than the max allowed
|
||||||
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');
|
||||||
|
|
Loading…
Reference in a new issue