A free open source IT asset/license management system
Math is hard
snipec256536d2185
diff --git a/app/Http/Controllers/Api/AccessoriesController.php b/app/Http/Controllers/Api/AccessoriesController.phpindex b726407250..1cc57acebc 100644--- a/app/Http/Controllers/Api/AccessoriesController.php+++ b/app/Http/Controllers/Api/AccessoriesController.php@@ -52,7 +52,7 @@ class AccessoriesController extends Controller$offset = (($accessories) && (request('offset') > $accessories->count())) ? 0 : request('offset', 0);// Check to make sure the limit is not higher than the max allowed- (config('app.max_results') < $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');+ (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');$order = $request->input('order') === 'asc' ? 'asc' : 'desc';diff --git a/app/Http/Controllers/Api/AssetMaintenancesController.php b/app/Http/Controllers/Api/AssetMaintenancesController.phpindex e7584ec47a..28a9810063 100644--- a/app/Http/Controllers/Api/AssetMaintenancesController.php+++ b/app/Http/Controllers/Api/AssetMaintenancesController.php@@ -45,7 +45,10 @@ class AssetMaintenancesController extends Controller}$offset = (($maintenances) && (request('offset') > $maintenances->count())) ? 0 : request('offset', 0);- $limit = request('limit', 50);++ // Check to make sure the limit is not higher than the max allowed+ (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');+$allowed_columns = ['id',diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.phpindex 87cd59e668..aa1b013726 100644--- a/app/Http/Controllers/Api/AssetsController.php+++ b/app/Http/Controllers/Api/AssetsController.php@@ -147,7 +147,7 @@ class AssetsController extends Controller$offset = (($assets) && (request('offset') > $assets->count())) ? 0 : request('offset', 0);// Check to make sure the limit is not higher than the max allowed- (config('app.max_results') < $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');+ (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');$order = $request->input('order') === 'asc' ? 'asc' : 'desc';diff --git a/app/Http/Controllers/Api/CategoriesController.php b/app/Http/Controllers/Api/CategoriesController.phpindex e92f58625e..183837baf9 100644--- a/app/Http/Controllers/Api/CategoriesController.php+++ b/app/Http/Controllers/Api/CategoriesController.php@@ -33,7 +33,7 @@ class CategoriesController extends Controller$offset = (($categories) && (request('offset') > $categories->count())) ? 0 : request('offset', 0);// Check to make sure the limit is not higher than the max allowed- (config('app.max_results') < $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');+ (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');$order = $request->input('order') === 'asc' ? 'asc' : 'desc';$sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'assets_count';diff --git a/app/Http/Controllers/Api/CompaniesController.php b/app/Http/Controllers/Api/CompaniesController.phpindex d9064cae16..d686a8aeca 100644--- a/app/Http/Controllers/Api/CompaniesController.php+++ b/app/Http/Controllers/Api/CompaniesController.php@@ -44,7 +44,7 @@ class CompaniesController extends Controller$offset = (($companies) && (request('offset') > $companies->count())) ? 0 : request('offset', 0);// Check to make sure the limit is not higher than the max allowed- (config('app.max_results') < $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');+ (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');$order = $request->input('order') === 'asc' ? 'asc' : 'desc';$sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at';diff --git a/app/Http/Controllers/Api/ComponentsController.php b/app/Http/Controllers/Api/ComponentsController.phpindex 147cec1650..6638c0864f 100644--- a/app/Http/Controllers/Api/ComponentsController.php+++ b/app/Http/Controllers/Api/ComponentsController.php@@ -46,7 +46,7 @@ class ComponentsController extends Controller$offset = (($components) && (request('offset') > $components->count())) ? 0 : request('offset', 0);// Check to make sure the limit is not higher than the max allowed- (config('app.max_results') < $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');+ (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');$allowed_columns = ['id','name','min_amt','order_number','serial','purchase_date','purchase_cost','company','category','qty','location','image'];$order = $request->input('order') === 'asc' ? 'asc' : 'desc';diff --git a/app/Http/Controllers/Api/ConsumablesController.php b/app/Http/Controllers/Api/ConsumablesController.phpindex 6e002ce66b..2fddcd0c8b 100644--- a/app/Http/Controllers/Api/ConsumablesController.php+++ b/app/Http/Controllers/Api/ConsumablesController.php@@ -47,7 +47,7 @@ class ConsumablesController extends Controller$offset = (($consumables) && (request('offset') > $consumables->count())) ? 0 : request('offset', 0);// Check to make sure the limit is not higher than the max allowed- (config('app.max_results') < $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');+ (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');$allowed_columns = ['id','name','order_number','min_amt','purchase_date','purchase_cost','company','category','model_number', 'item_no', 'manufacturer','location','qty','image'];$order = $request->input('order') === 'asc' ? 'asc' : 'desc';diff --git a/app/Http/Controllers/Api/DepartmentsController.php b/app/Http/Controllers/Api/DepartmentsController.phpindex 8da3bd6a88..409e30c224 100644--- a/app/Http/Controllers/Api/DepartmentsController.php+++ b/app/Http/Controllers/Api/DepartmentsController.php@@ -42,7 +42,7 @@ class DepartmentsController extends Controller$offset = (($departments) && (request('offset') > $departments->count())) ? 0 : request('offset', 0);// Check to make sure the limit is not higher than the max allowed- (config('app.max_results') < $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');+ (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');$order = $request->input('order') === 'asc' ? 'asc' : 'desc';$sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at';diff --git a/app/Http/Controllers/Api/DepreciationsController.php b/app/Http/Controllers/Api/DepreciationsController.phpindex d83d1deef7..c8cd92d155 100644--- a/app/Http/Controllers/Api/DepreciationsController.php+++ b/app/Http/Controllers/Api/DepreciationsController.php@@ -31,7 +31,7 @@ class DepreciationsController extends Controller$offset = (($depreciations) && (request('offset') > $depreciations->count())) ? 0 : request('offset', 0);// Check to make sure the limit is not higher than the max allowed- (config('app.max_results') < $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');+ (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');$order = $request->input('order') === 'asc' ? 'asc' : 'desc';$sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at';diff --git a/app/Http/Controllers/Api/GroupsController.php b/app/Http/Controllers/Api/GroupsController.phpindex daa2972616..5cfed31be2 100644--- a/app/Http/Controllers/Api/GroupsController.php+++ b/app/Http/Controllers/Api/GroupsController.php@@ -31,7 +31,7 @@ class GroupsController extends Controller$offset = (($groups) && (request('offset') > $groups->count())) ? 0 : request('offset', 0);// Check to make sure the limit is not higher than the max allowed- (config('app.max_results') < $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');+ (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');$order = $request->input('order') === 'asc' ? 'asc' : 'desc';$sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at';diff --git a/app/Http/Controllers/Api/LicensesController.php b/app/Http/Controllers/Api/LicensesController.phpindex b7ab3174d5..76bf9115a7 100644--- a/app/Http/Controllers/Api/LicensesController.php+++ b/app/Http/Controllers/Api/LicensesController.php@@ -85,7 +85,7 @@ class LicensesController extends Controller$offset = (($licenses) && (request('offset') > $licenses->count())) ? 0 : request('offset', 0);// Check to make sure the limit is not higher than the max allowed- (config('app.max_results') < $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');+ (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');$order = $request->input('order') === 'asc' ? 'asc' : 'desc';diff --git a/app/Http/Controllers/Api/LocationsController.php b/app/Http/Controllers/Api/LocationsController.phpindex 6c17c02710..c61dddd620 100644--- a/app/Http/Controllers/Api/LocationsController.php+++ b/app/Http/Controllers/Api/LocationsController.php@@ -54,7 +54,7 @@ class LocationsController extends Controller$offset = (($locations) && (request('offset') > $locations->count())) ? 0 : request('offset', 0);// Check to make sure the limit is not higher than the max allowed- (config('app.max_results') < $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');+ (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');$order = $request->input('order') === 'asc' ? 'asc' : 'desc';$sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at';diff --git a/app/Http/Controllers/Api/ManufacturersController.php b/app/Http/Controllers/Api/ManufacturersController.phpindex 4ffbca544d..60da5aadef 100644--- a/app/Http/Controllers/Api/ManufacturersController.php+++ b/app/Http/Controllers/Api/ManufacturersController.php@@ -42,7 +42,7 @@ class ManufacturersController extends Controller$offset = (($manufacturers) && (request('offset') > $manufacturers->count())) ? 0 : request('offset', 0);// Check to make sure the limit is not higher than the max allowed- (config('app.max_results') < $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');+ (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');$order = $request->input('order') === 'asc' ? 'asc' : 'desc';$sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at';diff --git a/app/Http/Controllers/Api/StatuslabelsController.php b/app/Http/Controllers/Api/StatuslabelsController.phpindex 4acf2f1a65..261771959d 100644--- a/app/Http/Controllers/Api/StatuslabelsController.php+++ b/app/Http/Controllers/Api/StatuslabelsController.php@@ -33,7 +33,7 @@ class StatuslabelsController extends Controller$offset = (($statuslabels) && (request('offset') > $statuslabels->count())) ? 0 : request('offset', 0);// Check to make sure the limit is not higher than the max allowed- (config('app.max_results') < $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');+ (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');$order = $request->input('order') === 'asc' ? 'asc' : 'desc';$sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at';diff --git a/app/Http/Controllers/Api/SuppliersController.php b/app/Http/Controllers/Api/SuppliersController.phpindex b82ed49312..f95070d3d2 100644--- a/app/Http/Controllers/Api/SuppliersController.php+++ b/app/Http/Controllers/Api/SuppliersController.php@@ -36,7 +36,7 @@ class SuppliersController extends Controller$offset = (($suppliers) && (request('offset') > $suppliers->count())) ? 0 : request('offset', 0);// Check to make sure the limit is not higher than the max allowed- (config('app.max_results') < $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');+ (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');$order = $request->input('order') === 'asc' ? 'asc' : 'desc';$sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at';diff --git a/app/Http/Controllers/Api/UsersController.php b/app/Http/Controllers/Api/UsersController.phpindex 4710a14686..c8ae878f3f 100644--- a/app/Http/Controllers/Api/UsersController.php+++ b/app/Http/Controllers/Api/UsersController.php@@ -90,7 +90,7 @@ class UsersController extends Controller$offset = (($users) && (request('offset') > $users->count())) ? 0 : request('offset', 0);// Check to make sure the limit is not higher than the max allowed- (config('app.max_results') < $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');+ (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results');switch ($request->input('sort')) {