From 4474a71e65755c5607653cb1c8e4d98433a27372 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 30 Sep 2022 20:07:01 +0200 Subject: [PATCH 1/2] Attempted fix for #6475 --- app/Http/Requests/AccountFormRequest.php | 4 +-- app/Http/Requests/BillStoreRequest.php | 4 +-- app/Http/Requests/BillUpdateRequest.php | 4 +-- app/Http/Requests/BudgetFormStoreRequest.php | 4 +-- app/Http/Requests/BudgetFormUpdateRequest.php | 4 +-- app/Http/Requests/CurrencyFormRequest.php | 2 +- app/Http/Requests/JournalLinkRequest.php | 2 +- app/Http/Requests/PiggyBankStoreRequest.php | 2 +- app/Http/Requests/PiggyBankUpdateRequest.php | 2 +- app/Http/Requests/RecurrenceFormRequest.php | 30 +++++++++---------- app/Http/Requests/RuleFormRequest.php | 2 +- app/Http/Requests/UserFormRequest.php | 4 +-- app/Support/Request/ConvertsDataTypes.php | 2 +- 13 files changed, 33 insertions(+), 33 deletions(-) diff --git a/app/Http/Requests/AccountFormRequest.php b/app/Http/Requests/AccountFormRequest.php index c003facbd9..2fe34b6dd8 100644 --- a/app/Http/Requests/AccountFormRequest.php +++ b/app/Http/Requests/AccountFormRequest.php @@ -48,7 +48,7 @@ class AccountFormRequest extends FormRequest 'name' => $this->convertString('name'), 'active' => $this->boolean('active'), 'account_type_name' => $this->convertString('objectType'), - 'currency_id' => $this->integer('currency_id'), + 'currency_id' => $this->convertInteger('currency_id'), 'virtual_balance' => $this->convertString('virtual_balance'), 'iban' => $this->convertString('iban'), 'BIC' => $this->convertString('BIC'), @@ -77,7 +77,7 @@ class AccountFormRequest extends FormRequest // that could have been selected. if ('liabilities' === $data['account_type_name']) { $data['account_type_name'] = null; - $data['account_type_id'] = $this->integer('liability_type_id'); + $data['account_type_id'] = $this->convertInteger('liability_type_id'); if ('' !== $data['opening_balance']) { $data['opening_balance'] = app('steam')->negative($data['opening_balance']); } diff --git a/app/Http/Requests/BillStoreRequest.php b/app/Http/Requests/BillStoreRequest.php index ebe3dd03fb..da1b3d9a6a 100644 --- a/app/Http/Requests/BillStoreRequest.php +++ b/app/Http/Requests/BillStoreRequest.php @@ -43,14 +43,14 @@ class BillStoreRequest extends FormRequest return [ 'name' => $this->convertString('name'), 'amount_min' => $this->convertString('amount_min'), - 'currency_id' => $this->integer('transaction_currency_id'), + 'currency_id' => $this->convertInteger('transaction_currency_id'), 'currency_code' => '', 'amount_max' => $this->convertString('amount_max'), 'date' => $this->getCarbonDate('date'), 'end_date' => $this->getCarbonDate('bill_end_date'), 'extension_date' => $this->getCarbonDate('extension_date'), 'repeat_freq' => $this->convertString('repeat_freq'), - 'skip' => $this->integer('skip'), + 'skip' => $this->convertInteger('skip'), 'notes' => $this->stringWithNewlines('notes'), 'active' => $this->boolean('active'), 'object_group_title' => $this->convertString('object_group'), diff --git a/app/Http/Requests/BillUpdateRequest.php b/app/Http/Requests/BillUpdateRequest.php index 258647741d..f48cde128c 100644 --- a/app/Http/Requests/BillUpdateRequest.php +++ b/app/Http/Requests/BillUpdateRequest.php @@ -44,14 +44,14 @@ class BillUpdateRequest extends FormRequest return [ 'name' => $this->convertString('name'), 'amount_min' => $this->convertString('amount_min'), - 'currency_id' => $this->integer('transaction_currency_id'), + 'currency_id' => $this->convertInteger('transaction_currency_id'), 'currency_code' => '', 'amount_max' => $this->convertString('amount_max'), 'date' => $this->getCarbonDate('date'), 'end_date' => $this->getCarbonDate('bill_end_date'), 'extension_date' => $this->getCarbonDate('extension_date'), 'repeat_freq' => $this->convertString('repeat_freq'), - 'skip' => $this->integer('skip'), + 'skip' => $this->convertInteger('skip'), 'notes' => $this->stringWithNewlines('notes'), 'active' => $this->boolean('active'), 'object_group_title' => $this->convertString('object_group'), diff --git a/app/Http/Requests/BudgetFormStoreRequest.php b/app/Http/Requests/BudgetFormStoreRequest.php index abf43f34be..065a607a4b 100644 --- a/app/Http/Requests/BudgetFormStoreRequest.php +++ b/app/Http/Requests/BudgetFormStoreRequest.php @@ -46,8 +46,8 @@ class BudgetFormStoreRequest extends FormRequest return [ 'name' => $this->convertString('name'), 'active' => $this->boolean('active'), - 'auto_budget_type' => $this->integer('auto_budget_type'), - 'currency_id' => $this->integer('auto_budget_currency_id'), + 'auto_budget_type' => $this->convertInteger('auto_budget_type'), + 'currency_id' => $this->convertInteger('auto_budget_currency_id'), 'auto_budget_amount' => $this->convertString('auto_budget_amount'), 'auto_budget_period' => $this->convertString('auto_budget_period'), ]; diff --git a/app/Http/Requests/BudgetFormUpdateRequest.php b/app/Http/Requests/BudgetFormUpdateRequest.php index 93902889af..700cbfff4a 100644 --- a/app/Http/Requests/BudgetFormUpdateRequest.php +++ b/app/Http/Requests/BudgetFormUpdateRequest.php @@ -47,8 +47,8 @@ class BudgetFormUpdateRequest extends FormRequest return [ 'name' => $this->convertString('name'), 'active' => $this->boolean('active'), - 'auto_budget_type' => $this->integer('auto_budget_type'), - 'currency_id' => $this->integer('auto_budget_currency_id'), + 'auto_budget_type' => $this->convertInteger('auto_budget_type'), + 'currency_id' => $this->convertInteger('auto_budget_currency_id'), 'auto_budget_amount' => $this->convertString('auto_budget_amount'), 'auto_budget_period' => $this->convertString('auto_budget_period'), ]; diff --git a/app/Http/Requests/CurrencyFormRequest.php b/app/Http/Requests/CurrencyFormRequest.php index f391130bff..d2b1a8dc62 100644 --- a/app/Http/Requests/CurrencyFormRequest.php +++ b/app/Http/Requests/CurrencyFormRequest.php @@ -45,7 +45,7 @@ class CurrencyFormRequest extends FormRequest 'name' => $this->convertString('name'), 'code' => $this->convertString('code'), 'symbol' => $this->convertString('symbol'), - 'decimal_places' => $this->integer('decimal_places'), + 'decimal_places' => $this->convertInteger('decimal_places'), 'enabled' => $this->boolean('enabled'), ]; } diff --git a/app/Http/Requests/JournalLinkRequest.php b/app/Http/Requests/JournalLinkRequest.php index 0b3c214983..2886cbb4d8 100644 --- a/app/Http/Requests/JournalLinkRequest.php +++ b/app/Http/Requests/JournalLinkRequest.php @@ -45,7 +45,7 @@ class JournalLinkRequest extends FormRequest $linkType = $this->get('link_type'); $parts = explode('_', $linkType); $return['link_type_id'] = (int) $parts[0]; - $return['transaction_journal_id'] = $this->integer('opposing'); + $return['transaction_journal_id'] = $this->convertInteger('opposing'); $return['notes'] = $this->convertString('notes'); $return['direction'] = $parts[1]; diff --git a/app/Http/Requests/PiggyBankStoreRequest.php b/app/Http/Requests/PiggyBankStoreRequest.php index b4ae621013..e71f83bd83 100644 --- a/app/Http/Requests/PiggyBankStoreRequest.php +++ b/app/Http/Requests/PiggyBankStoreRequest.php @@ -43,7 +43,7 @@ class PiggyBankStoreRequest extends FormRequest return [ 'name' => $this->convertString('name'), 'startdate' => $this->getCarbonDate('startdate'), - 'account_id' => $this->integer('account_id'), + 'account_id' => $this->convertInteger('account_id'), 'targetamount' => $this->convertString('targetamount'), 'targetdate' => $this->getCarbonDate('targetdate'), 'notes' => $this->stringWithNewlines('notes'), diff --git a/app/Http/Requests/PiggyBankUpdateRequest.php b/app/Http/Requests/PiggyBankUpdateRequest.php index 8249894e6b..d48268a5de 100644 --- a/app/Http/Requests/PiggyBankUpdateRequest.php +++ b/app/Http/Requests/PiggyBankUpdateRequest.php @@ -44,7 +44,7 @@ class PiggyBankUpdateRequest extends FormRequest return [ 'name' => $this->convertString('name'), 'startdate' => $this->getCarbonDate('startdate'), - 'account_id' => $this->integer('account_id'), + 'account_id' => $this->convertInteger('account_id'), 'targetamount' => $this->convertString('targetamount'), 'targetdate' => $this->getCarbonDate('targetdate'), 'notes' => $this->stringWithNewlines('notes'), diff --git a/app/Http/Requests/RecurrenceFormRequest.php b/app/Http/Requests/RecurrenceFormRequest.php index a5c400c88b..e2bf43d001 100644 --- a/app/Http/Requests/RecurrenceFormRequest.php +++ b/app/Http/Requests/RecurrenceFormRequest.php @@ -61,14 +61,14 @@ class RecurrenceFormRequest extends FormRequest 'description' => $this->convertString('recurring_description'), 'first_date' => $this->getCarbonDate('first_date'), 'repeat_until' => $this->getCarbonDate('repeat_until'), - 'nr_of_repetitions' => $this->integer('repetitions'), + 'nr_of_repetitions' => $this->convertInteger('repetitions'), 'apply_rules' => $this->boolean('apply_rules'), 'active' => $this->boolean('active'), 'repetition_end' => $this->convertString('repetition_end'), ], 'transactions' => [ [ - 'currency_id' => $this->integer('transaction_currency_id'), + 'currency_id' => $this->convertInteger('transaction_currency_id'), 'currency_code' => null, 'type' => $this->convertString('transaction_type'), 'description' => $this->convertString('transaction_description'), @@ -76,14 +76,14 @@ class RecurrenceFormRequest extends FormRequest 'foreign_amount' => null, 'foreign_currency_id' => null, 'foreign_currency_code' => null, - 'budget_id' => $this->integer('budget_id'), + 'budget_id' => $this->convertInteger('budget_id'), 'budget_name' => null, - 'bill_id' => $this->integer('bill_id'), + 'bill_id' => $this->convertInteger('bill_id'), 'bill_name' => null, 'category_id' => null, 'category_name' => $this->convertString('category'), 'tags' => '' !== $this->convertString('tags') ? explode(',', $this->convertString('tags')) : [], - 'piggy_bank_id' => $this->integer('piggy_bank_id'), + 'piggy_bank_id' => $this->convertInteger('piggy_bank_id'), 'piggy_bank_name' => null, ], ], @@ -91,8 +91,8 @@ class RecurrenceFormRequest extends FormRequest [ 'type' => $repetitionData['type'], 'moment' => $repetitionData['moment'], - 'skip' => $this->integer('skip'), - 'weekend' => $this->integer('weekend'), + 'skip' => $this->convertInteger('skip'), + 'weekend' => $this->convertInteger('weekend'), ], ], @@ -101,7 +101,7 @@ class RecurrenceFormRequest extends FormRequest // fill in foreign currency data if (null !== $this->float('foreign_amount')) { $return['transactions'][0]['foreign_amount'] = $this->convertString('foreign_amount'); - $return['transactions'][0]['foreign_currency_id'] = $this->integer('foreign_currency_id'); + $return['transactions'][0]['foreign_currency_id'] = $this->convertInteger('foreign_currency_id'); } // default values: $return['transactions'][0]['source_id'] = null; @@ -113,16 +113,16 @@ class RecurrenceFormRequest extends FormRequest default: throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->convertString('transaction_type'))); case 'withdrawal': - $return['transactions'][0]['source_id'] = $this->integer('source_id'); - $return['transactions'][0]['destination_id'] = $this->integer('withdrawal_destination_id'); + $return['transactions'][0]['source_id'] = $this->convertInteger('source_id'); + $return['transactions'][0]['destination_id'] = $this->convertInteger('withdrawal_destination_id'); break; case 'deposit': - $return['transactions'][0]['source_id'] = $this->integer('deposit_source_id'); - $return['transactions'][0]['destination_id'] = $this->integer('destination_id'); + $return['transactions'][0]['source_id'] = $this->convertInteger('deposit_source_id'); + $return['transactions'][0]['destination_id'] = $this->convertInteger('destination_id'); break; case 'transfer': - $return['transactions'][0]['source_id'] = $this->integer('source_id'); - $return['transactions'][0]['destination_id'] = $this->integer('destination_id'); + $return['transactions'][0]['source_id'] = $this->convertInteger('source_id'); + $return['transactions'][0]['destination_id'] = $this->convertInteger('destination_id'); break; } @@ -219,7 +219,7 @@ class RecurrenceFormRequest extends FormRequest 'category' => 'between:1,255|nullable', 'tags' => 'between:1,255|nullable', ]; - if ($this->integer('foreign_currency_id') > 0) { + if ($this->convertInteger('foreign_currency_id') > 0) { $rules['foreign_currency_id'] = 'exists:transaction_currencies,id'; } diff --git a/app/Http/Requests/RuleFormRequest.php b/app/Http/Requests/RuleFormRequest.php index 0fdd1687dd..9ccdebb399 100644 --- a/app/Http/Requests/RuleFormRequest.php +++ b/app/Http/Requests/RuleFormRequest.php @@ -45,7 +45,7 @@ class RuleFormRequest extends FormRequest { return [ 'title' => $this->convertString('title'), - 'rule_group_id' => $this->integer('rule_group_id'), + 'rule_group_id' => $this->convertInteger('rule_group_id'), 'active' => $this->boolean('active'), 'trigger' => $this->convertString('trigger'), 'description' => $this->stringWithNewlines('description'), diff --git a/app/Http/Requests/UserFormRequest.php b/app/Http/Requests/UserFormRequest.php index 816dd754fa..a10ef457b7 100644 --- a/app/Http/Requests/UserFormRequest.php +++ b/app/Http/Requests/UserFormRequest.php @@ -44,10 +44,10 @@ class UserFormRequest extends FormRequest { return [ 'email' => $this->convertString('email'), - 'blocked' => 1 === $this->integer('blocked'), + 'blocked' => 1 === $this->convertInteger('blocked'), 'blocked_code' => $this->convertString('blocked_code'), 'password' => $this->convertString('password'), - 'is_owner' => 1 === $this->integer('is_owner'), + 'is_owner' => 1 === $this->convertInteger('is_owner'), ]; } diff --git a/app/Support/Request/ConvertsDataTypes.php b/app/Support/Request/ConvertsDataTypes.php index 8cd445b9f5..cc0d51b459 100644 --- a/app/Support/Request/ConvertsDataTypes.php +++ b/app/Support/Request/ConvertsDataTypes.php @@ -39,7 +39,7 @@ trait ConvertsDataTypes * * @return int */ - public function integer(string $field): int + public function convertInteger(string $field): int { return (int) $this->get($field); } From 93c83fbe7a190379dfe6ec54ea66be982df8190e Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 1 Oct 2022 05:29:42 +0200 Subject: [PATCH 2/2] Rename method --- app/Api/V1/Requests/Data/Bulk/MoveTransactionsRequest.php | 4 ++-- app/Api/V1/Requests/Models/Account/StoreRequest.php | 4 ++-- app/Api/V1/Requests/Models/Account/UpdateRequest.php | 4 ++-- app/Api/V1/Requests/Models/Attachment/StoreRequest.php | 2 +- app/Api/V1/Requests/Models/Attachment/UpdateRequest.php | 2 +- app/Api/V1/Requests/Models/AvailableBudget/Request.php | 2 +- app/Api/V1/Requests/Models/Bill/StoreRequest.php | 8 ++++---- app/Api/V1/Requests/Models/Bill/UpdateRequest.php | 8 ++++---- app/Api/V1/Requests/Models/Budget/StoreRequest.php | 4 ++-- app/Api/V1/Requests/Models/Budget/UpdateRequest.php | 4 ++-- app/Api/V1/Requests/Models/BudgetLimit/StoreRequest.php | 2 +- app/Api/V1/Requests/Models/BudgetLimit/UpdateRequest.php | 2 +- app/Api/V1/Requests/Models/ObjectGroup/UpdateRequest.php | 2 +- app/Api/V1/Requests/Models/PiggyBank/StoreRequest.php | 6 +++--- app/Api/V1/Requests/Models/PiggyBank/UpdateRequest.php | 6 +++--- app/Api/V1/Requests/Models/Recurrence/StoreRequest.php | 2 +- app/Api/V1/Requests/Models/Recurrence/UpdateRequest.php | 2 +- app/Api/V1/Requests/Models/Rule/StoreRequest.php | 4 ++-- app/Api/V1/Requests/Models/Rule/UpdateRequest.php | 4 ++-- app/Api/V1/Requests/Models/RuleGroup/StoreRequest.php | 2 +- app/Api/V1/Requests/Models/RuleGroup/UpdateRequest.php | 2 +- .../Requests/Models/TransactionCurrency/StoreRequest.php | 2 +- .../Requests/Models/TransactionCurrency/UpdateRequest.php | 2 +- .../V1/Requests/Models/TransactionLink/StoreRequest.php | 6 +++--- .../V1/Requests/Models/TransactionLink/UpdateRequest.php | 6 +++--- app/Api/V1/Requests/System/UpdateRequest.php | 2 +- 26 files changed, 47 insertions(+), 47 deletions(-) diff --git a/app/Api/V1/Requests/Data/Bulk/MoveTransactionsRequest.php b/app/Api/V1/Requests/Data/Bulk/MoveTransactionsRequest.php index 47ddfb65f9..30afe54219 100644 --- a/app/Api/V1/Requests/Data/Bulk/MoveTransactionsRequest.php +++ b/app/Api/V1/Requests/Data/Bulk/MoveTransactionsRequest.php @@ -43,8 +43,8 @@ class MoveTransactionsRequest extends FormRequest public function getAll(): array { return [ - 'original_account' => $this->integer('original_account'), - 'destination_account' => $this->integer('destination_account'), + 'original_account' => $this->convertInteger('original_account'), + 'destination_account' => $this->convertInteger('destination_account'), ]; } diff --git a/app/Api/V1/Requests/Models/Account/StoreRequest.php b/app/Api/V1/Requests/Models/Account/StoreRequest.php index 2da7798692..e198c0a88a 100644 --- a/app/Api/V1/Requests/Models/Account/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Account/StoreRequest.php @@ -61,8 +61,8 @@ class StoreRequest extends FormRequest 'include_net_worth' => $includeNetWorth, 'account_type_name' => $this->convertString('type'), 'account_type_id' => null, - 'currency_id' => $this->integer('currency_id'), - 'order' => $this->integer('order'), + 'currency_id' => $this->convertInteger('currency_id'), + 'order' => $this->convertInteger('order'), 'currency_code' => $this->convertString('currency_code'), 'virtual_balance' => $this->convertString('virtual_balance'), 'iban' => $this->convertString('iban'), diff --git a/app/Api/V1/Requests/Models/Account/UpdateRequest.php b/app/Api/V1/Requests/Models/Account/UpdateRequest.php index 606e2a253b..83c852a837 100644 --- a/app/Api/V1/Requests/Models/Account/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Account/UpdateRequest.php @@ -67,8 +67,8 @@ class UpdateRequest extends FormRequest 'notes' => ['notes', 'stringWithNewlines'], 'interest' => ['interest', 'convertString'], 'interest_period' => ['interest_period', 'convertString'], - 'order' => ['order', 'integer'], - 'currency_id' => ['currency_id', 'integer'], + 'order' => ['order', 'convertInteger'], + 'currency_id' => ['currency_id', 'convertInteger'], 'currency_code' => ['currency_code', 'convertString'], 'liability_direction' => ['liability_direction', 'convertString'], 'liability_amount' => ['liability_amount', 'convertString'], diff --git a/app/Api/V1/Requests/Models/Attachment/StoreRequest.php b/app/Api/V1/Requests/Models/Attachment/StoreRequest.php index 0099f69146..96fa752803 100644 --- a/app/Api/V1/Requests/Models/Attachment/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Attachment/StoreRequest.php @@ -49,7 +49,7 @@ class StoreRequest extends FormRequest 'title' => $this->convertString('title'), 'notes' => $this->stringWithNewlines('notes'), 'attachable_type' => $this->convertString('attachable_type'), - 'attachable_id' => $this->integer('attachable_id'), + 'attachable_id' => $this->convertInteger('attachable_id'), ]; } diff --git a/app/Api/V1/Requests/Models/Attachment/UpdateRequest.php b/app/Api/V1/Requests/Models/Attachment/UpdateRequest.php index 0dd11131af..0727ea50c9 100644 --- a/app/Api/V1/Requests/Models/Attachment/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Attachment/UpdateRequest.php @@ -49,7 +49,7 @@ class UpdateRequest extends FormRequest 'title' => ['title', 'convertString'], 'notes' => ['notes', 'stringWithNewlines'], 'attachable_type' => ['attachable_type', 'convertString'], - 'attachable_id' => ['attachable_id', 'integer'], + 'attachable_id' => ['attachable_id', 'convertInteger'], ]; return $this->getAllData($fields); diff --git a/app/Api/V1/Requests/Models/AvailableBudget/Request.php b/app/Api/V1/Requests/Models/AvailableBudget/Request.php index 30210f2898..694015c1cf 100644 --- a/app/Api/V1/Requests/Models/AvailableBudget/Request.php +++ b/app/Api/V1/Requests/Models/AvailableBudget/Request.php @@ -47,7 +47,7 @@ class Request extends FormRequest { // this is the way: $fields = [ - 'currency_id' => ['currency_id', 'integer'], + 'currency_id' => ['currency_id', 'convertInteger'], 'currency_code' => ['currency_code', 'convertString'], 'amount' => ['amount', 'convertString'], 'start' => ['start', 'date'], diff --git a/app/Api/V1/Requests/Models/Bill/StoreRequest.php b/app/Api/V1/Requests/Models/Bill/StoreRequest.php index 75f64d9f88..5e3c757dfd 100644 --- a/app/Api/V1/Requests/Models/Bill/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Bill/StoreRequest.php @@ -52,17 +52,17 @@ class StoreRequest extends FormRequest 'name' => ['name', 'convertString'], 'amount_min' => ['amount_min', 'convertString'], 'amount_max' => ['amount_max', 'convertString'], - 'currency_id' => ['currency_id', 'integer'], + 'currency_id' => ['currency_id', 'convertInteger'], 'currency_code' => ['currency_code', 'convertString'], 'date' => ['date', 'date'], 'end_date' => ['end_date', 'date'], 'extension_date' => ['extension_date', 'date'], 'repeat_freq' => ['repeat_freq', 'convertString'], - 'skip' => ['skip', 'integer'], + 'skip' => ['skip', 'convertInteger'], 'active' => ['active', 'boolean'], - 'order' => ['order', 'integer'], + 'order' => ['order', 'convertInteger'], 'notes' => ['notes', 'stringWithNewlines'], - 'object_group_id' => ['object_group_id', 'integer'], + 'object_group_id' => ['object_group_id', 'convertInteger'], 'object_group_title' => ['object_group_title', 'convertString'], ]; diff --git a/app/Api/V1/Requests/Models/Bill/UpdateRequest.php b/app/Api/V1/Requests/Models/Bill/UpdateRequest.php index 07c5206b37..0159fe68ed 100644 --- a/app/Api/V1/Requests/Models/Bill/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Bill/UpdateRequest.php @@ -50,17 +50,17 @@ class UpdateRequest extends FormRequest 'name' => ['name', 'convertString'], 'amount_min' => ['amount_min', 'convertString'], 'amount_max' => ['amount_max', 'convertString'], - 'currency_id' => ['currency_id', 'integer'], + 'currency_id' => ['currency_id', 'convertInteger'], 'currency_code' => ['currency_code', 'convertString'], 'date' => ['date', 'date'], 'end_date' => ['end_date', 'date'], 'extension_date' => ['extension_date', 'date'], 'repeat_freq' => ['repeat_freq', 'convertString'], - 'skip' => ['skip', 'integer'], + 'skip' => ['skip', 'convertInteger'], 'active' => ['active', 'boolean'], - 'order' => ['order', 'integer'], + 'order' => ['order', 'convertInteger'], 'notes' => ['notes', 'stringWithNewlines'], - 'object_group_id' => ['object_group_id', 'integer'], + 'object_group_id' => ['object_group_id', 'convertInteger'], 'object_group_title' => ['object_group_title', 'convertString'], ]; diff --git a/app/Api/V1/Requests/Models/Budget/StoreRequest.php b/app/Api/V1/Requests/Models/Budget/StoreRequest.php index 75948a1c41..0398b7e5b5 100644 --- a/app/Api/V1/Requests/Models/Budget/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Budget/StoreRequest.php @@ -49,11 +49,11 @@ class StoreRequest extends FormRequest $fields = [ 'name' => ['name', 'convertString'], 'active' => ['active', 'boolean'], - 'order' => ['active', 'integer'], + 'order' => ['active', 'convertInteger'], 'notes' => ['notes', 'convertString'], // auto budget currency: - 'currency_id' => ['auto_budget_currency_id', 'integer'], + 'currency_id' => ['auto_budget_currency_id', 'convertInteger'], 'currency_code' => ['auto_budget_currency_code', 'convertString'], 'auto_budget_type' => ['auto_budget_type', 'convertString'], 'auto_budget_amount' => ['auto_budget_amount', 'convertString'], diff --git a/app/Api/V1/Requests/Models/Budget/UpdateRequest.php b/app/Api/V1/Requests/Models/Budget/UpdateRequest.php index 1c1c04302e..230edd7cd9 100644 --- a/app/Api/V1/Requests/Models/Budget/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Budget/UpdateRequest.php @@ -50,9 +50,9 @@ class UpdateRequest extends FormRequest $fields = [ 'name' => ['name', 'convertString'], 'active' => ['active', 'boolean'], - 'order' => ['order', 'integer'], + 'order' => ['order', 'convertInteger'], 'notes' => ['notes', 'convertString'], - 'currency_id' => ['auto_budget_currency_id', 'integer'], + 'currency_id' => ['auto_budget_currency_id', 'convertInteger'], 'currency_code' => ['auto_budget_currency_code', 'convertString'], 'auto_budget_type' => ['auto_budget_type', 'convertString'], 'auto_budget_amount' => ['auto_budget_amount', 'convertString'], diff --git a/app/Api/V1/Requests/Models/BudgetLimit/StoreRequest.php b/app/Api/V1/Requests/Models/BudgetLimit/StoreRequest.php index 944ac431aa..f2d98b5017 100644 --- a/app/Api/V1/Requests/Models/BudgetLimit/StoreRequest.php +++ b/app/Api/V1/Requests/Models/BudgetLimit/StoreRequest.php @@ -47,7 +47,7 @@ class StoreRequest extends FormRequest 'start' => $this->getCarbonDate('start'), 'end' => $this->getCarbonDate('end'), 'amount' => $this->convertString('amount'), - 'currency_id' => $this->integer('currency_id'), + 'currency_id' => $this->convertInteger('currency_id'), 'currency_code' => $this->convertString('currency_code'), ]; } diff --git a/app/Api/V1/Requests/Models/BudgetLimit/UpdateRequest.php b/app/Api/V1/Requests/Models/BudgetLimit/UpdateRequest.php index bde29867b0..abc6936abc 100644 --- a/app/Api/V1/Requests/Models/BudgetLimit/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/BudgetLimit/UpdateRequest.php @@ -49,7 +49,7 @@ class UpdateRequest extends FormRequest 'start' => ['start', 'date'], 'end' => ['end', 'date'], 'amount' => ['amount', 'convertString'], - 'currency_id' => ['currency_id', 'integer'], + 'currency_id' => ['currency_id', 'convertInteger'], 'currency_code' => ['currency_code', 'convertString'], ]; diff --git a/app/Api/V1/Requests/Models/ObjectGroup/UpdateRequest.php b/app/Api/V1/Requests/Models/ObjectGroup/UpdateRequest.php index 44f1e2d863..e0c3e12c66 100644 --- a/app/Api/V1/Requests/Models/ObjectGroup/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/ObjectGroup/UpdateRequest.php @@ -44,7 +44,7 @@ class UpdateRequest extends FormRequest { $fields = [ 'title' => ['title', 'convertString'], - 'order' => ['order', 'integer'], + 'order' => ['order', 'convertInteger'], ]; return $this->getAllData($fields); diff --git a/app/Api/V1/Requests/Models/PiggyBank/StoreRequest.php b/app/Api/V1/Requests/Models/PiggyBank/StoreRequest.php index aab5cfee20..768fd93020 100644 --- a/app/Api/V1/Requests/Models/PiggyBank/StoreRequest.php +++ b/app/Api/V1/Requests/Models/PiggyBank/StoreRequest.php @@ -44,17 +44,17 @@ class StoreRequest extends FormRequest public function getAll(): array { $fields = [ - 'order' => ['order', 'integer'], + 'order' => ['order', 'convertInteger'], ]; $data = $this->getAllData($fields); $data['name'] = $this->convertString('name'); - $data['account_id'] = $this->integer('account_id'); + $data['account_id'] = $this->convertInteger('account_id'); $data['targetamount'] = $this->convertString('target_amount'); $data['current_amount'] = $this->convertString('current_amount'); $data['startdate'] = $this->getCarbonDate('start_date'); $data['targetdate'] = $this->getCarbonDate('target_date'); $data['notes'] = $this->stringWithNewlines('notes'); - $data['object_group_id'] = $this->integer('object_group_id'); + $data['object_group_id'] = $this->convertInteger('object_group_id'); $data['object_group_title'] = $this->convertString('object_group_title'); return $data; diff --git a/app/Api/V1/Requests/Models/PiggyBank/UpdateRequest.php b/app/Api/V1/Requests/Models/PiggyBank/UpdateRequest.php index 04b7a87b85..189a4a4360 100644 --- a/app/Api/V1/Requests/Models/PiggyBank/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/PiggyBank/UpdateRequest.php @@ -47,15 +47,15 @@ class UpdateRequest extends FormRequest { $fields = [ 'name' => ['name', 'convertString'], - 'account_id' => ['account_id', 'integer'], + 'account_id' => ['account_id', 'convertInteger'], 'targetamount' => ['target_amount', 'convertString'], 'current_amount' => ['current_amount', 'convertString'], 'startdate' => ['start_date', 'date'], 'targetdate' => ['target_date', 'convertString'], 'notes' => ['notes', 'stringWithNewlines'], - 'order' => ['order', 'integer'], + 'order' => ['order', 'convertInteger'], 'object_group_title' => ['object_group_title', 'convertString'], - 'object_group_id' => ['object_group_id', 'integer'], + 'object_group_id' => ['object_group_id', 'convertInteger'], ]; return $this->getAllData($fields); diff --git a/app/Api/V1/Requests/Models/Recurrence/StoreRequest.php b/app/Api/V1/Requests/Models/Recurrence/StoreRequest.php index f0515f35ac..5235446ea0 100644 --- a/app/Api/V1/Requests/Models/Recurrence/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Recurrence/StoreRequest.php @@ -54,7 +54,7 @@ class StoreRequest extends FormRequest 'description' => ['description', 'convertString'], 'first_date' => ['first_date', 'date'], 'repeat_until' => ['repeat_until', 'date'], - 'nr_of_repetitions' => ['nr_of_repetitions', 'integer'], + 'nr_of_repetitions' => ['nr_of_repetitions', 'convertInteger'], 'apply_rules' => ['apply_rules', 'boolean'], 'active' => ['active', 'boolean'], 'notes' => ['notes', 'stringWithNewlines'], diff --git a/app/Api/V1/Requests/Models/Recurrence/UpdateRequest.php b/app/Api/V1/Requests/Models/Recurrence/UpdateRequest.php index 5999b57ce2..0df8810a08 100644 --- a/app/Api/V1/Requests/Models/Recurrence/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Recurrence/UpdateRequest.php @@ -55,7 +55,7 @@ class UpdateRequest extends FormRequest 'description' => ['description', 'convertString'], 'first_date' => ['first_date', 'date'], 'repeat_until' => ['repeat_until', 'date'], - 'nr_of_repetitions' => ['nr_of_repetitions', 'integer'], + 'nr_of_repetitions' => ['nr_of_repetitions', 'convertInteger'], 'apply_rules' => ['apply_rules', 'boolean'], 'active' => ['active', 'boolean'], 'notes' => ['notes', 'convertString'], diff --git a/app/Api/V1/Requests/Models/Rule/StoreRequest.php b/app/Api/V1/Requests/Models/Rule/StoreRequest.php index f82b3fa7bb..042d9051c8 100644 --- a/app/Api/V1/Requests/Models/Rule/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Rule/StoreRequest.php @@ -48,8 +48,8 @@ class StoreRequest extends FormRequest $fields = [ 'title' => ['title', 'convertString'], 'description' => ['description', 'convertString'], - 'rule_group_id' => ['rule_group_id', 'integer'], - 'order' => ['order', 'integer'], + 'rule_group_id' => ['rule_group_id', 'convertInteger'], + 'order' => ['order', 'convertInteger'], 'rule_group_title' => ['rule_group_title', 'convertString'], 'trigger' => ['trigger', 'convertString'], 'strict' => ['strict', 'boolean'], diff --git a/app/Api/V1/Requests/Models/Rule/UpdateRequest.php b/app/Api/V1/Requests/Models/Rule/UpdateRequest.php index cad045491e..b3746488ef 100644 --- a/app/Api/V1/Requests/Models/Rule/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Rule/UpdateRequest.php @@ -48,12 +48,12 @@ class UpdateRequest extends FormRequest $fields = [ 'title' => ['title', 'convertString'], 'description' => ['description', 'stringWithNewlines'], - 'rule_group_id' => ['rule_group_id', 'integer'], + 'rule_group_id' => ['rule_group_id', 'convertInteger'], 'trigger' => ['trigger', 'convertString'], 'strict' => ['strict', 'boolean'], 'stop_processing' => ['stop_processing', 'boolean'], 'active' => ['active', 'boolean'], - 'order' => ['order', 'integer'], + 'order' => ['order', 'convertInteger'], ]; $return = $this->getAllData($fields); diff --git a/app/Api/V1/Requests/Models/RuleGroup/StoreRequest.php b/app/Api/V1/Requests/Models/RuleGroup/StoreRequest.php index 5bb4904cd2..1bfa8f5475 100644 --- a/app/Api/V1/Requests/Models/RuleGroup/StoreRequest.php +++ b/app/Api/V1/Requests/Models/RuleGroup/StoreRequest.php @@ -49,7 +49,7 @@ class StoreRequest extends FormRequest $active = $this->boolean('active'); } if (null !== $this->get('order')) { - $order = $this->integer('order'); + $order = $this->convertInteger('order'); } return [ diff --git a/app/Api/V1/Requests/Models/RuleGroup/UpdateRequest.php b/app/Api/V1/Requests/Models/RuleGroup/UpdateRequest.php index 330dc52b49..0efada299e 100644 --- a/app/Api/V1/Requests/Models/RuleGroup/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/RuleGroup/UpdateRequest.php @@ -48,7 +48,7 @@ class UpdateRequest extends FormRequest 'title' => ['title', 'convertString'], 'description' => ['description', 'stringWithNewlines'], 'active' => ['active', 'boolean'], - 'order' => ['order', 'integer'], + 'order' => ['order', 'convertInteger'], ]; return $this->getAllData($fields); diff --git a/app/Api/V1/Requests/Models/TransactionCurrency/StoreRequest.php b/app/Api/V1/Requests/Models/TransactionCurrency/StoreRequest.php index b7995396cf..f0fe87c6d7 100644 --- a/app/Api/V1/Requests/Models/TransactionCurrency/StoreRequest.php +++ b/app/Api/V1/Requests/Models/TransactionCurrency/StoreRequest.php @@ -57,7 +57,7 @@ class StoreRequest extends FormRequest 'name' => $this->convertString('name'), 'code' => $this->convertString('code'), 'symbol' => $this->convertString('symbol'), - 'decimal_places' => $this->integer('decimal_places'), + 'decimal_places' => $this->convertInteger('decimal_places'), 'default' => $default, 'enabled' => $enabled, ]; diff --git a/app/Api/V1/Requests/Models/TransactionCurrency/UpdateRequest.php b/app/Api/V1/Requests/Models/TransactionCurrency/UpdateRequest.php index 80ece22ce8..df72125217 100644 --- a/app/Api/V1/Requests/Models/TransactionCurrency/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/TransactionCurrency/UpdateRequest.php @@ -49,7 +49,7 @@ class UpdateRequest extends FormRequest 'name' => ['name', 'convertString'], 'code' => ['code', 'convertString'], 'symbol' => ['symbol', 'convertString'], - 'decimal_places' => ['decimal_places', 'integer'], + 'decimal_places' => ['decimal_places', 'convertInteger'], 'default' => ['default', 'boolean'], 'enabled' => ['enabled', 'boolean'], ]; diff --git a/app/Api/V1/Requests/Models/TransactionLink/StoreRequest.php b/app/Api/V1/Requests/Models/TransactionLink/StoreRequest.php index 07763da9c4..9473a75a42 100644 --- a/app/Api/V1/Requests/Models/TransactionLink/StoreRequest.php +++ b/app/Api/V1/Requests/Models/TransactionLink/StoreRequest.php @@ -46,10 +46,10 @@ class StoreRequest extends FormRequest public function getAll(): array { return [ - 'link_type_id' => $this->integer('link_type_id'), + 'link_type_id' => $this->convertInteger('link_type_id'), 'link_type_name' => $this->convertString('link_type_name'), - 'inward_id' => $this->integer('inward_id'), - 'outward_id' => $this->integer('outward_id'), + 'inward_id' => $this->convertInteger('inward_id'), + 'outward_id' => $this->convertInteger('outward_id'), 'notes' => $this->stringWithNewlines('notes'), ]; } diff --git a/app/Api/V1/Requests/Models/TransactionLink/UpdateRequest.php b/app/Api/V1/Requests/Models/TransactionLink/UpdateRequest.php index a70ffa34ea..0649b832c8 100644 --- a/app/Api/V1/Requests/Models/TransactionLink/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/TransactionLink/UpdateRequest.php @@ -46,10 +46,10 @@ class UpdateRequest extends FormRequest public function getAll(): array { return [ - 'link_type_id' => $this->integer('link_type_id'), + 'link_type_id' => $this->convertInteger('link_type_id'), 'link_type_name' => $this->convertString('link_type_name'), - 'inward_id' => $this->integer('inward_id'), - 'outward_id' => $this->integer('outward_id'), + 'inward_id' => $this->convertInteger('inward_id'), + 'outward_id' => $this->convertInteger('outward_id'), 'notes' => $this->stringWithNewlines('notes'), ]; } diff --git a/app/Api/V1/Requests/System/UpdateRequest.php b/app/Api/V1/Requests/System/UpdateRequest.php index 5d96d360b8..fddaa7cb80 100644 --- a/app/Api/V1/Requests/System/UpdateRequest.php +++ b/app/Api/V1/Requests/System/UpdateRequest.php @@ -54,7 +54,7 @@ class UpdateRequest extends FormRequest return ['value' => $this->boolean('value')]; case 'configuration.permission_update_check': case 'configuration.last_update_check': - return ['value' => $this->integer('value')]; + return ['value' => $this->convertInteger('value')]; } return ['value' => $this->convertString('value')];