mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-18 10:39:28 +00:00
Fix missing parameters
This commit is contained in:
@@ -63,13 +63,14 @@ class CategoryController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function categories(AutocompleteRequest $request): JsonResponse
|
public function categories(AutocompleteRequest $request): JsonResponse
|
||||||
{
|
{
|
||||||
$data = $request->getData();
|
$queryParameters = $request->getParameters();
|
||||||
$result = $this->repository->searchCategory($data['query'], $this->parameters->get('limit'));
|
$result = $this->repository->searchCategory($queryParameters['query'], $this->parameters->get('size'));
|
||||||
$filtered = $result->map(
|
$filtered = $result->map(
|
||||||
static function (Category $item) {
|
static function (Category $item) {
|
||||||
return [
|
return [
|
||||||
'id' => (string)$item->id,
|
'id' => (string)$item->id,
|
||||||
'name' => $item->name,
|
'title' => $item->name,
|
||||||
|
'meta' => [],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@@ -63,13 +63,14 @@ class TagController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function tags(AutocompleteRequest $request): JsonResponse
|
public function tags(AutocompleteRequest $request): JsonResponse
|
||||||
{
|
{
|
||||||
$data = $request->getData();
|
$queryParameters = $request->getParameters();
|
||||||
$result = $this->repository->searchTag($data['query'], $data['limit']);
|
$result = $this->repository->searchTag($queryParameters['query'], $queryParameters['size']);
|
||||||
$filtered = $result->map(
|
$filtered = $result->map(
|
||||||
static function (Tag $item) {
|
static function (Tag $item) {
|
||||||
return [
|
return [
|
||||||
'id' => (string)$item->id,
|
'id' => (string)$item->id,
|
||||||
'name' => $item->tag,
|
'name' => $item->tag,
|
||||||
|
'title' => $item->tag,
|
||||||
'value' => (string)$item->id,
|
'value' => (string)$item->id,
|
||||||
'label' => $item->tag,
|
'label' => $item->tag,
|
||||||
];
|
];
|
||||||
|
@@ -63,8 +63,8 @@ class TransactionController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function transactionDescriptions(AutocompleteRequest $request): JsonResponse
|
public function transactionDescriptions(AutocompleteRequest $request): JsonResponse
|
||||||
{
|
{
|
||||||
$data = $request->getData();
|
$queryParameters = $request->getParameters();
|
||||||
$result = $this->repository->searchJournalDescriptions($data['query'], $data['limit']);
|
$result = $this->repository->searchJournalDescriptions($queryParameters['query'], $queryParameters['limit']);
|
||||||
|
|
||||||
// limit and unique
|
// limit and unique
|
||||||
$filtered = $result->unique('description');
|
$filtered = $result->unique('description');
|
||||||
@@ -73,10 +73,13 @@ class TransactionController extends Controller
|
|||||||
/** @var TransactionJournal $journal */
|
/** @var TransactionJournal $journal */
|
||||||
foreach ($filtered as $journal) {
|
foreach ($filtered as $journal) {
|
||||||
$array[] = [
|
$array[] = [
|
||||||
'id' => (string)$journal->id,
|
'id' => (string) $journal->id,
|
||||||
'transaction_group_id' => (string)$journal->transaction_group_id,
|
'title' => $journal->description,
|
||||||
'name' => $journal->description,
|
'meta' => [
|
||||||
'description' => $journal->description,
|
'description' => $journal->description,
|
||||||
|
'transaction_group_id' => (string) $journal->transaction_group_id,
|
||||||
|
'name' => $journal->description,
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -73,27 +73,28 @@ class AutocompleteRequest extends FormRequest
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getData(): array
|
// public function getData(): array
|
||||||
{
|
// {
|
||||||
return [];
|
//
|
||||||
$types = $this->convertString('types');
|
// return [];
|
||||||
$array = [];
|
// $types = $this->convertString('types');
|
||||||
if ('' !== $types) {
|
// $array = [];
|
||||||
$array = explode(',', $types);
|
// if ('' !== $types) {
|
||||||
}
|
// $array = explode(',', $types);
|
||||||
$limit = $this->convertInteger('limit');
|
// }
|
||||||
$limit = 0 === $limit ? 10 : $limit;
|
// $limit = $this->convertInteger('limit');
|
||||||
|
// $limit = 0 === $limit ? 10 : $limit;
|
||||||
// remove 'initial balance' and another from allowed types. its internal
|
//
|
||||||
$array = array_diff($array, [AccountType::INITIAL_BALANCE, AccountType::RECONCILIATION]);
|
// // remove 'initial balance' and another from allowed types. its internal
|
||||||
|
// $array = array_diff($array, [AccountType::INITIAL_BALANCE, AccountType::RECONCILIATION]);
|
||||||
return [
|
//
|
||||||
'types' => $array,
|
// return [
|
||||||
'query' => $this->convertString('query'),
|
// 'types' => $array,
|
||||||
'date' => $this->getCarbonDate('date'),
|
// 'query' => $this->convertString('query'),
|
||||||
'limit' => $limit,
|
// 'date' => $this->getCarbonDate('date'),
|
||||||
];
|
// 'limit' => $limit,
|
||||||
}
|
// ];
|
||||||
|
// }
|
||||||
|
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user