Skip to content

Firefly III: a personal finances manager

Some cleaning up

James Colee6263f9ff5d4
diff --git a/README.md b/README.md
index 419627813e..2bd29fa179 100644
--- a/README.md
+++ b/README.md
@@ -34,15 +34,6 @@ and the philosophy behind it.
It's III, or 3, because [version 2](https://github.com/JC5/Firefly) and version 1 (not online) preceded it. It has been growing steadily ever since.
-## Running and installing
-
-If you're still interested please read [the installation guide](https://github.com/JC5/firefly-iii/wiki/Installation),
-[the upgrade guide](https://github.com/JC5/firefly-iii/wiki/Upgrade-instructions) (if applicable)
-and the **[first use guide](https://github.com/JC5/firefly-iii/wiki/First-use)**.
-
-If you want to try out Firefly III, you can do so on [this dedicated website](https://geld.nder.be/).
-This site always runs the latest version of Firefly III. If you want to use it, please read the [privacy considerations](https://github.com/JC5/firefly-iii/wiki/Privacy-on-demo-site) for this demo-site.
-
## Current features
- [A double-entry bookkeeping system](https://en.wikipedia.org/wiki/Double-entry_bookkeeping_system);
@@ -86,6 +77,16 @@ _Please note that everything in these screenshots is fictional and may not be re
![Piggy banks](https://i.nder.be/hkud0h53)
+## Running and installing
+
+If you're still interested please read [the installation guide](https://github.com/JC5/firefly-iii/wiki/Installation),
+[the upgrade guide](https://github.com/JC5/firefly-iii/wiki/Upgrade-instructions) (if applicable)
+and the **[first use guide](https://github.com/JC5/firefly-iii/wiki/First-use)**.
+
+If you want to try out Firefly III, you can do so on [this dedicated website](https://geld.nder.be/).
+This site always runs the latest version of Firefly III. If you want to use it, please read the [privacy considerations](https://github.com/JC5/firefly-iii/wiki/Privacy-on-demo-site) for this demo-site.
+
+
## Current state
Firefly III is pretty much all grown up. Full test coverage (nerd alert!) is coming. One of the things on the todo-list
diff --git a/app/Helpers/Collection/BalanceLine.php b/app/Helpers/Collection/BalanceLine.php
index 979aa9afc7..cf0f8e9d02 100644
--- a/app/Helpers/Collection/BalanceLine.php
+++ b/app/Helpers/Collection/BalanceLine.php
@@ -21,7 +21,7 @@ class BalanceLine
/** @var BudgetModel */
protected $budget;
- /** @var float */
+ /** @var float */
protected $budgetAmount = 0.0;
/**
@@ -40,22 +40,6 @@ class BalanceLine
$this->balanceEntries->push($balanceEntry);
}
- /**
- * @return Collection
- */
- public function getBalanceEntries()
- {
- return $this->balanceEntries;
- }
-
- /**
- * @param Collection $balanceEntries
- */
- public function setBalanceEntries($balanceEntries)
- {
- $this->balanceEntries = $balanceEntries;
- }
-
/**
* @return BudgetModel
*/
@@ -72,6 +56,20 @@ class BalanceLine
$this->budget = $budget;
}
+ /**
+ * @return float
+ */
+ public function left()
+ {
+ $start = $this->getBudgetAmount();
+ /** @var BalanceEntry $balanceEntry */
+ foreach ($this->getBalanceEntries() as $balanceEntry) {
+ $start += $balanceEntry->getSpent();
+ }
+
+ return $start;
+ }
+
/**
* @return float
*/
@@ -89,17 +87,20 @@ class BalanceLine
}
/**
- * @return float
+ * @return Collection
*/
- public function left() {
- $start = $this->getBudgetAmount();
- /** @var BalanceEntry $balanceEntry */
- foreach($this->getBalanceEntries() as $balanceEntry) {
- $start += $balanceEntry->getSpent();
- }
- return $start;
+ public function getBalanceEntries()
+ {
+ return $this->balanceEntries;
}
+ /**
+ * @param Collection $balanceEntries
+ */
+ public function setBalanceEntries($balanceEntries)
+ {
+ $this->balanceEntries = $balanceEntries;
+ }
}
\ No newline at end of file
diff --git a/app/Helpers/Report/ReportHelper.php b/app/Helpers/Report/ReportHelper.php
index 13ea2f58e6..c0784a87a9 100644
--- a/app/Helpers/Report/ReportHelper.php
+++ b/app/Helpers/Report/ReportHelper.php
@@ -30,7 +30,9 @@ class ReportHelper implements ReportHelperInterface
protected $query;
/**
- * @param ReportHelperInterface $helper
+ * @param ReportQueryInterface $query
+ *
+ * @internal param ReportHelperInterface $helper
*/
public function __construct(ReportQueryInterface $query)
{
diff --git a/app/Http/Controllers/BillController.php b/app/Http/Controllers/BillController.php
index 8195fdbfc0..a2877aa940 100644
--- a/app/Http/Controllers/BillController.php
+++ b/app/Http/Controllers/BillController.php
@@ -33,50 +33,6 @@ class BillController extends Controller
View::share('mainTitleIcon', 'fa-calendar-o');
}
- /**
- * @param AccountRepositoryInterface $repository
- * @param Bill $bill
- *
- * @return \Illuminate\Http\RedirectResponse
- */
- public function add(AccountRepositoryInterface $repository, Bill $bill)
- {
- $matches = explode(',', $bill->match);
- $description = [];
- $expense = null;
-
- // get users expense accounts:
- $accounts = $repository->getAccounts(Config::get('firefly.accountTypesByIdentifier.expense'));
-
- foreach ($matches as $match) {
- $match = strtolower($match);
- // find expense account for each word if not found already:
- if (is_null($expense)) {
- /** @var Account $account */
- foreach ($accounts as $account) {
- $name = strtolower($account->name);
- if (!(strpos($name, $match) === false)) {
- $expense = $account;
- break;
- }
- }
-
-
- }
- if (is_null($expense)) {
- $description[] = $match;
- }
- }
- $parameters = [
- 'description' => ucfirst(join(' ', $description)),
- 'expense_account' => is_null($expense) ? '' : $expense->name,
- 'amount' => round(($bill->amount_min + $bill->amount_max), 2),
- ];
- Session::put('preFilled', $parameters);
-
- return Redirect::to(route('transactions.create', 'withdrawal'));
- }
-
/**
* @return $this
*/
diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php
index 519e3e970a..f043c0c568 100644
--- a/app/Http/Controllers/HomeController.php
+++ b/app/Http/Controllers/HomeController.php
@@ -63,13 +63,11 @@ class HomeController extends Controller
$savings = $repository->getSavingsAccounts();
$piggyBankAccounts = $repository->getPiggyBankAccounts();
-
$savingsTotal = 0;
foreach ($savings as $savingAccount) {
$savingsTotal += Steam::balance($savingAccount, $end);
}
- // check if all books are correct.
$sum = $repository->sumOfEverything();
if ($sum != 0) {
Session::flash(
diff --git a/app/Http/Controllers/JsonController.php b/app/Http/Controllers/JsonController.php
index 958772c6f7..4fb1c49ba2 100644
--- a/app/Http/Controllers/JsonController.php
+++ b/app/Http/Controllers/JsonController.php
@@ -38,7 +38,7 @@ class JsonController extends Controller
$end = Session::get('end', Carbon::now()->endOfMonth());
$amount = 0;
- // these two functions are the same as the chart TODO
+ // these two functions are the same as the chart
$bills = $repository->getActiveBills();
/** @var Bill $bill */
@@ -141,7 +141,7 @@ class JsonController extends Controller
{
$start = Session::get('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->endOfMonth());
- $amount = $reportQuery->journalsByExpenseAccount($start, $end, true)->sum('queryAmount');
+ $amount = $reportQuery->expenseInPeriod($start, $end, true)->sum('queryAmount') * -1;
return Response::json(['box' => 'out', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount]);
}
diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php
index fe308a33c9..7b2b3f1d4c 100644
--- a/app/Http/Controllers/ReportController.php
+++ b/app/Http/Controllers/ReportController.php
@@ -2,7 +2,6 @@
use Carbon\Carbon;
use FireflyIII\Helpers\Report\ReportHelperInterface;
-use FireflyIII\Helpers\Report\ReportQueryInterface;
use FireflyIII\Models\Account;
use FireflyIII\Models\Budget;
use FireflyIII\Models\LimitRepetition;
@@ -37,9 +36,10 @@ class ReportController extends Controller
}
/**
+ * @param AccountRepositoryInterface $repository
+ *
* @return View
* @internal param ReportHelperInterface $helper
- *
*/
public function index(AccountRepositoryInterface $repository)
{
@@ -65,6 +65,8 @@ class ReportController extends Controller
* @param string $year
* @param string $month
*
+ * @param bool $shared
+ *
* @return \Illuminate\View\View
*/
public function month($year = '2014', $month = '1', $shared = false)
@@ -98,7 +100,7 @@ class ReportController extends Controller
'accounts',
'incomes', 'incomeTopLength',
'expenses', 'expenseTopLength',
- 'budgets','balance',
+ 'budgets', 'balance',
'categories'
)
);
@@ -106,7 +108,9 @@ class ReportController extends Controller
}
/**
- * @param $year
+ * @param $year
+ *
+ * @param bool $shared
*
* @return $this
*/
diff --git a/app/Http/routes.php b/app/Http/routes.php
index 923e3c593c..9ad733e0a5 100644
--- a/app/Http/routes.php
+++ b/app/Http/routes.php
@@ -223,7 +223,6 @@ Route::group(
Route::get('/bills/rescan/{bill}', ['uses' => 'BillController@rescan', 'as' => 'bills.rescan']); # rescan for matching.
Route::get('/bills/create', ['uses' => 'BillController@create', 'as' => 'bills.create']);
Route::get('/bills/edit/{bill}', ['uses' => 'BillController@edit', 'as' => 'bills.edit']);
- Route::get('/bills/add/{bill}', ['uses' => 'BillController@add', 'as' => 'bills.add']);
Route::get('/bills/delete/{bill}', ['uses' => 'BillController@delete', 'as' => 'bills.delete']);
Route::get('/bills/show/{bill}', ['uses' => 'BillController@show', 'as' => 'bills.show']);
Route::post('/bills/store', ['uses' => 'BillController@store', 'as' => 'bills.store']);
diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php
index 74dc26b9e2..f2fbc0c0ad 100644
--- a/app/Repositories/Budget/BudgetRepository.php
+++ b/app/Repositories/Budget/BudgetRepository.php
@@ -256,10 +256,12 @@ class BudgetRepository implements BudgetRepositoryInterface
/**
* @param Budget $budget
- * @param Carbon $date
+ * @param Carbon $start
+ * @param Carbon $end
* @param bool $shared
*
* @return float
+ * @internal param Carbon $date
*/
public function spentInPeriod(Budget $budget, Carbon $start, Carbon $end, $shared = true)
{
diff --git a/app/Repositories/Category/CategoryRepository.php b/app/Repositories/Category/CategoryRepository.php
index 918c879fd5..e67a9db2a8 100644
--- a/app/Repositories/Category/CategoryRepository.php
+++ b/app/Repositories/Category/CategoryRepository.php
@@ -168,6 +168,8 @@ class CategoryRepository implements CategoryRepositoryInterface
* @param Carbon $start
* @param Carbon $end
*
+ * @param bool $shared
+ *
* @return float
*/
public function spentInPeriod(Category $category, Carbon $start, Carbon $end, $shared = false)
diff --git a/app/Repositories/Category/CategoryRepositoryInterface.php b/app/Repositories/Category/CategoryRepositoryInterface.php
index 547ce752bb..2c1355c057 100644
--- a/app/Repositories/Category/CategoryRepositoryInterface.php
+++ b/app/Repositories/Category/CategoryRepositoryInterface.php
@@ -75,6 +75,8 @@ interface CategoryRepositoryInterface
* @param \Carbon\Carbon $start
* @param \Carbon\Carbon $end
*
+ * @param bool $shared
+ *
* @return float
*/
public function spentInPeriod(Category $category, Carbon $start, Carbon $end, $shared = false);
diff --git a/app/Repositories/PiggyBank/PiggyBankRepository.php b/app/Repositories/PiggyBank/PiggyBankRepository.php
index a7f9a06dfa..a3e5128b7f 100644
--- a/app/Repositories/PiggyBank/PiggyBankRepository.php
+++ b/app/Repositories/PiggyBank/PiggyBankRepository.php
@@ -198,7 +198,6 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
* @param array $data
*
* @return PiggyBank
- * @internal param PiggyBank $account
*/
public function update(PiggyBank $piggyBank, array $data)
{
diff --git a/database/.gitignore b/database/.gitignore
index 9b1dffd90f..8b13789179 100644
--- a/database/.gitignore
+++ b/database/.gitignore
@@ -1 +1 @@
-*.sqlite
+
diff --git a/resources/twig/list/bills.twig b/resources/twig/list/bills.twig
index d09a24d347..c20d3b1a63 100644
--- a/resources/twig/list/bills.twig
+++ b/resources/twig/list/bills.twig
@@ -10,7 +10,6 @@
<th>{{ trans('list.active') }}</th>
<th>{{ trans('list.automatch') }}</th>
<th>{{ trans('list.repeat_freq') }}</th>
- <th data-defaultsort="disabled">&nbsp;</th>
</tr></thead>
<tbody>
{% for entry in bills %}
@@ -75,11 +74,6 @@
skips over {{entry.skip}}
{% endif %}
</td>
- <td>
- {% if entry.active %}
- <a href="{{route('bills.add',entry.id)}}" class="btn btn-success btn-xs"><i class="fa fa-fw fa-plus-circle"></i></a>
- {% endif %}
- </td>
</tr>
{% endfor %}
diff --git a/tests/repositories/AccountRepositoryTest.php b/tests/repositories/AccountRepositoryTest.php
index 5f57fd4a03..1adaa429a9 100644
--- a/tests/repositories/AccountRepositoryTest.php
+++ b/tests/repositories/AccountRepositoryTest.php
@@ -41,7 +41,6 @@ class AccountRepositoryTest extends TestCase
/**
* @covers FireflyIII\Repositories\Account\AccountRepository::countAccounts
- * @todo Implement testCountAccounts().
*/
public function testCountAccounts()
{
@@ -83,7 +82,6 @@ class AccountRepositoryTest extends TestCase
/**
* @covers FireflyIII\Repositories\Account\AccountRepository::getCreditCards
- * @todo Implement testGetCreditCards().
*/
public function testGetCreditCards()
{
@@ -459,7 +457,6 @@ class AccountRepositoryTest extends TestCase
/**
* @covers FireflyIII\Repositories\Account\AccountRepository::getTransfersInRange
- * @todo Implement testGetTransfersInRange().
*/
public function testGetTransfersInRange()
{
diff --git a/tests/repositories/BillRepositoryTest.php b/tests/repositories/BillRepositoryTest.php
index 803c509d46..038bd0c415 100644
--- a/tests/repositories/BillRepositoryTest.php
+++ b/tests/repositories/BillRepositoryTest.php
@@ -126,7 +126,6 @@ class BillRepositoryTest extends TestCase
/**
* @covers FireflyIII\Repositories\Bill\BillRepository::getJournalsInRange
- * @todo Implement testGetJournalsInRange().
*/
public function testGetJournalsInRange()
{
@@ -144,7 +143,6 @@ class BillRepositoryTest extends TestCase
/**
* @covers FireflyIII\Repositories\Bill\BillRepository::getPossiblyRelatedJournals
- * @todo Implement testGetPossiblyRelatedJournals().
*/
public function testGetPossiblyRelatedJournals()
{
@@ -439,7 +437,6 @@ class BillRepositoryTest extends TestCase
/**
* @covers FireflyIII\Repositories\Bill\BillRepository::update
- * @todo Implement testUpdate().
*/
public function testUpdate()
{
diff --git a/tests/repositories/BudgetRepositoryTest.php b/tests/repositories/BudgetRepositoryTest.php
index 5034d753ad..3fabe5cf87 100644
--- a/tests/repositories/BudgetRepositoryTest.php
+++ b/tests/repositories/BudgetRepositoryTest.php
@@ -58,7 +58,6 @@ class BudgetRepositoryTest extends TestCase
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::destroy
- * @todo Implement testDestroy().
*/
public function testDestroy()
{
@@ -71,7 +70,6 @@ class BudgetRepositoryTest extends TestCase
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::expensesOnDay
- * @todo Implement testExpensesOnDay().
*/
public function testExpensesOnDay()
{
diff --git a/tests/repositories/CategoryRepositoryTest.php b/tests/repositories/CategoryRepositoryTest.php
index 57c6a96553..9c32d94348 100644
--- a/tests/repositories/CategoryRepositoryTest.php
+++ b/tests/repositories/CategoryRepositoryTest.php
@@ -46,7 +46,6 @@ class CategoryRepositoryTest extends TestCase
/**
* @covers FireflyIII\Repositories\Category\CategoryRepository::destroy
- * @todo Implement testDestroy().
*/
public function testDestroy()
{
diff --git a/tests/repositories/PiggyBankRepositoryTest.php b/tests/repositories/PiggyBankRepositoryTest.php
index ef7ff93d20..d6dd282fec 100644
--- a/tests/repositories/PiggyBankRepositoryTest.php
+++ b/tests/repositories/PiggyBankRepositoryTest.php
@@ -132,7 +132,6 @@ class PiggyBankRepositoryTest extends TestCase
/**
* @covers FireflyIII\Repositories\PiggyBank\PiggyBankRepository::getEvents
- * @todo Implement testGetEvents().
*/
public function testGetEvents()
{
@@ -185,7 +184,6 @@ class PiggyBankRepositoryTest extends TestCase
/**
* @covers FireflyIII\Repositories\PiggyBank\PiggyBankRepository::store
- * @todo Implement testStore().
*/
public function testStore()
{
@@ -208,7 +206,6 @@ class PiggyBankRepositoryTest extends TestCase
/**
* @covers FireflyIII\Repositories\PiggyBank\PiggyBankRepository::update
- * @todo Implement testUpdate().
*/
public function testUpdate()
{
diff --git a/tests/repositories/TagRepositoryTest.php b/tests/repositories/TagRepositoryTest.php
index 8810a6dfe4..7ab4f3950b 100644
--- a/tests/repositories/TagRepositoryTest.php
+++ b/tests/repositories/TagRepositoryTest.php
@@ -330,7 +330,6 @@ class TagRepositoryTest extends TestCase
/**
* @covers FireflyIII\Repositories\Tag\TagRepository::get
- * @todo Implement testGet().
*/
public function testGet()
{