From 357638a26cbe94f14c3a04b472cd9f3f0936df85 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 5 Dec 2014 21:44:01 +0100 Subject: [PATCH] Also do some account meta on the create screen. --- app/controllers/AccountController.php | 2 +- app/lib/FireflyIII/Database/Account.php | 7 +++++++ app/views/accounts/create.blade.php | 1 + app/views/accounts/edit.blade.php | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) 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'))}} 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