Attempted fix for #6475

This commit is contained in:
James Cole
2022-09-30 20:07:01 +02:00
parent 1558e87923
commit 4474a71e65
13 changed files with 33 additions and 33 deletions

View File

@@ -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';
}