Fix bad call to method.

This commit is contained in:
James Cole
2022-05-02 19:35:35 +02:00
parent cf89d93cec
commit 2b615cf757
49 changed files with 157 additions and 157 deletions

View File

@@ -45,24 +45,24 @@ class AccountFormRequest extends FormRequest
public function getAccountData(): array
{
$data = [
'name' => $this->string('name'),
'name' => $this->convertString('name'),
'active' => $this->boolean('active'),
'account_type_name' => $this->string('objectType'),
'account_type_name' => $this->convertString('objectType'),
'currency_id' => $this->integer('currency_id'),
'virtual_balance' => $this->string('virtual_balance'),
'iban' => $this->string('iban'),
'BIC' => $this->string('BIC'),
'account_number' => $this->string('account_number'),
'account_role' => $this->string('account_role'),
'opening_balance' => $this->string('opening_balance'),
'virtual_balance' => $this->convertString('virtual_balance'),
'iban' => $this->convertString('iban'),
'BIC' => $this->convertString('BIC'),
'account_number' => $this->convertString('account_number'),
'account_role' => $this->convertString('account_role'),
'opening_balance' => $this->convertString('opening_balance'),
'opening_balance_date' => $this->getCarbonDate('opening_balance_date'),
'cc_type' => $this->string('cc_type'),
'cc_monthly_payment_date' => $this->string('cc_monthly_payment_date'),
'cc_type' => $this->convertString('cc_type'),
'cc_monthly_payment_date' => $this->convertString('cc_monthly_payment_date'),
'notes' => $this->stringWithNewlines('notes'),
'interest' => $this->string('interest'),
'interest_period' => $this->string('interest_period'),
'interest' => $this->convertString('interest'),
'interest_period' => $this->convertString('interest_period'),
'include_net_worth' => '1',
'liability_direction' => $this->string('liability_direction'),
'liability_direction' => $this->convertString('liability_direction'),
];
$data = $this->appendLocationData($data, 'location');
@@ -100,7 +100,7 @@ class AccountFormRequest extends FormRequest
'name' => 'required|min:1|uniqueAccountForUser',
'opening_balance' => 'numeric|nullable|max:1000000000',
'opening_balance_date' => 'date|required_with:opening_balance|nullable',
'iban' => ['iban', 'nullable', new UniqueIban(null, $this->string('objectType'))],
'iban' => ['iban', 'nullable', new UniqueIban(null, $this->convertString('objectType'))],
'BIC' => 'bic|nullable',
'virtual_balance' => 'numeric|nullable|max:1000000000',
'currency_id' => 'exists:transaction_currencies,id',

View File

@@ -43,8 +43,8 @@ class AttachmentFormRequest extends FormRequest
public function getAttachmentData(): array
{
return [
'title' => $this->string('title'),
'notes' => $this->string('notes'),
'title' => $this->convertString('title'),
'notes' => $this->convertString('notes'),
];
}

View File

@@ -41,19 +41,19 @@ class BillStoreRequest extends FormRequest
public function getBillData(): array
{
return [
'name' => $this->string('name'),
'amount_min' => $this->string('amount_min'),
'name' => $this->convertString('name'),
'amount_min' => $this->convertString('amount_min'),
'currency_id' => $this->integer('transaction_currency_id'),
'currency_code' => '',
'amount_max' => $this->string('amount_max'),
'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->string('repeat_freq'),
'repeat_freq' => $this->convertString('repeat_freq'),
'skip' => $this->integer('skip'),
'notes' => $this->stringWithNewlines('notes'),
'active' => $this->boolean('active'),
'object_group_title' => $this->string('object_group'),
'object_group_title' => $this->convertString('object_group'),
];
}

View File

@@ -42,19 +42,19 @@ class BillUpdateRequest extends FormRequest
public function getBillData(): array
{
return [
'name' => $this->string('name'),
'amount_min' => $this->string('amount_min'),
'name' => $this->convertString('name'),
'amount_min' => $this->convertString('amount_min'),
'currency_id' => $this->integer('transaction_currency_id'),
'currency_code' => '',
'amount_max' => $this->string('amount_max'),
'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->string('repeat_freq'),
'repeat_freq' => $this->convertString('repeat_freq'),
'skip' => $this->integer('skip'),
'notes' => $this->stringWithNewlines('notes'),
'active' => $this->boolean('active'),
'object_group_title' => $this->string('object_group'),
'object_group_title' => $this->convertString('object_group'),
];
}

View File

@@ -44,12 +44,12 @@ class BudgetFormStoreRequest extends FormRequest
public function getBudgetData(): array
{
return [
'name' => $this->string('name'),
'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_amount' => $this->string('auto_budget_amount'),
'auto_budget_period' => $this->string('auto_budget_period'),
'auto_budget_amount' => $this->convertString('auto_budget_amount'),
'auto_budget_period' => $this->convertString('auto_budget_period'),
];
}

View File

@@ -45,12 +45,12 @@ class BudgetFormUpdateRequest extends FormRequest
public function getBudgetData(): array
{
return [
'name' => $this->string('name'),
'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_amount' => $this->string('auto_budget_amount'),
'auto_budget_period' => $this->string('auto_budget_period'),
'auto_budget_amount' => $this->convertString('auto_budget_amount'),
'auto_budget_period' => $this->convertString('auto_budget_period'),
];
}

View File

@@ -42,7 +42,7 @@ class CategoryFormRequest extends FormRequest
public function getCategoryData(): array
{
return [
'name' => $this->string('name'),
'name' => $this->convertString('name'),
'notes' => $this->stringWithNewlines('notes'),
];
}

View File

@@ -42,9 +42,9 @@ class CurrencyFormRequest extends FormRequest
public function getCurrencyData(): array
{
return [
'name' => $this->string('name'),
'code' => $this->string('code'),
'symbol' => $this->string('symbol'),
'name' => $this->convertString('name'),
'code' => $this->convertString('code'),
'symbol' => $this->convertString('symbol'),
'decimal_places' => $this->integer('decimal_places'),
'enabled' => $this->boolean('enabled'),
];

View File

@@ -46,7 +46,7 @@ class JournalLinkRequest extends FormRequest
$parts = explode('_', $linkType);
$return['link_type_id'] = (int) $parts[0];
$return['transaction_journal_id'] = $this->integer('opposing');
$return['notes'] = $this->string('notes');
$return['notes'] = $this->convertString('notes');
$return['direction'] = $parts[1];
return $return;

View File

@@ -42,7 +42,7 @@ class ObjectGroupFormRequest extends FormRequest
public function getObjectGroupData(): array
{
return [
'title' => $this->string('title'),
'title' => $this->convertString('title'),
];
}

View File

@@ -41,13 +41,13 @@ class PiggyBankStoreRequest extends FormRequest
public function getPiggyBankData(): array
{
return [
'name' => $this->string('name'),
'name' => $this->convertString('name'),
'startdate' => $this->getCarbonDate('startdate'),
'account_id' => $this->integer('account_id'),
'targetamount' => $this->string('targetamount'),
'targetamount' => $this->convertString('targetamount'),
'targetdate' => $this->getCarbonDate('targetdate'),
'notes' => $this->stringWithNewlines('notes'),
'object_group_title' => $this->string('object_group'),
'object_group_title' => $this->convertString('object_group'),
];
}

View File

@@ -42,13 +42,13 @@ class PiggyBankUpdateRequest extends FormRequest
public function getPiggyBankData(): array
{
return [
'name' => $this->string('name'),
'name' => $this->convertString('name'),
'startdate' => $this->getCarbonDate('startdate'),
'account_id' => $this->integer('account_id'),
'targetamount' => $this->string('targetamount'),
'targetamount' => $this->convertString('targetamount'),
'targetdate' => $this->getCarbonDate('targetdate'),
'notes' => $this->stringWithNewlines('notes'),
'object_group_title' => $this->string('object_group'),
'object_group_title' => $this->convertString('object_group'),
];
}

View File

@@ -50,11 +50,11 @@ class ReconciliationStoreRequest extends FormRequest
$data = [
'start' => $this->getCarbonDate('start'),
'end' => $this->getCarbonDate('end'),
'start_balance' => $this->string('startBalance'),
'end_balance' => $this->string('endBalance'),
'difference' => $this->string('difference'),
'start_balance' => $this->convertString('startBalance'),
'end_balance' => $this->convertString('endBalance'),
'difference' => $this->convertString('difference'),
'journals' => $transactions,
'reconcile' => $this->string('reconcile'),
'reconcile' => $this->convertString('reconcile'),
];
Log::debug('In ReconciliationStoreRequest::getAll(). Will now return data.');

View File

@@ -56,23 +56,23 @@ class RecurrenceFormRequest extends FormRequest
$repetitionData = $this->parseRepetitionData();
$return = [
'recurrence' => [
'type' => $this->string('transaction_type'),
'title' => $this->string('title'),
'description' => $this->string('recurring_description'),
'type' => $this->convertString('transaction_type'),
'title' => $this->convertString('title'),
'description' => $this->convertString('recurring_description'),
'first_date' => $this->getCarbonDate('first_date'),
'repeat_until' => $this->getCarbonDate('repeat_until'),
'nr_of_repetitions' => $this->integer('repetitions'),
'apply_rules' => $this->boolean('apply_rules'),
'active' => $this->boolean('active'),
'repetition_end' => $this->string('repetition_end'),
'repetition_end' => $this->convertString('repetition_end'),
],
'transactions' => [
[
'currency_id' => $this->integer('transaction_currency_id'),
'currency_code' => null,
'type' => $this->string('transaction_type'),
'description' => $this->string('transaction_description'),
'amount' => $this->string('amount'),
'type' => $this->convertString('transaction_type'),
'description' => $this->convertString('transaction_description'),
'amount' => $this->convertString('amount'),
'foreign_amount' => null,
'foreign_currency_id' => null,
'foreign_currency_code' => null,
@@ -81,8 +81,8 @@ class RecurrenceFormRequest extends FormRequest
'bill_id' => $this->integer('bill_id'),
'bill_name' => null,
'category_id' => null,
'category_name' => $this->string('category'),
'tags' => '' !== $this->string('tags') ? explode(',', $this->string('tags')) : [],
'category_name' => $this->convertString('category'),
'tags' => '' !== $this->convertString('tags') ? explode(',', $this->convertString('tags')) : [],
'piggy_bank_id' => $this->integer('piggy_bank_id'),
'piggy_bank_name' => null,
],
@@ -100,7 +100,7 @@ class RecurrenceFormRequest extends FormRequest
// fill in foreign currency data
if (null !== $this->float('foreign_amount')) {
$return['transactions'][0]['foreign_amount'] = $this->string('foreign_amount');
$return['transactions'][0]['foreign_amount'] = $this->convertString('foreign_amount');
$return['transactions'][0]['foreign_currency_id'] = $this->integer('foreign_currency_id');
}
// default values:
@@ -109,9 +109,9 @@ class RecurrenceFormRequest extends FormRequest
$return['transactions'][0]['destination_id'] = null;
$return['transactions'][0]['destination_name'] = null;
// fill in source and destination account data
switch ($this->string('transaction_type')) {
switch ($this->convertString('transaction_type')) {
default:
throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->string('transaction_type')));
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');
@@ -149,7 +149,7 @@ class RecurrenceFormRequest extends FormRequest
*/
private function parseRepetitionData(): array
{
$value = $this->string('repetition_type');
$value = $this->convertString('repetition_type');
$return = [
'type' => '',
'moment' => '',
@@ -224,7 +224,7 @@ class RecurrenceFormRequest extends FormRequest
}
// if ends after X repetitions, set another rule
if ('times' === $this->string('repetition_end')) {
if ('times' === $this->convertString('repetition_end')) {
$rules['repetitions'] = 'required|numeric|between:0,254';
}
// if foreign amount, currency must be different.
@@ -233,12 +233,12 @@ class RecurrenceFormRequest extends FormRequest
}
// if ends at date X, set another rule.
if ('until_date' === $this->string('repetition_end')) {
if ('until_date' === $this->convertString('repetition_end')) {
$rules['repeat_until'] = 'required|date|after:' . $tomorrow->format('Y-m-d');
}
// switchc on type to expand rules for source and destination accounts:
switch ($this->string('transaction_type')) {
switch ($this->convertString('transaction_type')) {
case strtolower(TransactionType::WITHDRAWAL):
$rules['source_id'] = 'required|exists:accounts,id|belongsToUser:accounts';
$rules['destination_name'] = 'between:1,255|nullable';
@@ -254,7 +254,7 @@ class RecurrenceFormRequest extends FormRequest
break;
default:
throw new FireflyException(sprintf('Cannot handle transaction type of type "%s"', $this->string('transaction_type')));
throw new FireflyException(sprintf('Cannot handle transaction type of type "%s"', $this->convertString('transaction_type')));
}
// update some rules in case the user is editing a post:
@@ -309,9 +309,9 @@ class RecurrenceFormRequest extends FormRequest
// See reference nr. 45
switch ($this->string('transaction_type')) {
switch ($this->convertString('transaction_type')) {
default:
throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->string('transaction_type')));
throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->convertString('transaction_type')));
case 'withdrawal':
$sourceId = (int) $data['source_id'];
$destinationId = (int) $data['withdrawal_destination_id'];

View File

@@ -44,10 +44,10 @@ class RuleFormRequest extends FormRequest
public function getRuleData(): array
{
return [
'title' => $this->string('title'),
'title' => $this->convertString('title'),
'rule_group_id' => $this->integer('rule_group_id'),
'active' => $this->boolean('active'),
'trigger' => $this->string('trigger'),
'trigger' => $this->convertString('trigger'),
'description' => $this->stringWithNewlines('description'),
'stop_processing' => $this->boolean('stop_processing'),
'strict' => $this->boolean('strict'),

View File

@@ -48,7 +48,7 @@ class RuleGroupFormRequest extends FormRequest
}
return [
'title' => $this->string('title'),
'title' => $this->convertString('title'),
'description' => $this->stringWithNewlines('description'),
'active' => $active,
];

View File

@@ -44,9 +44,9 @@ class TagFormRequest extends FormRequest
public function collectTagData(): array
{
$data = [
'tag' => $this->string('tag'),
'tag' => $this->convertString('tag'),
'date' => $this->getCarbonDate('date'),
'description' => $this->string('description'),
'description' => $this->convertString('description'),
];
return $this->appendLocationData($data, 'location');

View File

@@ -43,10 +43,10 @@ class UserFormRequest extends FormRequest
public function getUserData(): array
{
return [
'email' => $this->string('email'),
'email' => $this->convertString('email'),
'blocked' => 1 === $this->integer('blocked'),
'blocked_code' => $this->string('blocked_code'),
'password' => $this->string('password'),
'blocked_code' => $this->convertString('blocked_code'),
'password' => $this->convertString('password'),
'is_owner' => 1 === $this->integer('is_owner'),
];
}