Skip to content

Firefly III: a personal finances manager

Tried to start with #107

zjean5c03e64f46a6
diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php
index 89db16e7c4..6581c7ed70 100644
--- a/app/Http/Controllers/AccountController.php
+++ b/app/Http/Controllers/AccountController.php
@@ -128,6 +128,7 @@ class AccountController extends Controller
}
$preFilled = [
+ 'accountNumber' => $account->getMeta('accountNumber'),
'accountRole' => $account->getMeta('accountRole'),
'ccType' => $account->getMeta('ccType'),
'ccMonthlyPaymentDate' => $account->getMeta('ccMonthlyPaymentDate'),
@@ -211,6 +212,7 @@ class AccountController extends Controller
'active' => true,
'user' => Auth::user()->id,
'iban' => $request->input('iban'),
+ 'accountNumber' => $request->input('accountNumber'),
'accountRole' => $request->input('accountRole'),
'openingBalance' => round($request->input('openingBalance'), 2),
'openingBalanceDate' => new Carbon((string)$request->input('openingBalanceDate')),
@@ -249,6 +251,7 @@ class AccountController extends Controller
'active' => $request->input('active'),
'user' => Auth::user()->id,
'iban' => $request->input('iban'),
+ 'accountNumber' => $request->input('accountNumber'),
'accountRole' => $request->input('accountRole'),
'virtualBalance' => round($request->input('virtualBalance'), 2),
'openingBalance' => round($request->input('openingBalance'), 2),
diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php
index b116dffd29..f5f4f2cb3b 100644
--- a/app/Repositories/Account/AccountRepository.php
+++ b/app/Repositories/Account/AccountRepository.php
@@ -31,6 +31,9 @@ use Steam;
class AccountRepository implements AccountRepositoryInterface
{
+ /** @var array Valied field names of account_meta */
+ private $validFields = ['accountRole', 'ccMonthlyPaymentDate', 'ccType', 'accountNumber'];
+
/**
* @param array $types
*
@@ -541,9 +544,8 @@ class AccountRepository implements AccountRepositoryInterface
* @return bool
*/
private function storeMetadata(Account $account, array $data): bool
- {
- $validFields = ['accountRole', 'ccMonthlyPaymentDate', 'ccType'];
- foreach ($validFields as $field) {
+ {
+ foreach ($this->validFields as $field) {
if (isset($data[$field])) {
$metaData = new AccountMeta(
[
@@ -594,9 +596,7 @@ class AccountRepository implements AccountRepositoryInterface
*/
private function updateMetadata(Account $account, array $data): bool
{
- $validFields = ['accountRole', 'ccMonthlyPaymentDate', 'ccType'];
-
- foreach ($validFields as $field) {
+ foreach ($this->validFields as $field) {
$entry = $account->accountMeta()->where('name', $field)->first();
if (isset($data[$field])) {
diff --git a/resources/lang/en_US/form.php b/resources/lang/en_US/form.php
index 20c645fd45..f404dbfc69 100644
--- a/resources/lang/en_US/form.php
+++ b/resources/lang/en_US/form.php
@@ -47,6 +47,7 @@ return [
'symbol' => 'Symbol',
'code' => 'Code',
'iban' => 'IBAN',
+ 'accountNumber' => 'Account number',
'csv' => 'CSV file',
'has_headers' => 'Headers',
'date_format' => 'Date format',
diff --git a/resources/lang/nl_NL/form.php b/resources/lang/nl_NL/form.php
index 1d1afdd8a5..c160f8f8f8 100644
--- a/resources/lang/nl_NL/form.php
+++ b/resources/lang/nl_NL/form.php
@@ -47,6 +47,7 @@ return [
'symbol' => 'Symbool',
'code' => 'Code',
'iban' => 'IBAN',
+ 'accountNumber' => 'Rekeningnummer',
'csv' => 'CSV-bestand',
'has_headers' => 'Kolomnamen op de eerste rij?',
'date_format' => 'Datumformaat',
diff --git a/resources/views/accounts/create.twig b/resources/views/accounts/create.twig
index a801fede4a..4c61ee243a 100644
--- a/resources/views/accounts/create.twig
+++ b/resources/views/accounts/create.twig
@@ -21,23 +21,25 @@
</div>
<div class="col-lg-6 col-md-6 col-sm-12">
+
+ <div class="box">
+ <div class="box-header with-border">
+ <h3 class="box-title">{{ 'optionalFields'|_ }}</h3>
+ </div>
+ <div class="box-body">
- {% if what == 'asset' %}
- <div class="box">
- <div class="box-header with-border">
- <h3 class="box-title">{{ 'optionalFields'|_ }}</h3>
- </div>
- <div class="box-body">
-
- {{ ExpandedForm.text('iban') }}
- {{ ExpandedForm.balance('openingBalance') }}
- {{ ExpandedForm.date('openingBalanceDate', phpdate('Y-m-d')) }}
- {{ ExpandedForm.select('accountRole', Config.get('firefly.accountRoles'),null,{'helpText' : 'asset_account_role_help'|_}) }}
- {{ ExpandedForm.balance('virtualBalance') }}
+ {{ ExpandedForm.text('iban') }}
+ {% if what == 'asset' %}
+ {{ ExpandedForm.text('accountNumber') }}
+ {{ ExpandedForm.balance('openingBalance') }}
+ {{ ExpandedForm.date('openingBalanceDate', phpdate('Y-m-d')) }}
+ {{ ExpandedForm.select('accountRole', Config.get('firefly.accountRoles'),null,{'helpText' : 'asset_account_role_help'|_}) }}
+ {{ ExpandedForm.balance('virtualBalance') }}
+ {% endif %}
- </div>
</div>
- {% endif %}
+ </div>
+
<div class="box">
<div class="box-header with-border">
diff --git a/resources/views/accounts/edit.twig b/resources/views/accounts/edit.twig
index 32e0c55972..b5d312055f 100644
--- a/resources/views/accounts/edit.twig
+++ b/resources/views/accounts/edit.twig
@@ -28,6 +28,7 @@
</div>
<div class="box-body">
{{ ExpandedForm.text('iban') }}
+ {{ ExpandedForm.text('accountNumber') }}
{% if account.accounttype.type == 'Default account' or account.accounttype.type == 'Asset account' %}
{{ ExpandedForm.balance('openingBalance',null, {'currency' : openingBalance ? openingBalance.transactionCurrency : null}) }}
{{ ExpandedForm.date('openingBalanceDate') }}