Skip to content

Firefly III: a personal finances manager

Also do some account meta on the create screen.

James Cole357638a26cbe
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index 2080f18a8c..3f36b31a09 100644
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -163,7 +163,7 @@ class AccountController extends BaseController
'subTitle', 'Edit ' . strtolower(
$account->accountType->type
) . ' "' . $account->name . '"'
- )->with('roles', Config::get('firefly.accountRoles'));
+ );
}
/**
diff --git a/app/lib/FireflyIII/Database/Account.php b/app/lib/FireflyIII/Database/Account.php
index c767639b67..bce4a00e8e 100644
--- a/app/lib/FireflyIII/Database/Account.php
+++ b/app/lib/FireflyIII/Database/Account.php
@@ -272,6 +272,13 @@ class Account implements CUD, CommonDatabaseCalls, AccountInterface
$this->storeInitialBalance($account, $data);
}
+ switch ($account->accountType->type) {
+ case 'Asset account':
+ case 'Default account':
+ $account->updateMeta('accountRole', $data['account_role']);
+ break;
+ }
+
/* Tell transaction journal to store a new one.*/
\Event::fire('account.store', [$account]);
diff --git a/app/views/accounts/create.blade.php b/app/views/accounts/create.blade.php
index 74fe8fc5db..ac7ec268f8 100644
--- a/app/views/accounts/create.blade.php
+++ b/app/views/accounts/create.blade.php
@@ -33,6 +33,7 @@
{{Form::ffDate('openingbalancedate', date('Y-m-d'))}}
@endif
{{Form::ffCheckbox('active','1',true)}}
+ {{Form::ffSelect('account_role',Config::get('firefly.accountRoles'))}}
</div>
</div>
diff --git a/app/views/accounts/edit.blade.php b/app/views/accounts/edit.blade.php
index 0eb2afc949..6a596f87ba 100644
--- a/app/views/accounts/edit.blade.php
+++ b/app/views/accounts/edit.blade.php
@@ -28,7 +28,7 @@
@if($account->accounttype->type == 'Default account' || $account->accounttype->type == 'Asset account')
{{Form::ffBalance('openingbalance')}}
{{Form::ffDate('openingbalancedate')}}
- {{Form::ffSelect('account_role',$roles)}}
+ {{Form::ffSelect('account_role',Config::get('firefly.accountRoles'))}}
@endif
</div>
</div>