Some cleaning up.

This commit is contained in:
James Cole 2015-02-01 17:20:51 +01:00
parent 2998382969
commit 72f04aaedc
3 changed files with 13 additions and 2 deletions

View File

@ -3,7 +3,6 @@ Firefly III (v3.2.5)
[![Build Status](https://travis-ci.org/JC5/firefly-iii.svg?branch=develop)](https://travis-ci.org/JC5/firefly-iii)
[![Project Status](http://stillmaintained.com/JC5/firefly-iii.png?a=b)](http://stillmaintained.com/JC5/firefly-iii)
[![Coverage Status](https://coveralls.io/repos/JC5/firefly-iii/badge.png?branch=master)](https://coveralls.io/r/JC5/firefly-iii?branch=master)
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/d44c7012-5f50-41ad-add8-8445330e4102/mini.png)](https://insight.sensiolabs.com/projects/d44c7012-5f50-41ad-add8-8445330e4102)
[![Code Climate](https://codeclimate.com/github/JC5/firefly-iii/badges/gpa.svg)](https://codeclimate.com/github/JC5/firefly-iii)
[![Test Coverage](https://codeclimate.com/github/JC5/firefly-iii/badges/coverage.svg)](https://codeclimate.com/github/JC5/firefly-iii)

View File

@ -331,6 +331,7 @@ class Account implements CUDInterface, CommonDatabaseCallsInterface, AccountInte
*/
public function validate(array $model)
{
$model['active'] = !isset($model['active']) ? false : $model['active'];
$successes = new MessageBag;
$account = new \Account($model);
$account->isValid('form_input', false);

View File

@ -40,7 +40,18 @@ class Helper implements HelperInterface
/** @var \FireflyIII\Database\Account\Account $accountRepository */
$accountRepository = \App::make('FireflyIII\Database\Account\Account');
return $accountRepository->getAccountsByType(['Default account', 'Asset account']);
/** @var Collection $list */
$list = $accountRepository->getAccountsByType(['Default account', 'Asset account']);
$filtered = $list->filter(
function (\Account $account) {
if (intval($account->active) === 1) {
return $account;
}
return null;
}
);
return $filtered;
}
/**