mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-16 22:58:09 +00:00
Renamed various fields from their old camel casing to new ones.
This commit is contained in:
@@ -50,24 +50,24 @@ class AccountFormRequest extends Request
|
||||
public function getAccountData(): array
|
||||
{
|
||||
$data = [
|
||||
'name' => $this->string('name'),
|
||||
'active' => $this->boolean('active'),
|
||||
'accountType' => $this->string('what'),
|
||||
'account_type_id' => 0,
|
||||
'currency_id' => $this->integer('currency_id'),
|
||||
'virtualBalance' => $this->string('virtualBalance'),
|
||||
'iban' => $this->string('iban'),
|
||||
'BIC' => $this->string('BIC'),
|
||||
'accountNumber' => $this->string('accountNumber'),
|
||||
'accountRole' => $this->string('accountRole'),
|
||||
'openingBalance' => $this->string('openingBalance'),
|
||||
'openingBalanceDate' => $this->date('openingBalanceDate'),
|
||||
'ccType' => $this->string('ccType'),
|
||||
'ccMonthlyPaymentDate' => $this->string('ccMonthlyPaymentDate'),
|
||||
'notes' => $this->string('notes'),
|
||||
'interest' => $this->string('interest'),
|
||||
'interest_period' => $this->string('interest_period'),
|
||||
'include_net_worth' => '1',
|
||||
'name' => $this->string('name'),
|
||||
'active' => $this->boolean('active'),
|
||||
'account_type' => $this->string('what'),
|
||||
'account_type_id' => 0,
|
||||
'currency_id' => $this->integer('currency_id'),
|
||||
'virtual_balance' => $this->string('virtualBalance'),
|
||||
'iban' => $this->string('iban'),
|
||||
'BIC' => $this->string('BIC'),
|
||||
'account_number' => $this->string('accountNumber'),
|
||||
'account_role' => $this->string('accountRole'),
|
||||
'opening_balance' => $this->string('openingBalance'),
|
||||
'opening_balance_date' => $this->date('openingBalanceDate'),
|
||||
'cc_type' => $this->string('ccType'),
|
||||
'cc_monthly_payment_date' => $this->string('ccMonthlyPaymentDate'),
|
||||
'notes' => $this->string('notes'),
|
||||
'interest' => $this->string('interest'),
|
||||
'interest_period' => $this->string('interest_period'),
|
||||
'include_net_worth' => '1',
|
||||
];
|
||||
if (false === $this->boolean('include_net_worth')) {
|
||||
$data['include_net_worth'] = '0';
|
||||
@@ -75,13 +75,9 @@ class AccountFormRequest extends Request
|
||||
|
||||
// if the account type is "liabilities" there are actually four types of liability
|
||||
// that could have been selected.
|
||||
if ('liabilities' === $data['accountType']) {
|
||||
$data['accountType'] = null;
|
||||
if ('liabilities' === $data['account_type']) {
|
||||
$data['account_type'] = null;
|
||||
$data['account_type_id'] = $this->integer('liability_type_id');
|
||||
// also reverse the opening balance:
|
||||
if ('' !== $data['openingBalance']) {
|
||||
$data['openingBalance'] = bcmul($data['openingBalance'], '-1');
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
@@ -98,27 +94,28 @@ class AccountFormRequest extends Request
|
||||
$types = implode(',', array_keys(config('firefly.subTitlesByIdentifier')));
|
||||
$ccPaymentTypes = implode(',', array_keys(config('firefly.ccTypes')));
|
||||
$rules = [
|
||||
'name' => 'required|min:1|uniqueAccountForUser',
|
||||
'openingBalance' => 'numeric|required_with:openingBalanceDate|nullable',
|
||||
'openingBalanceDate' => 'date|required_with:openingBalance|nullable',
|
||||
'iban' => ['iban', 'nullable', new UniqueIban(null, $this->string('what'))],
|
||||
'BIC' => 'bic|nullable',
|
||||
'virtualBalance' => 'numeric|nullable',
|
||||
'currency_id' => 'exists:transaction_currencies,id',
|
||||
'accountNumber' => 'between:1,255|uniqueAccountNumberForUser|nullable',
|
||||
'accountRole' => 'in:' . $accountRoles,
|
||||
'active' => 'boolean',
|
||||
'ccType' => 'in:' . $ccPaymentTypes,
|
||||
'ccMonthlyPaymentDate' => 'date',
|
||||
'amount_currency_id_openingBalance' => 'exists:transaction_currencies,id',
|
||||
'amount_currency_id_virtualBalance' => 'exists:transaction_currencies,id',
|
||||
'what' => 'in:' . $types,
|
||||
'interest_period' => 'in:daily,monthly,yearly',
|
||||
'name' => 'required|min:1|uniqueAccountForUser',
|
||||
'opening_balance' => 'numeric|required_with:opening_balance_date|nullable',
|
||||
'opening_balance_date' => 'date|required_with:opening_balance|nullable',
|
||||
'iban' => ['iban', 'nullable', new UniqueIban(null, $this->string('what'))],
|
||||
'BIC' => 'bic|nullable',
|
||||
'virtual_balance' => 'numeric|nullable',
|
||||
'currency_id' => 'exists:transaction_currencies,id',
|
||||
'account_number' => 'between:1,255|uniqueAccountNumberForUser|nullable',
|
||||
'account_role' => 'in:' . $accountRoles,
|
||||
'active' => 'boolean',
|
||||
'ccType' => 'in:' . $ccPaymentTypes,
|
||||
'cc_monthly_payment_date' => 'date',
|
||||
'amount_currency_id_opening_balance' => 'exists:transaction_currencies,id',
|
||||
'amount_currency_id_virtua_balance' => 'exists:transaction_currencies,id',
|
||||
'what' => 'in:' . $types,
|
||||
'interest_period' => 'in:daily,monthly,yearly',
|
||||
];
|
||||
|
||||
// TODO verify if this will work.
|
||||
if ('liabilities' === $this->get('what')) {
|
||||
$rules['openingBalance'] = ['numeric', 'required', new ZeroOrMore];
|
||||
$rules['openingBalanceDate'] = 'date|required';
|
||||
$rules['opening_balance'] = ['numeric', 'required', new ZeroOrMore];
|
||||
$rules['opening_balance_date'] = 'date|required';
|
||||
}
|
||||
|
||||
/** @var Account $account */
|
||||
|
||||
Reference in New Issue
Block a user