mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-30 02:26:58 +00:00
Attempted fix for #6475
This commit is contained in:
@@ -48,7 +48,7 @@ class AccountFormRequest extends FormRequest
|
|||||||
'name' => $this->convertString('name'),
|
'name' => $this->convertString('name'),
|
||||||
'active' => $this->boolean('active'),
|
'active' => $this->boolean('active'),
|
||||||
'account_type_name' => $this->convertString('objectType'),
|
'account_type_name' => $this->convertString('objectType'),
|
||||||
'currency_id' => $this->integer('currency_id'),
|
'currency_id' => $this->convertInteger('currency_id'),
|
||||||
'virtual_balance' => $this->convertString('virtual_balance'),
|
'virtual_balance' => $this->convertString('virtual_balance'),
|
||||||
'iban' => $this->convertString('iban'),
|
'iban' => $this->convertString('iban'),
|
||||||
'BIC' => $this->convertString('BIC'),
|
'BIC' => $this->convertString('BIC'),
|
||||||
@@ -77,7 +77,7 @@ class AccountFormRequest extends FormRequest
|
|||||||
// that could have been selected.
|
// that could have been selected.
|
||||||
if ('liabilities' === $data['account_type_name']) {
|
if ('liabilities' === $data['account_type_name']) {
|
||||||
$data['account_type_name'] = null;
|
$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']) {
|
if ('' !== $data['opening_balance']) {
|
||||||
$data['opening_balance'] = app('steam')->negative($data['opening_balance']);
|
$data['opening_balance'] = app('steam')->negative($data['opening_balance']);
|
||||||
}
|
}
|
||||||
|
@@ -43,14 +43,14 @@ class BillStoreRequest extends FormRequest
|
|||||||
return [
|
return [
|
||||||
'name' => $this->convertString('name'),
|
'name' => $this->convertString('name'),
|
||||||
'amount_min' => $this->convertString('amount_min'),
|
'amount_min' => $this->convertString('amount_min'),
|
||||||
'currency_id' => $this->integer('transaction_currency_id'),
|
'currency_id' => $this->convertInteger('transaction_currency_id'),
|
||||||
'currency_code' => '',
|
'currency_code' => '',
|
||||||
'amount_max' => $this->convertString('amount_max'),
|
'amount_max' => $this->convertString('amount_max'),
|
||||||
'date' => $this->getCarbonDate('date'),
|
'date' => $this->getCarbonDate('date'),
|
||||||
'end_date' => $this->getCarbonDate('bill_end_date'),
|
'end_date' => $this->getCarbonDate('bill_end_date'),
|
||||||
'extension_date' => $this->getCarbonDate('extension_date'),
|
'extension_date' => $this->getCarbonDate('extension_date'),
|
||||||
'repeat_freq' => $this->convertString('repeat_freq'),
|
'repeat_freq' => $this->convertString('repeat_freq'),
|
||||||
'skip' => $this->integer('skip'),
|
'skip' => $this->convertInteger('skip'),
|
||||||
'notes' => $this->stringWithNewlines('notes'),
|
'notes' => $this->stringWithNewlines('notes'),
|
||||||
'active' => $this->boolean('active'),
|
'active' => $this->boolean('active'),
|
||||||
'object_group_title' => $this->convertString('object_group'),
|
'object_group_title' => $this->convertString('object_group'),
|
||||||
|
@@ -44,14 +44,14 @@ class BillUpdateRequest extends FormRequest
|
|||||||
return [
|
return [
|
||||||
'name' => $this->convertString('name'),
|
'name' => $this->convertString('name'),
|
||||||
'amount_min' => $this->convertString('amount_min'),
|
'amount_min' => $this->convertString('amount_min'),
|
||||||
'currency_id' => $this->integer('transaction_currency_id'),
|
'currency_id' => $this->convertInteger('transaction_currency_id'),
|
||||||
'currency_code' => '',
|
'currency_code' => '',
|
||||||
'amount_max' => $this->convertString('amount_max'),
|
'amount_max' => $this->convertString('amount_max'),
|
||||||
'date' => $this->getCarbonDate('date'),
|
'date' => $this->getCarbonDate('date'),
|
||||||
'end_date' => $this->getCarbonDate('bill_end_date'),
|
'end_date' => $this->getCarbonDate('bill_end_date'),
|
||||||
'extension_date' => $this->getCarbonDate('extension_date'),
|
'extension_date' => $this->getCarbonDate('extension_date'),
|
||||||
'repeat_freq' => $this->convertString('repeat_freq'),
|
'repeat_freq' => $this->convertString('repeat_freq'),
|
||||||
'skip' => $this->integer('skip'),
|
'skip' => $this->convertInteger('skip'),
|
||||||
'notes' => $this->stringWithNewlines('notes'),
|
'notes' => $this->stringWithNewlines('notes'),
|
||||||
'active' => $this->boolean('active'),
|
'active' => $this->boolean('active'),
|
||||||
'object_group_title' => $this->convertString('object_group'),
|
'object_group_title' => $this->convertString('object_group'),
|
||||||
|
@@ -46,8 +46,8 @@ class BudgetFormStoreRequest extends FormRequest
|
|||||||
return [
|
return [
|
||||||
'name' => $this->convertString('name'),
|
'name' => $this->convertString('name'),
|
||||||
'active' => $this->boolean('active'),
|
'active' => $this->boolean('active'),
|
||||||
'auto_budget_type' => $this->integer('auto_budget_type'),
|
'auto_budget_type' => $this->convertInteger('auto_budget_type'),
|
||||||
'currency_id' => $this->integer('auto_budget_currency_id'),
|
'currency_id' => $this->convertInteger('auto_budget_currency_id'),
|
||||||
'auto_budget_amount' => $this->convertString('auto_budget_amount'),
|
'auto_budget_amount' => $this->convertString('auto_budget_amount'),
|
||||||
'auto_budget_period' => $this->convertString('auto_budget_period'),
|
'auto_budget_period' => $this->convertString('auto_budget_period'),
|
||||||
];
|
];
|
||||||
|
@@ -47,8 +47,8 @@ class BudgetFormUpdateRequest extends FormRequest
|
|||||||
return [
|
return [
|
||||||
'name' => $this->convertString('name'),
|
'name' => $this->convertString('name'),
|
||||||
'active' => $this->boolean('active'),
|
'active' => $this->boolean('active'),
|
||||||
'auto_budget_type' => $this->integer('auto_budget_type'),
|
'auto_budget_type' => $this->convertInteger('auto_budget_type'),
|
||||||
'currency_id' => $this->integer('auto_budget_currency_id'),
|
'currency_id' => $this->convertInteger('auto_budget_currency_id'),
|
||||||
'auto_budget_amount' => $this->convertString('auto_budget_amount'),
|
'auto_budget_amount' => $this->convertString('auto_budget_amount'),
|
||||||
'auto_budget_period' => $this->convertString('auto_budget_period'),
|
'auto_budget_period' => $this->convertString('auto_budget_period'),
|
||||||
];
|
];
|
||||||
|
@@ -45,7 +45,7 @@ class CurrencyFormRequest extends FormRequest
|
|||||||
'name' => $this->convertString('name'),
|
'name' => $this->convertString('name'),
|
||||||
'code' => $this->convertString('code'),
|
'code' => $this->convertString('code'),
|
||||||
'symbol' => $this->convertString('symbol'),
|
'symbol' => $this->convertString('symbol'),
|
||||||
'decimal_places' => $this->integer('decimal_places'),
|
'decimal_places' => $this->convertInteger('decimal_places'),
|
||||||
'enabled' => $this->boolean('enabled'),
|
'enabled' => $this->boolean('enabled'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@@ -45,7 +45,7 @@ class JournalLinkRequest extends FormRequest
|
|||||||
$linkType = $this->get('link_type');
|
$linkType = $this->get('link_type');
|
||||||
$parts = explode('_', $linkType);
|
$parts = explode('_', $linkType);
|
||||||
$return['link_type_id'] = (int) $parts[0];
|
$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['notes'] = $this->convertString('notes');
|
||||||
$return['direction'] = $parts[1];
|
$return['direction'] = $parts[1];
|
||||||
|
|
||||||
|
@@ -43,7 +43,7 @@ class PiggyBankStoreRequest extends FormRequest
|
|||||||
return [
|
return [
|
||||||
'name' => $this->convertString('name'),
|
'name' => $this->convertString('name'),
|
||||||
'startdate' => $this->getCarbonDate('startdate'),
|
'startdate' => $this->getCarbonDate('startdate'),
|
||||||
'account_id' => $this->integer('account_id'),
|
'account_id' => $this->convertInteger('account_id'),
|
||||||
'targetamount' => $this->convertString('targetamount'),
|
'targetamount' => $this->convertString('targetamount'),
|
||||||
'targetdate' => $this->getCarbonDate('targetdate'),
|
'targetdate' => $this->getCarbonDate('targetdate'),
|
||||||
'notes' => $this->stringWithNewlines('notes'),
|
'notes' => $this->stringWithNewlines('notes'),
|
||||||
|
@@ -44,7 +44,7 @@ class PiggyBankUpdateRequest extends FormRequest
|
|||||||
return [
|
return [
|
||||||
'name' => $this->convertString('name'),
|
'name' => $this->convertString('name'),
|
||||||
'startdate' => $this->getCarbonDate('startdate'),
|
'startdate' => $this->getCarbonDate('startdate'),
|
||||||
'account_id' => $this->integer('account_id'),
|
'account_id' => $this->convertInteger('account_id'),
|
||||||
'targetamount' => $this->convertString('targetamount'),
|
'targetamount' => $this->convertString('targetamount'),
|
||||||
'targetdate' => $this->getCarbonDate('targetdate'),
|
'targetdate' => $this->getCarbonDate('targetdate'),
|
||||||
'notes' => $this->stringWithNewlines('notes'),
|
'notes' => $this->stringWithNewlines('notes'),
|
||||||
|
@@ -61,14 +61,14 @@ class RecurrenceFormRequest extends FormRequest
|
|||||||
'description' => $this->convertString('recurring_description'),
|
'description' => $this->convertString('recurring_description'),
|
||||||
'first_date' => $this->getCarbonDate('first_date'),
|
'first_date' => $this->getCarbonDate('first_date'),
|
||||||
'repeat_until' => $this->getCarbonDate('repeat_until'),
|
'repeat_until' => $this->getCarbonDate('repeat_until'),
|
||||||
'nr_of_repetitions' => $this->integer('repetitions'),
|
'nr_of_repetitions' => $this->convertInteger('repetitions'),
|
||||||
'apply_rules' => $this->boolean('apply_rules'),
|
'apply_rules' => $this->boolean('apply_rules'),
|
||||||
'active' => $this->boolean('active'),
|
'active' => $this->boolean('active'),
|
||||||
'repetition_end' => $this->convertString('repetition_end'),
|
'repetition_end' => $this->convertString('repetition_end'),
|
||||||
],
|
],
|
||||||
'transactions' => [
|
'transactions' => [
|
||||||
[
|
[
|
||||||
'currency_id' => $this->integer('transaction_currency_id'),
|
'currency_id' => $this->convertInteger('transaction_currency_id'),
|
||||||
'currency_code' => null,
|
'currency_code' => null,
|
||||||
'type' => $this->convertString('transaction_type'),
|
'type' => $this->convertString('transaction_type'),
|
||||||
'description' => $this->convertString('transaction_description'),
|
'description' => $this->convertString('transaction_description'),
|
||||||
@@ -76,14 +76,14 @@ class RecurrenceFormRequest extends FormRequest
|
|||||||
'foreign_amount' => null,
|
'foreign_amount' => null,
|
||||||
'foreign_currency_id' => null,
|
'foreign_currency_id' => null,
|
||||||
'foreign_currency_code' => null,
|
'foreign_currency_code' => null,
|
||||||
'budget_id' => $this->integer('budget_id'),
|
'budget_id' => $this->convertInteger('budget_id'),
|
||||||
'budget_name' => null,
|
'budget_name' => null,
|
||||||
'bill_id' => $this->integer('bill_id'),
|
'bill_id' => $this->convertInteger('bill_id'),
|
||||||
'bill_name' => null,
|
'bill_name' => null,
|
||||||
'category_id' => null,
|
'category_id' => null,
|
||||||
'category_name' => $this->convertString('category'),
|
'category_name' => $this->convertString('category'),
|
||||||
'tags' => '' !== $this->convertString('tags') ? explode(',', $this->convertString('tags')) : [],
|
'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,
|
'piggy_bank_name' => null,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@@ -91,8 +91,8 @@ class RecurrenceFormRequest extends FormRequest
|
|||||||
[
|
[
|
||||||
'type' => $repetitionData['type'],
|
'type' => $repetitionData['type'],
|
||||||
'moment' => $repetitionData['moment'],
|
'moment' => $repetitionData['moment'],
|
||||||
'skip' => $this->integer('skip'),
|
'skip' => $this->convertInteger('skip'),
|
||||||
'weekend' => $this->integer('weekend'),
|
'weekend' => $this->convertInteger('weekend'),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ class RecurrenceFormRequest extends FormRequest
|
|||||||
// fill in foreign currency data
|
// fill in foreign currency data
|
||||||
if (null !== $this->float('foreign_amount')) {
|
if (null !== $this->float('foreign_amount')) {
|
||||||
$return['transactions'][0]['foreign_amount'] = $this->convertString('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:
|
// default values:
|
||||||
$return['transactions'][0]['source_id'] = null;
|
$return['transactions'][0]['source_id'] = null;
|
||||||
@@ -113,16 +113,16 @@ class RecurrenceFormRequest extends FormRequest
|
|||||||
default:
|
default:
|
||||||
throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->convertString('transaction_type')));
|
throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->convertString('transaction_type')));
|
||||||
case 'withdrawal':
|
case 'withdrawal':
|
||||||
$return['transactions'][0]['source_id'] = $this->integer('source_id');
|
$return['transactions'][0]['source_id'] = $this->convertInteger('source_id');
|
||||||
$return['transactions'][0]['destination_id'] = $this->integer('withdrawal_destination_id');
|
$return['transactions'][0]['destination_id'] = $this->convertInteger('withdrawal_destination_id');
|
||||||
break;
|
break;
|
||||||
case 'deposit':
|
case 'deposit':
|
||||||
$return['transactions'][0]['source_id'] = $this->integer('deposit_source_id');
|
$return['transactions'][0]['source_id'] = $this->convertInteger('deposit_source_id');
|
||||||
$return['transactions'][0]['destination_id'] = $this->integer('destination_id');
|
$return['transactions'][0]['destination_id'] = $this->convertInteger('destination_id');
|
||||||
break;
|
break;
|
||||||
case 'transfer':
|
case 'transfer':
|
||||||
$return['transactions'][0]['source_id'] = $this->integer('source_id');
|
$return['transactions'][0]['source_id'] = $this->convertInteger('source_id');
|
||||||
$return['transactions'][0]['destination_id'] = $this->integer('destination_id');
|
$return['transactions'][0]['destination_id'] = $this->convertInteger('destination_id');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,7 +219,7 @@ class RecurrenceFormRequest extends FormRequest
|
|||||||
'category' => 'between:1,255|nullable',
|
'category' => 'between:1,255|nullable',
|
||||||
'tags' => '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';
|
$rules['foreign_currency_id'] = 'exists:transaction_currencies,id';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -45,7 +45,7 @@ class RuleFormRequest extends FormRequest
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'title' => $this->convertString('title'),
|
'title' => $this->convertString('title'),
|
||||||
'rule_group_id' => $this->integer('rule_group_id'),
|
'rule_group_id' => $this->convertInteger('rule_group_id'),
|
||||||
'active' => $this->boolean('active'),
|
'active' => $this->boolean('active'),
|
||||||
'trigger' => $this->convertString('trigger'),
|
'trigger' => $this->convertString('trigger'),
|
||||||
'description' => $this->stringWithNewlines('description'),
|
'description' => $this->stringWithNewlines('description'),
|
||||||
|
@@ -44,10 +44,10 @@ class UserFormRequest extends FormRequest
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'email' => $this->convertString('email'),
|
'email' => $this->convertString('email'),
|
||||||
'blocked' => 1 === $this->integer('blocked'),
|
'blocked' => 1 === $this->convertInteger('blocked'),
|
||||||
'blocked_code' => $this->convertString('blocked_code'),
|
'blocked_code' => $this->convertString('blocked_code'),
|
||||||
'password' => $this->convertString('password'),
|
'password' => $this->convertString('password'),
|
||||||
'is_owner' => 1 === $this->integer('is_owner'),
|
'is_owner' => 1 === $this->convertInteger('is_owner'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -39,7 +39,7 @@ trait ConvertsDataTypes
|
|||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function integer(string $field): int
|
public function convertInteger(string $field): int
|
||||||
{
|
{
|
||||||
return (int) $this->get($field);
|
return (int) $this->get($field);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user