Skip to content

Firefly III: a personal finances manager

Fix filter param.

James Cole2b1fdba1c1cb
diff --git a/app/Api/V1/Controllers/Models/Account/ShowController.php b/app/Api/V1/Controllers/Models/Account/ShowController.php
index 1f08080d89..afd2b5d3cc 100644
--- a/app/Api/V1/Controllers/Models/Account/ShowController.php
+++ b/app/Api/V1/Controllers/Models/Account/ShowController.php
@@ -107,7 +107,6 @@ final class ShowController extends Controller
// now do the slicing.
$accounts = $accounts->slice($offset, $limit);
}
-
// make paginator:
$paginator = new LengthAwarePaginator($accounts, $count, $limit, $page);
$paginator->setPath(route('api.v1.accounts.index').$this->buildParams());
diff --git a/app/Api/V1/Requests/PaginationRequest.php b/app/Api/V1/Requests/PaginationRequest.php
index 1ebbbc4370..3f42d11c63 100644
--- a/app/Api/V1/Requests/PaginationRequest.php
+++ b/app/Api/V1/Requests/PaginationRequest.php
@@ -66,8 +66,7 @@ class PaginationRequest extends ApiRequest
}
$data = $validator->getData();
$limit = $this->integerFromValue($data['limit'] ?? null);
-
- if (0 === $limit) {
+ if (0 === $limit || null === $limit) {
// get default for user:
/** @var User $user */
$user = auth()->user();
diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php
index c42ca914c9..1e5e45981e 100644
--- a/app/Repositories/Account/AccountRepository.php
+++ b/app/Repositories/Account/AccountRepository.php
@@ -254,6 +254,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac
}
}
}
+ // add filter parameters.
$allowed = config('firefly.allowed_filter_parameters.Account', []);
if (0 !== count($filter)) {
foreach ($filter as $field => $search) {