mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
Fix bad call to method.
This commit is contained in:
@@ -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,
|
||||
];
|
||||
|
@@ -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());
|
||||
|
||||
|
@@ -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),
|
||||
|
@@ -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',
|
||||
|
@@ -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',
|
||||
|
@@ -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',
|
||||
|
@@ -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'),
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -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'),
|
||||
];
|
||||
}
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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,
|
||||
];
|
||||
|
@@ -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,
|
||||
];
|
||||
|
||||
|
@@ -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),
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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,
|
||||
|
@@ -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'),
|
||||
|
@@ -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'),
|
||||
|
@@ -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'),
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -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'),
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -57,7 +57,7 @@ class UpdateRequest extends FormRequest
|
||||
return ['value' => $this->integer('value')];
|
||||
}
|
||||
|
||||
return ['value' => $this->string('value')];
|
||||
return ['value' => $this->convertString('value')];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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'),
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -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'),
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -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']) {
|
||||
|
@@ -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']) {
|
||||
|
@@ -217,9 +217,9 @@ class LinkController extends Controller
|
||||
public function store(LinkTypeFormRequest $request)
|
||||
{
|
||||
$data = [
|
||||
'name' => $request->string('name'),
|
||||
'inward' => $request->string('inward'),
|
||||
'outward' => $request->string('outward'),
|
||||
'name' => $request->convertString('name'),
|
||||
'inward' => $request->convertString('inward'),
|
||||
'outward' => $request->convertString('outward'),
|
||||
];
|
||||
$linkType = $this->repository->store($data);
|
||||
|
||||
@@ -255,9 +255,9 @@ class LinkController extends Controller
|
||||
}
|
||||
|
||||
$data = [
|
||||
'name' => $request->string('name'),
|
||||
'inward' => $request->string('inward'),
|
||||
'outward' => $request->string('outward'),
|
||||
'name' => $request->convertString('name'),
|
||||
'inward' => $request->convertString('inward'),
|
||||
'outward' => $request->convertString('outward'),
|
||||
];
|
||||
$this->repository->update($linkType, $data);
|
||||
|
||||
|
@@ -92,7 +92,7 @@ class NewUserController extends Controller
|
||||
*/
|
||||
public function submit(NewUserFormRequest $request, CurrencyRepositoryInterface $currencyRepository)
|
||||
{
|
||||
$language = $request->string('language');
|
||||
$language = $request->convertString('language');
|
||||
if (!array_key_exists($language, config('firefly.languages'))) {
|
||||
$language = 'en_US';
|
||||
|
||||
|
@@ -410,7 +410,7 @@ class ProfileController extends Controller
|
||||
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$newEmail = $request->string('email');
|
||||
$newEmail = $request->convertString('email');
|
||||
$oldEmail = $user->email;
|
||||
if ($newEmail === $user->email) {
|
||||
session()->flash('error', (string) trans('firefly.email_not_changed'));
|
||||
|
@@ -131,7 +131,7 @@ class EditController extends Controller
|
||||
public function update(RuleGroupFormRequest $request, RuleGroup $ruleGroup)
|
||||
{
|
||||
$data = [
|
||||
'title' => $request->string('title'),
|
||||
'title' => $request->convertString('title'),
|
||||
'description' => $request->stringWithNewlines('description'),
|
||||
'active' => 1 === (int) $request->input('active'),
|
||||
];
|
||||
|
@@ -110,8 +110,8 @@ class BulkController extends Controller
|
||||
$journal = $this->repository->find($journalId);
|
||||
if (null !== $journal) {
|
||||
$resultA = $this->updateJournalBudget($journal, $ignoreBudget, $request->integer('budget_id'));
|
||||
$resultB = $this->updateJournalTags($journal, $tagsAction, explode(',', $request->string('tags')));
|
||||
$resultC = $this->updateJournalCategory($journal, $ignoreCategory, $request->string('category'));
|
||||
$resultB = $this->updateJournalTags($journal, $tagsAction, explode(',', $request->convertString('tags')));
|
||||
$resultC = $this->updateJournalCategory($journal, $ignoreCategory, $request->convertString('category'));
|
||||
if ($resultA || $resultB || $resultC) {
|
||||
$count++;
|
||||
}
|
||||
|
@@ -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',
|
||||
|
@@ -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'),
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -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'),
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -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'),
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -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'),
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -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'),
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -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'),
|
||||
];
|
||||
}
|
||||
|
@@ -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'),
|
||||
];
|
||||
|
@@ -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;
|
||||
|
@@ -42,7 +42,7 @@ class ObjectGroupFormRequest extends FormRequest
|
||||
public function getObjectGroupData(): array
|
||||
{
|
||||
return [
|
||||
'title' => $this->string('title'),
|
||||
'title' => $this->convertString('title'),
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -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'),
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -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'),
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -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.');
|
||||
|
||||
|
@@ -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'];
|
||||
|
@@ -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'),
|
||||
|
@@ -48,7 +48,7 @@ class RuleGroupFormRequest extends FormRequest
|
||||
}
|
||||
|
||||
return [
|
||||
'title' => $this->string('title'),
|
||||
'title' => $this->convertString('title'),
|
||||
'description' => $this->stringWithNewlines('description'),
|
||||
'active' => $active,
|
||||
];
|
||||
|
@@ -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');
|
||||
|
@@ -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'),
|
||||
];
|
||||
}
|
||||
|
@@ -69,18 +69,18 @@ trait AppendsLocationData
|
||||
if ($isValidPOST) {
|
||||
Log::debug('Method is POST and all fields present and not NULL.');
|
||||
$data['store_location'] = true;
|
||||
$data['longitude'] = $this->string($longitudeKey);
|
||||
$data['latitude'] = $this->string($latitudeKey);
|
||||
$data['zoom_level'] = $this->string($zoomLevelKey);
|
||||
$data['longitude'] = $this->convertString($longitudeKey);
|
||||
$data['latitude'] = $this->convertString($latitudeKey);
|
||||
$data['zoom_level'] = $this->convertString($zoomLevelKey);
|
||||
}
|
||||
|
||||
// for a PUT (api update) or POST update (UI)
|
||||
if ($isValidPUT) {
|
||||
Log::debug('Method is PUT and all fields present and not NULL.');
|
||||
$data['update_location'] = true;
|
||||
$data['longitude'] = $this->string($longitudeKey);
|
||||
$data['latitude'] = $this->string($latitudeKey);
|
||||
$data['zoom_level'] = $this->string($zoomLevelKey);
|
||||
$data['longitude'] = $this->convertString($longitudeKey);
|
||||
$data['latitude'] = $this->convertString($latitudeKey);
|
||||
$data['zoom_level'] = $this->convertString($zoomLevelKey);
|
||||
}
|
||||
if ($isValidEmptyPUT) {
|
||||
Log::debug('Method is PUT and all fields present and NULL.');
|
||||
|
@@ -51,7 +51,7 @@ trait ConvertsDataTypes
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function string(string $field): string
|
||||
public function convertString(string $field): string
|
||||
{
|
||||
return $this->clearString((string) ($this->get($field) ?? ''), false);
|
||||
}
|
||||
|
Reference in New Issue
Block a user