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

@@ -40,7 +40,7 @@ class AutocompleteRequest extends FormRequest
*/
public function getData(): array
{
$types = $this->string('types');
$types = $this->convertString('types');
$array = [];
if ('' !== $types) {
$array = explode(',', $types);
@@ -53,7 +53,7 @@ class AutocompleteRequest extends FormRequest
return [
'types' => $array,
'query' => $this->string('query'),
'query' => $this->convertString('query'),
'date' => $this->getCarbonDate('date'),
'limit' => $limit,
];

View File

@@ -43,9 +43,9 @@ class ExportRequest extends FormRequest
$result = [
'start' => $this->getCarbonDate('start') ?? Carbon::now()->subYear(),
'end' => $this->getCarbonDate('end') ?? Carbon::now(),
'type' => $this->string('type'),
'type' => $this->convertString('type'),
];
$parts = explode(',', $this->string('accounts'));
$parts = explode(',', $this->convertString('accounts'));
$repository = app(AccountRepositoryInterface::class);
$repository->setUser(auth()->user());

View File

@@ -56,35 +56,35 @@ class StoreRequest extends FormRequest
$includeNetWorth = $this->boolean('include_net_worth');
}
$data = [
'name' => $this->string('name'),
'name' => $this->convertString('name'),
'active' => $active,
'include_net_worth' => $includeNetWorth,
'account_type_name' => $this->string('type'),
'account_type_name' => $this->convertString('type'),
'account_type_id' => null,
'currency_id' => $this->integer('currency_id'),
'order' => $this->integer('order'),
'currency_code' => $this->string('currency_code'),
'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'),
'currency_code' => $this->convertString('currency_code'),
'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('credit_card_type'),
'cc_monthly_payment_date' => $this->string('monthly_payment_date'),
'cc_type' => $this->convertString('credit_card_type'),
'cc_monthly_payment_date' => $this->convertString('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'),
];
// append location information.
$data = $this->appendLocationData($data, null);
if ('liability' === $data['account_type_name'] || 'liabilities' === $data['account_type_name']) {
$data['opening_balance'] = app('steam')->negative($this->string('liability_amount'));
$data['opening_balance'] = app('steam')->negative($this->convertString('liability_amount'));
$data['opening_balance_date'] = $this->getCarbonDate('liability_start_date');
$data['account_type_name'] = $this->string('liability_type');
$data['liability_direction'] = $this->string('liability_direction');
$data['account_type_name'] = $this->convertString('liability_type');
$data['liability_direction'] = $this->convertString('liability_direction');
$data['account_type_id'] = null;
}
@@ -101,7 +101,7 @@ class StoreRequest extends FormRequest
$accountRoles = implode(',', config('firefly.accountRoles'));
$types = implode(',', array_keys(config('firefly.subTitlesByIdentifier')));
$ccPaymentTypes = implode(',', array_keys(config('firefly.ccTypes')));
$type = $this->string('type');
$type = $this->convertString('type');
$rules = [
'name' => 'required|min:1|uniqueAccountForUser',
'type' => 'required|' . sprintf('in:%s', $types),

View File

@@ -107,9 +107,9 @@ class UpdateRequest extends FormRequest
$rules = [
'name' => sprintf('min:1|uniqueAccountForUser:%d', $account->id),
'type' => sprintf('in:%s', $types),
'iban' => ['iban', 'nullable', new UniqueIban($account, $this->string('type'))],
'iban' => ['iban', 'nullable', new UniqueIban($account, $this->convertString('type'))],
'bic' => 'bic|nullable',
'account_number' => ['between:1,255', 'nullable', new UniqueAccountNumber($account, $this->string('type'))],
'account_number' => ['between:1,255', 'nullable', new UniqueAccountNumber($account, $this->convertString('type'))],
'opening_balance' => 'numeric|required_with:opening_balance_date|nullable',
'opening_balance_date' => 'date|required_with:opening_balance|nullable',
'virtual_balance' => 'numeric|nullable',

View File

@@ -45,10 +45,10 @@ class StoreRequest extends FormRequest
public function getAll(): array
{
return [
'filename' => $this->string('filename'),
'title' => $this->string('title'),
'filename' => $this->convertString('filename'),
'title' => $this->convertString('title'),
'notes' => $this->stringWithNewlines('notes'),
'attachable_type' => $this->string('attachable_type'),
'attachable_type' => $this->convertString('attachable_type'),
'attachable_id' => $this->integer('attachable_id'),
];
}
@@ -68,7 +68,7 @@ class StoreRequest extends FormRequest
}, $models
);
$models = implode(',', $models);
$model = $this->string('attachable_type');
$model = $this->convertString('attachable_type');
return [
'filename' => 'required|between:1,255',

View File

@@ -70,7 +70,7 @@ class UpdateRequest extends FormRequest
}, $models
);
$models = implode(',', $models);
$model = $this->string('attachable_type');
$model = $this->convertString('attachable_type');
return [
'filename' => 'between:1,255',

View File

@@ -46,9 +46,9 @@ class StoreRequest extends FormRequest
return [
'start' => $this->getCarbonDate('start'),
'end' => $this->getCarbonDate('end'),
'amount' => $this->string('amount'),
'amount' => $this->convertString('amount'),
'currency_id' => $this->integer('currency_id'),
'currency_code' => $this->string('currency_code'),
'currency_code' => $this->convertString('currency_code'),
];
}

View File

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

View File

@@ -47,15 +47,15 @@ class StoreRequest extends FormRequest
'order' => ['order', 'integer'],
];
$data = $this->getAllData($fields);
$data['name'] = $this->string('name');
$data['name'] = $this->convertString('name');
$data['account_id'] = $this->integer('account_id');
$data['targetamount'] = $this->string('target_amount');
$data['current_amount'] = $this->string('current_amount');
$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_title'] = $this->string('object_group_title');
$data['object_group_title'] = $this->convertString('object_group_title');
return $data;

View File

@@ -53,8 +53,8 @@ class StoreRequest extends FormRequest
}
return [
'title' => $this->string('title'),
'description' => $this->string('description'),
'title' => $this->convertString('title'),
'description' => $this->convertString('description'),
'active' => $active,
'order' => $order,
];

View File

@@ -46,9 +46,9 @@ class StoreRequest extends FormRequest
public function getAll(): array
{
$data = [
'tag' => $this->string('tag'),
'tag' => $this->convertString('tag'),
'date' => $this->getCarbonDate('date'),
'description' => $this->string('description'),
'description' => $this->convertString('description'),
'has_location' => true,
];

View File

@@ -55,7 +55,7 @@ class StoreRequest extends FormRequest
Log::debug('get all data in TransactionStoreRequest');
return [
'group_title' => $this->string('group_title'),
'group_title' => $this->convertString('group_title'),
'error_if_duplicate_hash' => $this->boolean('error_if_duplicate_hash'),
'apply_rules' => $this->boolean('apply_rules', true),
'fire_webhooks' => $this->boolean('fire_webhooks', true),

View File

@@ -84,7 +84,7 @@ class UpdateRequest extends FormRequest
'notes',
];
$this->stringFields = [
$this->convertStringFields = [
'type',
'currency_code',
'foreign_currency_code',
@@ -133,7 +133,7 @@ class UpdateRequest extends FormRequest
$data['fire_webhooks'] = $this->boolean('fire_webhooks', true);
}
if ($this->has('group_title')) {
$data['group_title'] = $this->string('group_title');
$data['group_title'] = $this->convertString('group_title');
}
return $data;
@@ -196,7 +196,7 @@ class UpdateRequest extends FormRequest
*/
private function getStringData(array $current, array $transaction): array
{
foreach ($this->stringFields as $fieldName) {
foreach ($this->convertStringFields as $fieldName) {
if (array_key_exists($fieldName, $transaction)) {
$current[$fieldName] = $this->clearString((string) $transaction[$fieldName], false);
}

View File

@@ -54,9 +54,9 @@ class StoreRequest extends FormRequest
}
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'),
'default' => $default,
'enabled' => $enabled,

View File

@@ -47,7 +47,7 @@ class StoreRequest extends FormRequest
{
return [
'link_type_id' => $this->integer('link_type_id'),
'link_type_name' => $this->string('link_type_name'),
'link_type_name' => $this->convertString('link_type_name'),
'inward_id' => $this->integer('inward_id'),
'outward_id' => $this->integer('outward_id'),
'notes' => $this->stringWithNewlines('notes'),

View File

@@ -47,7 +47,7 @@ class UpdateRequest extends FormRequest
{
return [
'link_type_id' => $this->integer('link_type_id'),
'link_type_name' => $this->string('link_type_name'),
'link_type_name' => $this->convertString('link_type_name'),
'inward_id' => $this->integer('inward_id'),
'outward_id' => $this->integer('outward_id'),
'notes' => $this->stringWithNewlines('notes'),

View File

@@ -44,9 +44,9 @@ class StoreRequest extends FormRequest
public function getAll(): array
{
return [
'name' => $this->string('name'),
'outward' => $this->string('outward'),
'inward' => $this->string('inward'),
'name' => $this->convertString('name'),
'outward' => $this->convertString('outward'),
'inward' => $this->convertString('inward'),
];
}

View File

@@ -45,9 +45,9 @@ class UpdateRequest extends FormRequest
public function getAll(): array
{
return [
'name' => $this->string('name'),
'outward' => $this->string('outward'),
'inward' => $this->string('inward'),
'name' => $this->convertString('name'),
'outward' => $this->convertString('outward'),
'inward' => $this->convertString('inward'),
];
}

View File

@@ -66,7 +66,7 @@ class UpdateRequest extends FormRequest
}
$return['secret'] = null !== $this->get('secret');
if (null !== $this->get('title')) {
$return['title'] = $this->string('title');
$return['title'] = $this->convertString('title');
}
return $return;

View File

@@ -57,7 +57,7 @@ class UpdateRequest extends FormRequest
return ['value' => $this->integer('value')];
}
return ['value' => $this->string('value')];
return ['value' => $this->convertString('value')];
}
/**

View File

@@ -59,10 +59,10 @@ class UserStoreRequest extends FormRequest
}
return [
'email' => $this->string('email'),
'email' => $this->convertString('email'),
'blocked' => $blocked,
'blocked_code' => $this->string('blocked_code'),
'role' => $this->string('role'),
'blocked_code' => $this->convertString('blocked_code'),
'role' => $this->convertString('role'),
];
}

View File

@@ -60,10 +60,10 @@ class UserUpdateRequest extends FormRequest
}
return [
'email' => $this->string('email'),
'email' => $this->convertString('email'),
'blocked' => $blocked,
'blocked_code' => $this->string('blocked_code'),
'role' => $this->string('role'),
'blocked_code' => $this->convertString('blocked_code'),
'role' => $this->convertString('role'),
];
}

View File

@@ -37,7 +37,7 @@ class PreferenceStoreRequest extends FormRequest
public function getAll(): array
{
$array = [
'name' => $this->string('name'),
'name' => $this->convertString('name'),
'data' => $this->get('data'),
];
if ('true' === $array['data']) {

View File

@@ -38,7 +38,7 @@ class PreferenceUpdateRequest extends FormRequest
public function getAll(): array
{
$array = [
'name' => $this->string('name'),
'name' => $this->convertString('name'),
'data' => $this->get('data'),
];
if ('true' === $array['data']) {