From 033210473865e4bb37ce26852ed92bec78dbd9d7 Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 24 Dec 2014 19:00:31 +0100 Subject: [PATCH 01/84] Expanded tests for piggy banks. --- tests/functional.suite.yml | 2 +- tests/functional/PiggyBankControllerCest.php | 167 +++++++++++++++++++ 2 files changed, 168 insertions(+), 1 deletion(-) diff --git a/tests/functional.suite.yml b/tests/functional.suite.yml index 6c67a707ca..4d61ccdd3f 100644 --- a/tests/functional.suite.yml +++ b/tests/functional.suite.yml @@ -10,7 +10,7 @@ modules: config: Db: populate: false - cleanup: false + cleanup: true Laravel4: environment: 'testing' filters: false \ No newline at end of file diff --git a/tests/functional/PiggyBankControllerCest.php b/tests/functional/PiggyBankControllerCest.php index 136eb6cbd7..c92cc84f3d 100644 --- a/tests/functional/PiggyBankControllerCest.php +++ b/tests/functional/PiggyBankControllerCest.php @@ -105,6 +105,20 @@ class PiggyBankControllerCest $I->wantTo('process adding money to a piggy bank'); $I->amOnPage('/piggybanks/add/1'); $I->see('Add money to New camera'); + $I->submitForm('#add', ['amount' => 100]); + $I->see(',00 to "New camera".'); + } + + /** + * @param FunctionalTester $I + */ + public function postAddTooMuch(FunctionalTester $I) + { + $I->wantTo('try to add too much money to a piggy bank'); + $I->amOnPage('/piggybanks/add/1'); + $I->see('Add money to New camera'); + $I->submitForm('#add', ['amount' => 100000]); + $I->see(',00 to "New camera".'); } /** @@ -113,10 +127,33 @@ class PiggyBankControllerCest public function postRemove(FunctionalTester $I) { $I->wantTo('process removing money from a piggy bank'); + $I->amOnPage('/piggybanks/add/1'); + $I->see('Add money to New camera'); + $I->submitForm('#add', ['amount' => 100]); + $I->see(',00 to "New camera".'); $I->amOnPage('/piggybanks/remove/1'); $I->see('Remove money from New camera'); + $I->submitForm('#remove', ['amount' => 50]); + $I->see(',00 from "New camera".'); } + /** + * @param FunctionalTester $I + */ + public function postRemoveFail(FunctionalTester $I) + { + $I->wantTo('process removing too much money from a piggy bank'); + $I->amOnPage('/piggybanks/add/1'); + $I->see('Add money to New camera'); + $I->submitForm('#add', ['amount' => 100]); + $I->see(',00 to "New camera".'); + $I->amOnPage('/piggybanks/remove/1'); + $I->see('Remove money from New camera'); + $I->submitForm('#remove', ['amount' => 500]); + $I->see(',00 from "New camera".'); + } + + /** * @param FunctionalTester $I */ @@ -145,6 +182,54 @@ class PiggyBankControllerCest $I->wantTo('store a new piggy bank'); $I->amOnPage('/piggybanks/create'); $I->see('Create new piggy bank'); + $I->submitForm( + '#store', ['name' => 'Some new piggy bank', + 'rep_every' => 0, + 'reminder_skip' => 0, + 'remind_me' => 0, + 'order' => 3, + 'account_id' => 1, 'targetamount' => 1000] + ); + $I->see('Piggy bank "Some new piggy bank" stored.'); + } + + /** + * @param FunctionalTester $I + */ + public function storeAndReturn(FunctionalTester $I) + { + $I->wantTo('store a new piggy bank and return'); + $I->amOnPage('/piggybanks/create'); + $I->see('Create new piggy bank'); + $I->submitForm( + '#store', ['name' => 'Some new piggy bank', + 'rep_every' => 0, + 'reminder_skip' => 0, + 'post_submit_action' => 'create_another', + 'remind_me' => 0, + 'order' => 3, + 'account_id' => 1, 'targetamount' => 1000] + ); + $I->see('Piggy bank "Some new piggy bank" stored.'); + } + + /** + * @param FunctionalTester $I + */ + public function storeFail(FunctionalTester $I) + { + $I->wantTo('fail storing a new piggy bank'); + $I->amOnPage('/piggybanks/create'); + $I->see('Create new piggy bank'); + $I->submitForm( + '#store', ['name' => null, + 'rep_every' => 0, + 'reminder_skip' => 0, + 'remind_me' => 0, + 'order' => 3, + 'account_id' => 1, 'targetamount' => 1000] + ); + $I->see('Name is too short'); } /** @@ -155,6 +240,88 @@ class PiggyBankControllerCest $I->wantTo('update a piggy bank'); $I->amOnPage('/piggybanks/edit/1'); $I->see('Edit piggy bank "New camera"'); + $I->submitForm( + '#update', [ + 'name' => 'Updated camera', + 'account_id' => 2, + 'targetamount' => 2000, + 'targetdate' => '', + 'reminder' => 'week', + 'post_submit_action' => 'update', + ] + ); + $I->see('Piggy bank "Updated camera" updated.'); + + + } + + /** + * @param FunctionalTester $I + */ + public function updateAndReturn(FunctionalTester $I) + { + $I->wantTo('update a piggy bank and return'); + $I->amOnPage('/piggybanks/edit/1'); + $I->see('Edit piggy bank "New camera"'); + $I->submitForm( + '#update', [ + 'name' => 'Updated camera', + 'account_id' => 2, + 'targetamount' => 2000, + 'targetdate' => '', + 'reminder' => 'week', + 'post_submit_action' => 'return_to_edit', + ] + ); + $I->see('Piggy bank "Updated camera" updated.'); + + + } + + /** + * @param FunctionalTester $I + */ + public function updateValidateOnly(FunctionalTester $I) + { + $I->wantTo('validate a piggy bank'); + $I->amOnPage('/piggybanks/edit/1'); + $I->see('Edit piggy bank "New camera"'); + $I->submitForm( + '#update', [ + 'name' => 'Updated camera', + 'account_id' => 2, + 'targetamount' => 2000, + 'targetdate' => '', + 'reminder' => 'week', + 'post_submit_action' => 'validate_only', + ] + ); + $I->see('Updated camera'); + + + } + + /** + * @param FunctionalTester $I + */ + public function updateFail(FunctionalTester $I) + { + $I->wantTo('update a piggy bank and fail'); + $I->amOnPage('/piggybanks/edit/1'); + $I->see('Edit piggy bank "New camera"'); + $I->submitForm( + '#update', [ + 'name' => '', + 'account_id' => 2, + 'targetamount' => 2000, + 'targetdate' => '', + 'reminder' => 'week', + 'post_submit_action' => 'update', + ] + ); + $I->see('Name is too short'); + $I->seeInDatabase('piggybanks', ['name' => 'New camera']); + } } \ No newline at end of file From 335279e72888ecf23f946671f6da40867e02ce8f Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 24 Dec 2014 19:13:15 +0100 Subject: [PATCH 02/84] Renamed lots of "piggybank" to "piggyBank". --- app/breadcrumbs.php | 44 +++--- app/controllers/GoogleChartController.php | 6 +- app/controllers/PiggybankController.php | 134 ++++++++---------- .../Database/PiggyBank/PiggyBank.php | 6 +- app/lib/FireflyIII/Event/Piggybank.php | 32 ++--- .../FireflyIII/Shared/Toolkit/Reminders.php | 2 +- app/views/piggybanks/add.blade.php | 4 +- app/views/piggybanks/delete.blade.php | 6 +- app/views/piggybanks/edit.blade.php | 4 +- app/views/piggybanks/index.blade.php | 28 ++-- app/views/piggybanks/remove.blade.php | 8 +- app/views/piggybanks/show.blade.php | 38 ++--- 12 files changed, 152 insertions(+), 160 deletions(-) diff --git a/app/breadcrumbs.php b/app/breadcrumbs.php index 3269c6e773..487b182ed3 100644 --- a/app/breadcrumbs.php +++ b/app/breadcrumbs.php @@ -134,35 +134,35 @@ Breadcrumbs::register( // piggy banks Breadcrumbs::register( - 'piggybanks.index', function (Generator $breadcrumbs) { + 'piggyBanks.index', function (Generator $breadcrumbs) { $breadcrumbs->parent('home'); - $breadcrumbs->push('Piggy banks', route('piggybanks.index')); + $breadcrumbs->push('Piggy banks', route('piggyBanks.index')); } ); Breadcrumbs::register( - 'piggybanks.create', function (Generator $breadcrumbs) { - $breadcrumbs->parent('piggybanks.index'); - $breadcrumbs->push('Create new piggy bank', route('piggybanks.create')); + 'piggyBanks.create', function (Generator $breadcrumbs) { + $breadcrumbs->parent('piggyBanks.index'); + $breadcrumbs->push('Create new piggy bank', route('piggyBanks.create')); } ); Breadcrumbs::register( - 'piggybanks.edit', function (Generator $breadcrumbs, Piggybank $piggybank) { - $breadcrumbs->parent('piggybanks.show', $piggybank); - $breadcrumbs->push('Edit ' . $piggybank->name, route('piggybanks.edit', $piggybank->id)); + 'piggyBanks.edit', function (Generator $breadcrumbs, Piggybank $piggyBank) { + $breadcrumbs->parent('piggyBanks.show', $piggyBank); + $breadcrumbs->push('Edit ' . $piggyBank->name, route('piggyBanks.edit', $piggyBank->id)); } ); Breadcrumbs::register( - 'piggybanks.delete', function (Generator $breadcrumbs, Piggybank $piggybank) { - $breadcrumbs->parent('piggybanks.show', $piggybank); - $breadcrumbs->push('Delete ' . $piggybank->name, route('piggybanks.delete', $piggybank->id)); + 'piggyBanks.delete', function (Generator $breadcrumbs, Piggybank $piggyBank) { + $breadcrumbs->parent('piggyBanks.show', $piggyBank); + $breadcrumbs->push('Delete ' . $piggyBank->name, route('piggyBanks.delete', $piggyBank->id)); } ); Breadcrumbs::register( - 'piggybanks.show', function (Generator $breadcrumbs, Piggybank $piggybank) { - $breadcrumbs->parent('piggybanks.index'); - $breadcrumbs->push($piggybank->name, route('piggybanks.show', $piggybank->id)); + 'piggyBanks.show', function (Generator $breadcrumbs, Piggybank $piggyBank) { + $breadcrumbs->parent('piggyBanks.index'); + $breadcrumbs->push($piggyBank->name, route('piggyBanks.show', $piggyBank->id)); } ); @@ -251,22 +251,22 @@ Breadcrumbs::register( ); Breadcrumbs::register( - 'repeated.edit', function (Generator $breadcrumbs, Piggybank $piggybank) { - $breadcrumbs->parent('repeated.show', $piggybank); - $breadcrumbs->push('Edit ' . $piggybank->name, route('repeated.edit', $piggybank->id)); + 'repeated.edit', function (Generator $breadcrumbs, Piggybank $piggyBank) { + $breadcrumbs->parent('repeated.show', $piggyBank); + $breadcrumbs->push('Edit ' . $piggyBank->name, route('repeated.edit', $piggyBank->id)); } ); Breadcrumbs::register( - 'repeated.delete', function (Generator $breadcrumbs, Piggybank $piggybank) { - $breadcrumbs->parent('repeated.show', $piggybank); - $breadcrumbs->push('Delete ' . $piggybank->name, route('repeated.delete', $piggybank->id)); + 'repeated.delete', function (Generator $breadcrumbs, Piggybank $piggyBank) { + $breadcrumbs->parent('repeated.show', $piggyBank); + $breadcrumbs->push('Delete ' . $piggyBank->name, route('repeated.delete', $piggyBank->id)); } ); Breadcrumbs::register( - 'repeated.show', function (Generator $breadcrumbs, Piggybank $piggybank) { + 'repeated.show', function (Generator $breadcrumbs, Piggybank $piggyBank) { $breadcrumbs->parent('repeated.index'); - $breadcrumbs->push($piggybank->name, route('repeated.show', $piggybank->id)); + $breadcrumbs->push($piggyBank->name, route('repeated.show', $piggyBank->id)); } ); diff --git a/app/controllers/GoogleChartController.php b/app/controllers/GoogleChartController.php index 2a5786c5f6..2b5c50c22d 100644 --- a/app/controllers/GoogleChartController.php +++ b/app/controllers/GoogleChartController.php @@ -312,16 +312,16 @@ class GoogleChartController extends BaseController } /** - * @param Piggybank $piggybank + * @param Piggybank $piggyBank * * @return \Illuminate\Http\JsonResponse */ - public function piggyBankHistory(\Piggybank $piggybank) + public function piggyBankHistory(\Piggybank $piggyBank) { $this->_chart->addColumn('Date', 'date'); $this->_chart->addColumn('Balance', 'number'); - $set = \DB::table('piggy_bank_events')->where('piggybank_id', $piggybank->id)->groupBy('date')->get(['date', DB::Raw('SUM(`amount`) AS `sum`')]); + $set = \DB::table('piggy_bank_events')->where('piggybank_id', $piggyBank->id)->groupBy('date')->get(['date', DB::Raw('SUM(`amount`) AS `sum`')]); foreach ($set as $entry) { $this->_chart->addRow(new Carbon($entry->date), floatval($entry->sum)); diff --git a/app/controllers/PiggybankController.php b/app/controllers/PiggybankController.php index 307197ac32..3f6b4d7626 100644 --- a/app/controllers/PiggybankController.php +++ b/app/controllers/PiggybankController.php @@ -35,29 +35,21 @@ class PiggybankController extends BaseController /** * Add money to piggy bank * - * @param Piggybank $piggybank + * @param Piggybank $piggyBank * * @return $this */ - public function add(Piggybank $piggybank) + public function add(Piggybank $piggyBank) { - \Log::debug('Now in add() for piggy bank #' . $piggybank->id . ' (' . $piggybank->name . ')'); - \Log::debug('Z'); - \Log::debug('currentRelevantRep is null: ' . boolstr($piggybank->currentRelevantRep())); - $leftOnAccount = $this->_repository->leftOnAccount($piggybank->account); - \Log::debug('A'); - - $savedSoFar = $piggybank->currentRelevantRep()->currentamount; - \Log::debug('B'); - $leftToSave = $piggybank->targetamount - $savedSoFar; - \Log::debug('C'); + $leftOnAccount = $this->_repository->leftOnAccount($piggyBank->account); + $savedSoFar = $piggyBank->currentRelevantRep()->currentamount; + $leftToSave = $piggyBank->targetamount - $savedSoFar; $maxAmount = min($leftOnAccount, $leftToSave); - \Log::debug('D'); - \Log::debug('Now going to view for piggy bank #' . $piggybank->id . ' (' . $piggybank->name . ')'); + \Log::debug('Now going to view for piggy bank #' . $piggyBank->id . ' (' . $piggyBank->name . ')'); - return View::make('piggybanks.add', compact('piggybank', 'maxAmount')); + return View::make('piggybanks.add', compact('piggyBank', 'maxAmount')); } /** @@ -78,15 +70,15 @@ class PiggybankController extends BaseController } /** - * @param Piggybank $piggybank + * @param Piggybank $piggyBank * * @return $this */ - public function delete(Piggybank $piggybank) + public function delete(Piggybank $piggyBank) { - $subTitle = 'Delete "' . e($piggybank->name) . '"'; + $subTitle = 'Delete "' . e($piggyBank->name) . '"'; - return View::make('piggybanks.delete', compact('piggybank', 'subTitle')); + return View::make('piggybanks.delete', compact('piggyBank', 'subTitle')); } /** @@ -104,11 +96,11 @@ class PiggybankController extends BaseController } /** - * @param Piggybank $piggybank + * @param Piggybank $piggyBank * * @return $this */ - public function edit(Piggybank $piggybank) + public function edit(Piggybank $piggyBank) { /** @var \FireflyIII\Database\Account\Account $acct */ @@ -116,28 +108,28 @@ class PiggybankController extends BaseController $periods = Config::get('firefly.piggybank_periods'); $accounts = FFForm::makeSelectList($acct->getAssetAccounts()); - $subTitle = 'Edit piggy bank "' . e($piggybank->name) . '"'; + $subTitle = 'Edit piggy bank "' . e($piggyBank->name) . '"'; $subTitleIcon = 'fa-pencil'; /* * Flash some data to fill the form. */ - if (is_null($piggybank->targetdate) || $piggybank->targetdate == '') { + if (is_null($piggyBank->targetdate) || $piggyBank->targetdate == '') { $targetDate = null; } else { - $targetDate = new Carbon($piggybank->targetdate); + $targetDate = new Carbon($piggyBank->targetdate); $targetDate = $targetDate->format('Y-m-d'); } - $preFilled = ['name' => $piggybank->name, - 'account_id' => $piggybank->account_id, - 'targetamount' => $piggybank->targetamount, + $preFilled = ['name' => $piggyBank->name, + 'account_id' => $piggyBank->account_id, + 'targetamount' => $piggyBank->targetamount, 'targetdate' => $targetDate, - 'reminder' => $piggybank->reminder, - 'remind_me' => intval($piggybank->remind_me) == 1 || !is_null($piggybank->reminder) ? true : false + 'reminder' => $piggyBank->reminder, + 'remind_me' => intval($piggyBank->remind_me) == 1 || !is_null($piggyBank->reminder) ? true : false ]; Session::flash('preFilled', $preFilled); - return View::make('piggybanks.edit', compact('subTitle', 'subTitleIcon', 'piggybank', 'accounts', 'periods', 'preFilled')); + return View::make('piggybanks.edit', compact('subTitle', 'subTitleIcon', 'piggyBank', 'accounts', 'periods', 'preFilled')); } /** @@ -145,134 +137,134 @@ class PiggybankController extends BaseController */ public function index() { - /** @var Collection $piggybanks */ - $piggybanks = $this->_repository->get(); + /** @var Collection $piggyBanks */ + $piggyBanks = $this->_repository->get(); $accounts = []; - /** @var Piggybank $piggybank */ - foreach ($piggybanks as $piggybank) { - $piggybank->savedSoFar = floatval($piggybank->currentRelevantRep()->currentamount); - $piggybank->percentage = intval($piggybank->savedSoFar / $piggybank->targetamount * 100); - $piggybank->leftToSave = $piggybank->targetamount - $piggybank->savedSoFar; + /** @var Piggybank $piggyBank */ + foreach ($piggyBanks as $piggyBank) { + $piggyBank->savedSoFar = floatval($piggyBank->currentRelevantRep()->currentamount); + $piggyBank->percentage = intval($piggyBank->savedSoFar / $piggyBank->targetamount * 100); + $piggyBank->leftToSave = $piggyBank->targetamount - $piggyBank->savedSoFar; /* * Fill account information: */ - $account = $piggybank->account; + $account = $piggyBank->account; if (!isset($accounts[$account->id])) { $accounts[$account->id] = [ 'name' => $account->name, 'balance' => Steam::balance($account), 'leftForPiggybanks' => $this->_repository->leftOnAccount($account), - 'sumOfSaved' => $piggybank->savedSoFar, - 'sumOfTargets' => floatval($piggybank->targetamount), - 'leftToSave' => $piggybank->leftToSave + 'sumOfSaved' => $piggyBank->savedSoFar, + 'sumOfTargets' => floatval($piggyBank->targetamount), + 'leftToSave' => $piggyBank->leftToSave ]; } else { - $accounts[$account->id]['sumOfSaved'] += $piggybank->savedSoFar; - $accounts[$account->id]['sumOfTargets'] += floatval($piggybank->targetamount); - $accounts[$account->id]['leftToSave'] += $piggybank->leftToSave; + $accounts[$account->id]['sumOfSaved'] += $piggyBank->savedSoFar; + $accounts[$account->id]['sumOfTargets'] += floatval($piggyBank->targetamount); + $accounts[$account->id]['leftToSave'] += $piggyBank->leftToSave; } } - return View::make('piggybanks.index', compact('piggybanks', 'accounts')); + return View::make('piggybanks.index', compact('piggyBanks', 'accounts')); } /** * POST add money to piggy bank * - * @param Piggybank $piggybank + * @param Piggybank $piggyBank * * @return \Illuminate\Http\RedirectResponse */ - public function postAdd(Piggybank $piggybank) + public function postAdd(Piggybank $piggyBank) { $amount = round(floatval(Input::get('amount')), 2); /** @var \FireflyIII\Database\PiggyBank\PiggyBank $acct */ $repos = App::make('FireflyIII\Database\PiggyBank\PiggyBank'); - $leftOnAccount = $repos->leftOnAccount($piggybank->account); - $savedSoFar = $piggybank->currentRelevantRep()->currentamount; - $leftToSave = $piggybank->targetamount - $savedSoFar; + $leftOnAccount = $repos->leftOnAccount($piggyBank->account); + $savedSoFar = $piggyBank->currentRelevantRep()->currentamount; + $leftToSave = $piggyBank->targetamount - $savedSoFar; $maxAmount = round(min($leftOnAccount, $leftToSave), 2); if ($amount <= $maxAmount) { - $repetition = $piggybank->currentRelevantRep(); + $repetition = $piggyBank->currentRelevantRep(); $repetition->currentamount += $amount; $repetition->save(); /* * Create event! */ - Event::fire('piggybank.addMoney', [$piggybank, $amount]); // new and used. + Event::fire('piggybank.addMoney', [$piggyBank, $amount]); // new and used. - Session::flash('success', 'Added ' . mf($amount, false) . ' to "' . e($piggybank->name) . '".'); + Session::flash('success', 'Added ' . mf($amount, false) . ' to "' . e($piggyBank->name) . '".'); } else { - Session::flash('error', 'Could not add ' . mf($amount, false) . ' to "' . e($piggybank->name) . '".'); + Session::flash('error', 'Could not add ' . mf($amount, false) . ' to "' . e($piggyBank->name) . '".'); } return Redirect::route('piggybanks.index'); } /** - * @param Piggybank $piggybank + * @param Piggybank $piggyBank * * @return \Illuminate\Http\RedirectResponse */ - public function postRemove(Piggybank $piggybank) + public function postRemove(Piggybank $piggyBank) { $amount = floatval(Input::get('amount')); - $savedSoFar = $piggybank->currentRelevantRep()->currentamount; + $savedSoFar = $piggyBank->currentRelevantRep()->currentamount; if ($amount <= $savedSoFar) { - $repetition = $piggybank->currentRelevantRep(); + $repetition = $piggyBank->currentRelevantRep(); $repetition->currentamount -= $amount; $repetition->save(); /* * Create event! */ - Event::fire('piggybank.removeMoney', [$piggybank, $amount]); // new and used. + Event::fire('piggybank.removeMoney', [$piggyBank, $amount]); // new and used. - Session::flash('success', 'Removed ' . mf($amount, false) . ' from "' . e($piggybank->name) . '".'); + Session::flash('success', 'Removed ' . mf($amount, false) . ' from "' . e($piggyBank->name) . '".'); } else { - Session::flash('error', 'Could not remove ' . mf($amount, false) . ' from "' . e($piggybank->name) . '".'); + Session::flash('error', 'Could not remove ' . mf($amount, false) . ' from "' . e($piggyBank->name) . '".'); } return Redirect::route('piggybanks.index'); } /** - * @param Piggybank $piggybank + * @param Piggybank $piggyBank * * @return \Illuminate\View\View */ - public function remove(Piggybank $piggybank) + public function remove(Piggybank $piggyBank) { - return View::make('piggybanks.remove')->with('piggybank', $piggybank); + return View::make('piggybanks.remove',compact('piggyBank')); } /** - * @param Piggybank $piggybank + * @param Piggybank $piggyBank * * @return $this */ - public function show(Piggybank $piggybank) + public function show(Piggybank $piggyBank) { - $events = $piggybank->piggybankevents()->orderBy('date', 'DESC')->orderBy('id', 'DESC')->get(); + $events = $piggyBank->piggybankevents()->orderBy('date', 'DESC')->orderBy('id', 'DESC')->get(); /* * Number of reminders: */ - $amountPerReminder = $piggybank->amountPerReminder(); - $remindersCount = $piggybank->countFutureReminders(); - $subTitle = e($piggybank->name); + $amountPerReminder = $piggyBank->amountPerReminder(); + $remindersCount = $piggyBank->countFutureReminders(); + $subTitle = e($piggyBank->name); - return View::make('piggybanks.show', compact('amountPerReminder', 'remindersCount', 'piggybank', 'events', 'subTitle')); + return View::make('piggybanks.show', compact('amountPerReminder', 'remindersCount', 'piggyBank', 'events', 'subTitle')); } diff --git a/app/lib/FireflyIII/Database/PiggyBank/PiggyBank.php b/app/lib/FireflyIII/Database/PiggyBank/PiggyBank.php index 44d4a6adf9..9325da329b 100644 --- a/app/lib/FireflyIII/Database/PiggyBank/PiggyBank.php +++ b/app/lib/FireflyIII/Database/PiggyBank/PiggyBank.php @@ -221,17 +221,17 @@ class PiggyBank implements CUD, CommonDatabaseCalls, PiggyBankInterface } /** - * @param \Piggybank $piggybank + * @param \Piggybank $piggyBank * @param Carbon $date * * @return mixed * @throws FireflyException * @throws NotImplementedException */ - public function findRepetitionByDate(\Piggybank $piggybank, Carbon $date) + public function findRepetitionByDate(\Piggybank $piggyBank, Carbon $date) { /** @var Collection $reps */ - $reps = $piggybank->piggybankrepetitions()->get(); + $reps = $piggyBank->piggybankrepetitions()->get(); if ($reps->count() == 1) { return $reps->first(); } diff --git a/app/lib/FireflyIII/Event/Piggybank.php b/app/lib/FireflyIII/Event/Piggybank.php index bd9ee555f5..1b1c9cde1c 100644 --- a/app/lib/FireflyIII/Event/Piggybank.php +++ b/app/lib/FireflyIII/Event/Piggybank.php @@ -15,14 +15,14 @@ class Piggybank { /** - * @param \Piggybank $piggybank + * @param \Piggybank $piggyBank * @param float $amount */ - public function addMoney(\Piggybank $piggybank, $amount = 0.0) + public function addMoney(\Piggybank $piggyBank, $amount = 0.0) { if ($amount > 0) { $event = new \PiggyBankEvent; - $event->piggybank()->associate($piggybank); + $event->piggybank()->associate($piggyBank); $event->amount = floatval($amount); $event->date = new Carbon; if (!$event->isValid()) { @@ -76,15 +76,15 @@ class Piggybank } /** - * @param \Piggybank $piggybank + * @param \Piggybank $piggyBank * @param float $amount */ - public function removeMoney(\Piggybank $piggybank, $amount = 0.0) + public function removeMoney(\Piggybank $piggyBank, $amount = 0.0) { $amount = $amount * -1; if ($amount < 0) { $event = new \PiggyBankEvent; - $event->piggybank()->associate($piggybank); + $event->piggybank()->associate($piggyBank); $event->amount = floatval($amount); $event->date = new Carbon; $event->save(); @@ -92,15 +92,15 @@ class Piggybank } /** - * @param \Piggybank $piggybank + * @param \Piggybank $piggyBank */ - public function storePiggybank(\Piggybank $piggybank) + public function storePiggybank(\Piggybank $piggyBank) { - if (intval($piggybank->repeats) == 0) { + if (intval($piggyBank->repeats) == 0) { $repetition = new \PiggybankRepetition; - $repetition->piggybank()->associate($piggybank); - $repetition->startdate = $piggybank->startdate; - $repetition->targetdate = $piggybank->targetdate; + $repetition->piggybank()->associate($piggyBank); + $repetition->startdate = $piggyBank->startdate; + $repetition->targetdate = $piggyBank->targetdate; $repetition->currentamount = 0; $repetition->save(); } @@ -112,18 +112,18 @@ class Piggybank /** * @param \TransactionJournal $journal - * @param int $piggybankId + * @param int $piggyBankId */ - public function storeTransfer(\TransactionJournal $journal, $piggybankId = 0) + public function storeTransfer(\TransactionJournal $journal, $piggyBankId = 0) { - if (intval($piggybankId) == 0) { + if (intval($piggyBankId) == 0) { return; } /** @var \FireflyIII\Database\PiggyBank\PiggyBank $repository */ $repository = \App::make('FireflyIII\Database\PiggyBank\PiggyBank'); /** @var \Piggybank $piggyBank */ - $piggyBank = $repository->find($piggybankId); + $piggyBank = $repository->find($piggyBankId); if ($journal->transactions()->where('account_id', $piggyBank->account_id)->count() == 0) { return; diff --git a/app/lib/FireflyIII/Shared/Toolkit/Reminders.php b/app/lib/FireflyIII/Shared/Toolkit/Reminders.php index c70ea542e6..d3e582f916 100644 --- a/app/lib/FireflyIII/Shared/Toolkit/Reminders.php +++ b/app/lib/FireflyIII/Shared/Toolkit/Reminders.php @@ -72,7 +72,7 @@ class Reminders $today = Carbon::now(); - /** @var \Piggybank $piggybank */ + /** @var \Piggybank $piggyBank */ foreach ($set as $piggyBank) { /** @var \PiggybankRepetition $repetition */ $repetition = $piggyBank->currentRelevantRep(); diff --git a/app/views/piggybanks/add.blade.php b/app/views/piggybanks/add.blade.php index a4c7f5dc6e..c4f0a9cc3d 100644 --- a/app/views/piggybanks/add.blade.php +++ b/app/views/piggybanks/add.blade.php @@ -1,10 +1,10 @@ -
+ {{Form::token()}}
- \ No newline at end of file + diff --git a/app/views/partials/flashes.blade.php b/app/views/partials/flashes.blade.php index e9d28fd3a2..e97d346de0 100644 --- a/app/views/partials/flashes.blade.php +++ b/app/views/partials/flashes.blade.php @@ -24,4 +24,4 @@ Error! {{{Session::get('error')}}} -@endif \ No newline at end of file +@endif diff --git a/app/views/piggy_banks/add.blade.php b/app/views/piggy_banks/add.blade.php index 7dddbeb4b2..f9680880e7 100644 --- a/app/views/piggy_banks/add.blade.php +++ b/app/views/piggy_banks/add.blade.php @@ -21,4 +21,4 @@ - \ No newline at end of file + diff --git a/app/views/piggy_banks/delete.blade.php b/app/views/piggy_banks/delete.blade.php index 6943692500..790ee835bd 100644 --- a/app/views/piggy_banks/delete.blade.php +++ b/app/views/piggy_banks/delete.blade.php @@ -34,4 +34,4 @@ {{Form::close()}} -@stop \ No newline at end of file +@stop diff --git a/app/views/piggy_banks/index.blade.php b/app/views/piggy_banks/index.blade.php index 5c99d9951e..ea6009201d 100644 --- a/app/views/piggy_banks/index.blade.php +++ b/app/views/piggy_banks/index.blade.php @@ -129,4 +129,4 @@ @stop @section('scripts') {{HTML::script('assets/javascript/firefly/piggy_banks.js')}} -@stop \ No newline at end of file +@stop diff --git a/app/views/piggy_banks/remove.blade.php b/app/views/piggy_banks/remove.blade.php index 09e3c1f1bb..4d157a8287 100644 --- a/app/views/piggy_banks/remove.blade.php +++ b/app/views/piggy_banks/remove.blade.php @@ -21,4 +21,4 @@ - \ No newline at end of file + diff --git a/app/views/preferences/index.blade.php b/app/views/preferences/index.blade.php index d57aa6636b..9a567a97e1 100644 --- a/app/views/preferences/index.blade.php +++ b/app/views/preferences/index.blade.php @@ -102,4 +102,4 @@ @stop @section('scripts') -@stop \ No newline at end of file +@stop diff --git a/app/views/profile/change-password.blade.php b/app/views/profile/change-password.blade.php index 8cbcc0f8f9..3b15e68988 100644 --- a/app/views/profile/change-password.blade.php +++ b/app/views/profile/change-password.blade.php @@ -41,4 +41,4 @@ @stop @section('scripts') -@stop \ No newline at end of file +@stop diff --git a/app/views/profile/index.blade.php b/app/views/profile/index.blade.php index 14abe537dd..ef0440ffd5 100644 --- a/app/views/profile/index.blade.php +++ b/app/views/profile/index.blade.php @@ -15,4 +15,4 @@ @stop @section('scripts') -@stop \ No newline at end of file +@stop diff --git a/app/views/reminders/show.blade.php b/app/views/reminders/show.blade.php index 115c9aaf24..76cdd56b23 100644 --- a/app/views/reminders/show.blade.php +++ b/app/views/reminders/show.blade.php @@ -29,4 +29,4 @@ -@stop \ No newline at end of file +@stop diff --git a/app/views/repeatedExpense/delete.blade.php b/app/views/repeatedExpense/delete.blade.php index 0c1e15277b..518278e74a 100644 --- a/app/views/repeatedExpense/delete.blade.php +++ b/app/views/repeatedExpense/delete.blade.php @@ -34,4 +34,4 @@ {{Form::close()}} -@stop \ No newline at end of file +@stop diff --git a/app/views/repeatedExpense/index.blade.php b/app/views/repeatedExpense/index.blade.php index 496107e0bf..e8167c42b6 100644 --- a/app/views/repeatedExpense/index.blade.php +++ b/app/views/repeatedExpense/index.blade.php @@ -67,4 +67,4 @@ @stop @section('scripts') -@stop \ No newline at end of file +@stop diff --git a/app/views/repeatedExpense/show.blade.php b/app/views/repeatedExpense/show.blade.php index bce4474181..bc3e5154fa 100644 --- a/app/views/repeatedExpense/show.blade.php +++ b/app/views/repeatedExpense/show.blade.php @@ -58,4 +58,4 @@ @endforeach -@stop \ No newline at end of file +@stop diff --git a/app/views/reports/budget.blade.php b/app/views/reports/budget.blade.php index 86b15e7123..52f64e6a61 100644 --- a/app/views/reports/budget.blade.php +++ b/app/views/reports/budget.blade.php @@ -153,4 +153,4 @@ @stop @section('scripts') {{HTML::script('assets/javascript/firefly/reports.js')}} -@stop \ No newline at end of file +@stop diff --git a/app/views/reports/index.blade.php b/app/views/reports/index.blade.php index 80e6180f36..75980f7376 100644 --- a/app/views/reports/index.blade.php +++ b/app/views/reports/index.blade.php @@ -47,4 +47,4 @@ -@stop \ No newline at end of file +@stop diff --git a/app/views/reports/month.blade.php b/app/views/reports/month.blade.php index 30366bcee5..9699f02ea0 100644 --- a/app/views/reports/month.blade.php +++ b/app/views/reports/month.blade.php @@ -194,4 +194,4 @@ -@stop \ No newline at end of file +@stop diff --git a/app/views/reports/year.blade.php b/app/views/reports/year.blade.php index e7fc7c5d7a..10a332bf67 100644 --- a/app/views/reports/year.blade.php +++ b/app/views/reports/year.blade.php @@ -161,4 +161,4 @@ var currencyCode = '{{getCurrencyCode()}}'; {{HTML::script('assets/javascript/firefly/reports.js')}} -@stop \ No newline at end of file +@stop diff --git a/app/views/search/index.blade.php b/app/views/search/index.blade.php index d1431ebe73..c6f6f16a4b 100644 --- a/app/views/search/index.blade.php +++ b/app/views/search/index.blade.php @@ -103,4 +103,4 @@ -@stop \ No newline at end of file +@stop diff --git a/app/views/transactions/create.blade.php b/app/views/transactions/create.blade.php index 5cb557e1fa..5585ddb4c6 100644 --- a/app/views/transactions/create.blade.php +++ b/app/views/transactions/create.blade.php @@ -93,4 +93,4 @@ @section('scripts') {{HTML::script('assets/javascript/typeahead/bootstrap3-typeahead.min.js')}} {{HTML::script('assets/javascript/firefly/transactions.js')}} -@stop \ No newline at end of file +@stop diff --git a/app/views/transactions/edit.blade.php b/app/views/transactions/edit.blade.php index 03f79385e7..0b60dd357e 100644 --- a/app/views/transactions/edit.blade.php +++ b/app/views/transactions/edit.blade.php @@ -93,4 +93,4 @@ @section('scripts') {{HTML::script('assets/javascript/typeahead/bootstrap3-typeahead.min.js')}} {{HTML::script('assets/javascript/firefly/transactions.js')}} -@stop \ No newline at end of file +@stop diff --git a/app/views/transactions/show.blade.php b/app/views/transactions/show.blade.php index 8443184239..a6b7446b21 100644 --- a/app/views/transactions/show.blade.php +++ b/app/views/transactions/show.blade.php @@ -128,4 +128,4 @@ @section('scripts') {{HTML::script('assets/javascript/firefly/transactions.js')}} {{HTML::script('assets/javascript/firefly/related-manager.js')}} -@stop \ No newline at end of file +@stop diff --git a/app/views/user/login.blade.php b/app/views/user/login.blade.php index 4f7e8a678e..a2efbcfa9e 100644 --- a/app/views/user/login.blade.php +++ b/app/views/user/login.blade.php @@ -36,4 +36,4 @@ -@stop \ No newline at end of file +@stop diff --git a/app/views/user/register.blade.php b/app/views/user/register.blade.php index 6fbc49a849..a7a11f07fc 100644 --- a/app/views/user/register.blade.php +++ b/app/views/user/register.blade.php @@ -30,4 +30,4 @@ -@stop \ No newline at end of file +@stop diff --git a/app/views/user/registered.blade.php b/app/views/user/registered.blade.php index 3724140e4e..ce4e3e056e 100644 --- a/app/views/user/registered.blade.php +++ b/app/views/user/registered.blade.php @@ -16,4 +16,4 @@ -@stop \ No newline at end of file +@stop diff --git a/app/views/user/remindMe-html.blade.php b/app/views/user/remindMe-html.blade.php index e16c85fafe..16f09cc04d 100644 --- a/app/views/user/remindMe-html.blade.php +++ b/app/views/user/remindMe-html.blade.php @@ -16,4 +16,4 @@

- \ No newline at end of file + diff --git a/app/views/user/remindMe.blade.php b/app/views/user/remindMe.blade.php index fcf0f179a3..18b48954ac 100644 --- a/app/views/user/remindMe.blade.php +++ b/app/views/user/remindMe.blade.php @@ -24,4 +24,4 @@ -@stop \ No newline at end of file +@stop diff --git a/app/views/user/verification-pending.blade.php b/app/views/user/verification-pending.blade.php index 7e224b82ef..a10b2d53da 100644 --- a/app/views/user/verification-pending.blade.php +++ b/app/views/user/verification-pending.blade.php @@ -16,4 +16,4 @@ -@stop \ No newline at end of file +@stop diff --git a/bootstrap/functions.php b/bootstrap/functions.php index 2424d07741..69c13d834b 100644 --- a/bootstrap/functions.php +++ b/bootstrap/functions.php @@ -163,4 +163,4 @@ if (!function_exists('boolstr')) { return 'NO BOOLEAN: ' . $boolean; } -} \ No newline at end of file +} diff --git a/tests/functional/AccountControllerCest.php b/tests/functional/AccountControllerCest.php index 6577b9ef6d..35ea055806 100644 --- a/tests/functional/AccountControllerCest.php +++ b/tests/functional/AccountControllerCest.php @@ -197,4 +197,4 @@ class AccountControllerCest } -} \ No newline at end of file +} diff --git a/tests/functional/BillControllerCest.php b/tests/functional/BillControllerCest.php index 05f9c270a5..5347420f5a 100644 --- a/tests/functional/BillControllerCest.php +++ b/tests/functional/BillControllerCest.php @@ -273,4 +273,4 @@ class BillControllerCest $I->see('Bill "Some bill" updated.'); } -} \ No newline at end of file +} diff --git a/tests/functional/BudgetControllerCest.php b/tests/functional/BudgetControllerCest.php index 79400e7f9a..a81c7e0b33 100644 --- a/tests/functional/BudgetControllerCest.php +++ b/tests/functional/BudgetControllerCest.php @@ -239,4 +239,4 @@ class BudgetControllerCest $I->seeRecord('budgets', ['name' => 'Delete me']); } -} \ No newline at end of file +} diff --git a/tests/functional/CategoryControllerCest.php b/tests/functional/CategoryControllerCest.php index d3452276a0..3a7b5d10ba 100644 --- a/tests/functional/CategoryControllerCest.php +++ b/tests/functional/CategoryControllerCest.php @@ -189,4 +189,4 @@ class CategoryControllerCest } -} \ No newline at end of file +} diff --git a/tests/functional/CurrencyControllerCest.php b/tests/functional/CurrencyControllerCest.php index b8b9ed7845..168fffc5cb 100644 --- a/tests/functional/CurrencyControllerCest.php +++ b/tests/functional/CurrencyControllerCest.php @@ -199,4 +199,4 @@ class CurrencyControllerCest $I->seeRecord('transaction_currencies', ['name' => 'US Dollar']); } -} \ No newline at end of file +} diff --git a/tests/functional/GoogleChartControllerCest.php b/tests/functional/GoogleChartControllerCest.php index 274da2e0de..578204b153 100644 --- a/tests/functional/GoogleChartControllerCest.php +++ b/tests/functional/GoogleChartControllerCest.php @@ -210,4 +210,4 @@ class GoogleChartControllerCest } -} \ No newline at end of file +} diff --git a/tests/functional/HelpControllerCest.php b/tests/functional/HelpControllerCest.php index 8f4cbac78c..a8bb6c2d66 100644 --- a/tests/functional/HelpControllerCest.php +++ b/tests/functional/HelpControllerCest.php @@ -86,4 +86,4 @@ class HelpControllerCest } -} \ No newline at end of file +} diff --git a/tests/functional/HomeControllerCest.php b/tests/functional/HomeControllerCest.php index 4b138831de..176351aa98 100644 --- a/tests/functional/HomeControllerCest.php +++ b/tests/functional/HomeControllerCest.php @@ -94,4 +94,4 @@ class HomeControllerCest $I->amOnPage('/prev'); $I->canSeeResponseCodeIs(200); } -} \ No newline at end of file +} diff --git a/tests/functional/JsonControllerCest.php b/tests/functional/JsonControllerCest.php index 6aee764604..907d6cf724 100644 --- a/tests/functional/JsonControllerCest.php +++ b/tests/functional/JsonControllerCest.php @@ -53,4 +53,4 @@ class JsonControllerCest $I->amOnPage('/json/revenue-accounts'); $I->canSeeResponseCodeIs(200); } -} \ No newline at end of file +} diff --git a/tests/functional/PiggyBankControllerCest.php b/tests/functional/PiggyBankControllerCest.php index 0b717f639b..fc00a93005 100644 --- a/tests/functional/PiggyBankControllerCest.php +++ b/tests/functional/PiggyBankControllerCest.php @@ -329,4 +329,4 @@ class PiggyBankControllerCest } -} \ No newline at end of file +} diff --git a/tests/functional/PreferencesControllerCest.php b/tests/functional/PreferencesControllerCest.php index 8149780db8..44080b93d6 100644 --- a/tests/functional/PreferencesControllerCest.php +++ b/tests/functional/PreferencesControllerCest.php @@ -45,4 +45,4 @@ class PreferencesControllerCest $I->submitForm('#preferences', []); $I->see('Preferences saved!'); } -} \ No newline at end of file +} diff --git a/tests/functional/ProfileControllerCest.php b/tests/functional/ProfileControllerCest.php index cb79784cbc..7f6c980d20 100644 --- a/tests/functional/ProfileControllerCest.php +++ b/tests/functional/ProfileControllerCest.php @@ -147,4 +147,4 @@ class ProfileControllerCest } -} \ No newline at end of file +} diff --git a/tests/functional/ReminderControllerCest.php b/tests/functional/ReminderControllerCest.php index 41d2bac3c6..01901b2cb5 100644 --- a/tests/functional/ReminderControllerCest.php +++ b/tests/functional/ReminderControllerCest.php @@ -83,4 +83,4 @@ class ReminderControllerCest $I->see('your piggy bank labelled "Nieuwe spullen"'); } -} \ No newline at end of file +} diff --git a/tests/functional/RepeatedExpenseControllerCest.php b/tests/functional/RepeatedExpenseControllerCest.php index 38069520cc..58d2392ee2 100644 --- a/tests/functional/RepeatedExpenseControllerCest.php +++ b/tests/functional/RepeatedExpenseControllerCest.php @@ -241,4 +241,4 @@ class RepeatedExpenseControllerCest ); $I->see('The name field is required.'); } -} \ No newline at end of file +} diff --git a/tests/functional/ReportControllerCest.php b/tests/functional/ReportControllerCest.php index 6d2ff144b0..cd1a546a19 100644 --- a/tests/functional/ReportControllerCest.php +++ b/tests/functional/ReportControllerCest.php @@ -76,4 +76,4 @@ class ReportControllerCest $I->see('Invalid date'); } -} \ No newline at end of file +} diff --git a/tests/functional/SearchControllerCest.php b/tests/functional/SearchControllerCest.php index 973b2c54ab..8b8341f59b 100644 --- a/tests/functional/SearchControllerCest.php +++ b/tests/functional/SearchControllerCest.php @@ -36,4 +36,4 @@ class SearchControllerCest $I->see('Search for ""'); } -} \ No newline at end of file +} diff --git a/tests/functional/TransactionControllerCest.php b/tests/functional/TransactionControllerCest.php index 7049228904..54e337305b 100644 --- a/tests/functional/TransactionControllerCest.php +++ b/tests/functional/TransactionControllerCest.php @@ -232,4 +232,4 @@ class TransactionControllerCest } -} \ No newline at end of file +} diff --git a/tests/functional/UserControllerCest.php b/tests/functional/UserControllerCest.php index d04dfcccd1..a9a5141632 100644 --- a/tests/functional/UserControllerCest.php +++ b/tests/functional/UserControllerCest.php @@ -147,4 +147,4 @@ class UserControllerCest $I->see('You\'re about to get an e-mail.'); } -} \ No newline at end of file +} diff --git a/tests/functional/_bootstrap.php b/tests/functional/_bootstrap.php index c25406adad..e489e45b9e 100644 --- a/tests/functional/_bootstrap.php +++ b/tests/functional/_bootstrap.php @@ -5,4 +5,4 @@ if (!file_exists($db)) { exec('touch ' . $db); exec('php artisan migrate --seed --env=testing', $out); exec('sqlite3 tests/_data/db.sqlite .dump > tests/_data/dump.sql', $out); -} \ No newline at end of file +} diff --git a/tests/unit/AccountTest.php b/tests/unit/AccountTest.php index 5ffff946c7..16145d8932 100644 --- a/tests/unit/AccountTest.php +++ b/tests/unit/AccountTest.php @@ -37,4 +37,4 @@ class AccountTest extends TestCase $this->assertInstanceOf('User', $account->user); } -} \ No newline at end of file +} diff --git a/tests/unit/AccountTypeTest.php b/tests/unit/AccountTypeTest.php index c0d29759ed..94aede8b6a 100644 --- a/tests/unit/AccountTypeTest.php +++ b/tests/unit/AccountTypeTest.php @@ -24,4 +24,4 @@ class AccountTypeTest extends TestCase $this->assertCount(1, $account->accountType()->first()->accounts()->get()); } -} \ No newline at end of file +} diff --git a/tests/unit/BudgetTest.php b/tests/unit/BudgetTest.php index bbe67da42c..88321ee974 100644 --- a/tests/unit/BudgetTest.php +++ b/tests/unit/BudgetTest.php @@ -23,4 +23,4 @@ class BudgetTest extends TestCase $this->assertInstanceOf('User', $budget->user); } -} \ No newline at end of file +} diff --git a/tests/unit/PiggyBankRepetitionTest.php b/tests/unit/PiggyBankRepetitionTest.php index 0d889aad31..3bf35313e6 100644 --- a/tests/unit/PiggyBankRepetitionTest.php +++ b/tests/unit/PiggyBankRepetitionTest.php @@ -26,4 +26,4 @@ class PiggyBankRepetitionTest extends TestCase $this->assertCount(1, PiggyBankRepetition::starts($start)->get()); $this->assertCount(1, PiggyBankRepetition::targets($target)->get()); } -} \ No newline at end of file +} diff --git a/tests/unit/PiggyBankTest.php b/tests/unit/PiggyBankTest.php index 4b9a4f617d..efe7210cc0 100644 --- a/tests/unit/PiggyBankTest.php +++ b/tests/unit/PiggyBankTest.php @@ -24,4 +24,4 @@ class PiggyBankTest extends TestCase $piggyBank->reminders()->save($reminder); $this->assertCount(1, $piggyBank->reminders()->get()); } -} \ No newline at end of file +} diff --git a/tests/unit/ReminderTest.php b/tests/unit/ReminderTest.php index 3801b4aebe..6a792ff9c4 100644 --- a/tests/unit/ReminderTest.php +++ b/tests/unit/ReminderTest.php @@ -35,4 +35,4 @@ class ReminderTest extends TestCase $this->assertEquals($reminder->user->id, $user->id); } -} \ No newline at end of file +} diff --git a/tests/unit/TransactionGroupTest.php b/tests/unit/TransactionGroupTest.php index f6439a7638..9c3b72272b 100644 --- a/tests/unit/TransactionGroupTest.php +++ b/tests/unit/TransactionGroupTest.php @@ -22,4 +22,4 @@ class TransactionGroupTest extends TestCase $group = f::create('TransactionGroup'); $this->assertEquals($group->user_id, $group->user->id); } -} \ No newline at end of file +} diff --git a/tests/unit/TransactionJournalTest.php b/tests/unit/TransactionJournalTest.php index c6f4f42c19..863c87cff8 100644 --- a/tests/unit/TransactionJournalTest.php +++ b/tests/unit/TransactionJournalTest.php @@ -30,4 +30,4 @@ class TransactionJournalTest extends TestCase $this->assertCount(1, TransactionJournal::moreThan($amount)->get()); } -} \ No newline at end of file +} diff --git a/tests/unit/TransactionTest.php b/tests/unit/TransactionTest.php index b571dccbb2..f154d5130e 100644 --- a/tests/unit/TransactionTest.php +++ b/tests/unit/TransactionTest.php @@ -64,4 +64,4 @@ class TransactionTest extends TestCase $type = $transaction->transactionJournal->transactionType->type; $this->assertCount(1, Transaction::transactionTypes([$type])->get()); } -} \ No newline at end of file +} diff --git a/tests/unit/TransactionTypeTest.php b/tests/unit/TransactionTypeTest.php index c0feba77b5..d2b4033d69 100644 --- a/tests/unit/TransactionTypeTest.php +++ b/tests/unit/TransactionTypeTest.php @@ -27,4 +27,4 @@ class TransactionTypeTest extends TestCase } -} \ No newline at end of file +} diff --git a/tests/unit/UserTest.php b/tests/unit/UserTest.php index 86ad425bd6..8a1b60a65f 100644 --- a/tests/unit/UserTest.php +++ b/tests/unit/UserTest.php @@ -31,4 +31,4 @@ class UserTest extends TestCase $this->assertEquals($reminder->user_id, $reminder->user->id); } -} \ No newline at end of file +} From 45aa85d690b6684257868e80716161378a2b4673 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 2 Jan 2015 06:24:48 +0100 Subject: [PATCH 74/84] Added new lines [skip ci] --- .coveralls.yml | 2 +- .gitignore | 1 - .travis.yml | 2 +- README.md | 2 +- app/config/.gitignore | 2 +- app/lib/FireflyIII/Report/Report.php | 2 +- app/storage/.gitignore | 2 +- app/storage/cache/.gitignore | 2 +- app/storage/debugbar/.gitignore | 2 +- app/storage/logs/.gitignore | 2 +- app/storage/meta/.gitignore | 2 +- app/storage/sessions/.gitignore | 2 +- app/storage/views/.gitignore | 2 +- codeception.yml | 2 +- provider/assets/stylesheets/readme.txt | 2 +- tests/acceptance.suite.yml | 2 +- tests/functional.suite.yml | 2 +- 17 files changed, 16 insertions(+), 17 deletions(-) diff --git a/.coveralls.yml b/.coveralls.yml index 68c3d23770..8951ac7b73 100644 --- a/.coveralls.yml +++ b/.coveralls.yml @@ -1,3 +1,3 @@ src_dir: . coverage_clover: tests/_output/coverage.xml -json_path: tests/_output/coveralls-upload.json \ No newline at end of file +json_path: tests/_output/coveralls-upload.json diff --git a/.gitignore b/.gitignore index ccc58cf470..0ca3cc6632 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ composer.phar .env.*.php .env.php -.DS_Store Thumbs.db .idea/ tests/_output/* diff --git a/.travis.yml b/.travis.yml index 7638995c02..1f82f07b02 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,4 +13,4 @@ script: - php vendor/bin/codecept run --coverage --coverage-xml after_script: - - php vendor/bin/coveralls \ No newline at end of file + - php vendor/bin/coveralls diff --git a/README.md b/README.md index 25c2f0d92b..e61b574ee0 100644 --- a/README.md +++ b/README.md @@ -70,4 +70,4 @@ I have the basics up and running. Test coverage is currently coming, slowly. Although I have not checked extensively, some forms and views have CSRF vulnerabilities. This is because not all views escape all characters by default. Will be fixed. -Questions, ideas or other things to contribute? [Let me know](https://github.com/JC5/firefly-iii/issues/new)! \ No newline at end of file +Questions, ideas or other things to contribute? [Let me know](https://github.com/JC5/firefly-iii/issues/new)! diff --git a/app/config/.gitignore b/app/config/.gitignore index 8205aab29b..10601ce198 100644 --- a/app/config/.gitignore +++ b/app/config/.gitignore @@ -1,4 +1,4 @@ local/ laptop/ vagrant/ -production/ \ No newline at end of file +production/ diff --git a/app/lib/FireflyIII/Report/Report.php b/app/lib/FireflyIII/Report/Report.php index dd396b6cc8..3b012bcc1c 100644 --- a/app/lib/FireflyIII/Report/Report.php +++ b/app/lib/FireflyIII/Report/Report.php @@ -295,7 +295,7 @@ class Report implements ReportInterface $end = clone $date; $end->endOfMonth(); - $set = \PiggyBank:: + \PiggyBank:: leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id') ->where('accounts.user_id', \Auth::user()->id) ->where('repeats', 0) diff --git a/app/storage/.gitignore b/app/storage/.gitignore index 35b719c69a..2fe64d84cc 100644 --- a/app/storage/.gitignore +++ b/app/storage/.gitignore @@ -1 +1 @@ -services.manifest \ No newline at end of file +services.manifest diff --git a/app/storage/cache/.gitignore b/app/storage/cache/.gitignore index c96a04f008..d6b7ef32c8 100644 --- a/app/storage/cache/.gitignore +++ b/app/storage/cache/.gitignore @@ -1,2 +1,2 @@ * -!.gitignore \ No newline at end of file +!.gitignore diff --git a/app/storage/debugbar/.gitignore b/app/storage/debugbar/.gitignore index c96a04f008..d6b7ef32c8 100644 --- a/app/storage/debugbar/.gitignore +++ b/app/storage/debugbar/.gitignore @@ -1,2 +1,2 @@ * -!.gitignore \ No newline at end of file +!.gitignore diff --git a/app/storage/logs/.gitignore b/app/storage/logs/.gitignore index c96a04f008..d6b7ef32c8 100644 --- a/app/storage/logs/.gitignore +++ b/app/storage/logs/.gitignore @@ -1,2 +1,2 @@ * -!.gitignore \ No newline at end of file +!.gitignore diff --git a/app/storage/meta/.gitignore b/app/storage/meta/.gitignore index c96a04f008..d6b7ef32c8 100644 --- a/app/storage/meta/.gitignore +++ b/app/storage/meta/.gitignore @@ -1,2 +1,2 @@ * -!.gitignore \ No newline at end of file +!.gitignore diff --git a/app/storage/sessions/.gitignore b/app/storage/sessions/.gitignore index c96a04f008..d6b7ef32c8 100644 --- a/app/storage/sessions/.gitignore +++ b/app/storage/sessions/.gitignore @@ -1,2 +1,2 @@ * -!.gitignore \ No newline at end of file +!.gitignore diff --git a/app/storage/views/.gitignore b/app/storage/views/.gitignore index c96a04f008..d6b7ef32c8 100644 --- a/app/storage/views/.gitignore +++ b/app/storage/views/.gitignore @@ -1,2 +1,2 @@ * -!.gitignore \ No newline at end of file +!.gitignore diff --git a/codeception.yml b/codeception.yml index c8dc7c62e3..1c64b071f9 100644 --- a/codeception.yml +++ b/codeception.yml @@ -19,4 +19,4 @@ coverage: - app/models/* - app/lib/FireflyIII/* exclude: - - app/controllers/BaseController.php \ No newline at end of file + - app/controllers/BaseController.php diff --git a/provider/assets/stylesheets/readme.txt b/provider/assets/stylesheets/readme.txt index d8f094f58d..cd3d23335f 100644 --- a/provider/assets/stylesheets/readme.txt +++ b/provider/assets/stylesheets/readme.txt @@ -1 +1 @@ -No vendor/provider stylesheets here at the moment. But this is where you could put things like twitter bootstrap, gumby, font awesome... \ No newline at end of file +No vendor/provider stylesheets here at the moment. But this is where you could put things like twitter bootstrap, gumby, font awesome... diff --git a/tests/acceptance.suite.yml b/tests/acceptance.suite.yml index 407ab416ff..601e703cd6 100644 --- a/tests/acceptance.suite.yml +++ b/tests/acceptance.suite.yml @@ -7,4 +7,4 @@ class_name: AcceptanceTester modules: enabled: - - AcceptanceHelper \ No newline at end of file + - AcceptanceHelper diff --git a/tests/functional.suite.yml b/tests/functional.suite.yml index db06c29796..d3effb537d 100644 --- a/tests/functional.suite.yml +++ b/tests/functional.suite.yml @@ -17,4 +17,4 @@ modules: dump: tests/_data/dump.sql Laravel4: environment: 'testing' - filters: false \ No newline at end of file + filters: false From da056092fb979fef330cca6c9d7f2ab9650200b2 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 2 Jan 2015 06:26:04 +0100 Subject: [PATCH 75/84] Code cleanup [skip ci] --- composer.lock | 2 +- phpunit.xml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/composer.lock b/composer.lock index e419de84ae..0cd57619c0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "3ac71ef711586f9c2bf7c36482284a13", + "hash": "0d6a322d9bcdb03029984f771d36f10f", "packages": [ { "name": "classpreloader/classpreloader", diff --git a/phpunit.xml b/phpunit.xml index e7253a467b..82d93aac97 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -37,5 +37,8 @@ ./app/tests/ + + ./tests/unit/ + From 0b2d423c87c4a4842350847b64b4a4f81a692f10 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 2 Jan 2015 06:26:57 +0100 Subject: [PATCH 76/84] Updated ignore file. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 0ca3cc6632..4224919aae 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,4 @@ pi.php tests/_data/db.sqlite tests/_data/dump.sql db.sqlite_snapshot +c3.php From 65ce277a201099c788c2ffa83ed63d44fa313f69 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 2 Jan 2015 08:59:16 +0100 Subject: [PATCH 77/84] Updated models [skip ci] --- app/models/Account.php | 12 +++++++----- app/models/Piggybank.php | 14 ++++++-------- app/models/PiggybankRepetition.php | 10 +++++----- app/models/Transaction.php | 2 +- app/models/TransactionJournal.php | 14 +++++++------- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/app/models/Account.php b/app/models/Account.php index a579ff862e..667aae069e 100644 --- a/app/models/Account.php +++ b/app/models/Account.php @@ -1,8 +1,10 @@ joinedAccountTypes)) { $query->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id'); @@ -78,9 +80,9 @@ class Account extends Eloquent /** * - * @param Builder $query + * @param EloquentBuilder $query */ - public function scopeWithMeta(Builder $query) + public function scopeWithMeta(EloquentBuilder $query) { $query->with(['accountmeta']); } diff --git a/app/models/Piggybank.php b/app/models/Piggybank.php index 55be709037..c3ba7e0054 100644 --- a/app/models/Piggybank.php +++ b/app/models/Piggybank.php @@ -3,7 +3,7 @@ use Carbon\Carbon; use Illuminate\Database\Eloquent\Model as Eloquent; use Illuminate\Database\Eloquent\SoftDeletingTrait; use Watson\Validating\ValidatingTrait; -use Illuminate\Database\Eloquent\Builder; +use Illuminate\Database\Eloquent\Builder as EloquentBuilder; /** * Class PiggyBank @@ -73,24 +73,23 @@ class PiggyBank extends Eloquent if ($this->repeats == 0) { $rep = $this->piggyBankRepetitions()->first(['piggy_bank_repetitions.*']); $this->currentRep = $rep; - \Log::debug('currentRelevantRep() reports $rep is null: ' . boolstr(is_null($rep))); return $rep; } else { $query = $this->piggyBankRepetitions()->where( - function (Builder $q) { + function (EloquentBuilder $q) { $q->where( - function (Builder $q) { + function (EloquentBuilder $q) { $q->where( - function (Builder $q) { + function (EloquentBuilder $q) { $today = new Carbon; $q->whereNull('startdate'); $q->orWhere('startdate', '<=', $today->format('Y-m-d 00:00:00')); } )->where( - function (Builder $q) { + function (EloquentBuilder $q) { $today = new Carbon; $q->whereNull('targetdate'); $q->orWhere('targetdate', '>=', $today->format('Y-m-d 00:00:00')); @@ -98,7 +97,7 @@ class PiggyBank extends Eloquent ); } )->orWhere( - function (Builder $q) { + function (EloquentBuilder $q) { $today = new Carbon; $q->where('startdate', '>=', $today->format('Y-m-d 00:00:00')); $q->where('targetdate', '>=', $today->format('Y-m-d 00:00:00')); @@ -108,7 +107,6 @@ class PiggyBank extends Eloquent } )->orderBy('startdate', 'ASC'); $result = $query->first(['piggy_bank_repetitions.*']); - \Log::debug('Result is null: ' . boolstr(is_null($result))); $this->currentRep = $result; \Log::debug('Found relevant rep in currentRelevantRep(): ' . $result->id); diff --git a/app/models/PiggybankRepetition.php b/app/models/PiggybankRepetition.php index a12a5b53a3..e38eabd4b4 100644 --- a/app/models/PiggybankRepetition.php +++ b/app/models/PiggybankRepetition.php @@ -1,6 +1,6 @@ where('startdate', $date->format('Y-m-d 00:00:00')); } /** - * @param Builder $query + * @param EloquentBuilder $query * @param Carbon $date */ - public function scopeTargets(Builder $query, Carbon $date) + public function scopeTargets(EloquentBuilder $query, Carbon $date) { $query->where('targetdate', $date->format('Y-m-d 00:00:00')); } diff --git a/app/models/Transaction.php b/app/models/Transaction.php index d641262004..c4a77ee917 100644 --- a/app/models/Transaction.php +++ b/app/models/Transaction.php @@ -1,7 +1,7 @@ joinedTransactions)) { $query->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id'); @@ -129,7 +129,7 @@ class TransactionJournal extends Eloquent * @param Builder $query * @param $amount */ - public function scopeLessThan(Builder $query, $amount) + public function scopeLessThan($query, $amount) { if (is_null($this->joinedTransactions)) { $query->leftJoin( @@ -145,7 +145,7 @@ class TransactionJournal extends Eloquent * @param Builder $query * @param $amount */ - public function scopeMoreThan(Builder $query, $amount) + public function scopeMoreThan($query, $amount) { if (is_null($this->joinedTransactions)) { $query->leftJoin( @@ -172,7 +172,7 @@ class TransactionJournal extends Eloquent * @param Builder $query * @param array $types */ - public function scopeTransactionTypes(Builder $query, array $types) + public function scopeTransactionTypes($query, array $types) { if (is_null($this->joinedTransactionTypes)) { $query->leftJoin( @@ -189,10 +189,10 @@ class TransactionJournal extends Eloquent * * @param $query */ - public function scopeWithRelevantData(Builder $query) + public function scopeWithRelevantData($query) { $query->with( - ['transactions' => function (Builder $q) { + ['transactions' => function (HasMany $q) { $q->orderBy('amount', 'ASC'); }, 'transactiontype', 'budgets','categories', 'transactions.account.accounttype', 'bill', 'budgets', 'categories'] ); From a6dbd912c6d7e9a1a8d299634e90131e94834a4d Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 2 Jan 2015 09:06:44 +0100 Subject: [PATCH 78/84] Code cleanup. --- README.md | 1 + app/controllers/PiggybankController.php | 8 +- app/controllers/TransactionController.php | 4 +- .../FireflyIII/Database/Account/Account.php | 17 +- app/lib/FireflyIII/Database/Budget/Budget.php | 3 +- .../TransactionCurrency.php | 2 - app/lib/FireflyIII/FF3ServiceProvider.php | 7 + app/lib/FireflyIII/Form/Form.php | 2 +- app/lib/FireflyIII/Report/Report.php | 2 +- app/lib/FireflyIII/Report/ReportQuery.php | 2 +- app/lib/FireflyIII/Search/Search.php | 6 +- app/lib/FireflyIII/Shared/Facade/Amount.php | 24 +++ app/lib/FireflyIII/Shared/Toolkit/Amount.php | 148 ++++++++++++++++ app/lib/FireflyIII/Shared/Toolkit/Steam.php | 19 +- app/models/Reminder.php | 12 +- app/models/Transaction.php | 26 +-- app/models/TransactionJournal.php | 78 ++++----- app/views/accounts/index.blade.php | 2 +- app/views/accounts/show.blade.php | 2 +- app/views/bills/show.blade.php | 4 +- app/views/budgets/index.blade.php | 14 +- app/views/budgets/show.blade.php | 4 +- app/views/categories/index.blade.php | 2 +- app/views/categories/show.blade.php | 2 +- app/views/index.blade.php | 2 +- app/views/list/accounts.blade.php | 2 +- app/views/list/bills.blade.php | 4 +- app/views/list/journals-full.blade.php | 6 +- app/views/list/journals-small.blade.php | 8 +- app/views/list/journals-tiny.blade.php | 4 +- app/views/list/piggy-bank-events.blade.php | 4 +- app/views/piggy_banks/add.blade.php | 2 +- app/views/piggy_banks/index.blade.php | 16 +- app/views/piggy_banks/remove.blade.php | 2 +- app/views/piggy_banks/show.blade.php | 8 +- app/views/reminders/show.blade.php | 4 +- app/views/repeatedExpense/index.blade.php | 6 +- app/views/repeatedExpense/show.blade.php | 4 +- app/views/reports/budget.blade.php | 36 ++-- app/views/reports/month.blade.php | 38 ++-- app/views/reports/year.blade.php | 26 +-- app/views/transactions/show.blade.php | 6 +- bootstrap/functions.php | 165 ------------------ tests/functional/ReminderControllerCest.php | 2 +- 44 files changed, 384 insertions(+), 352 deletions(-) create mode 100644 app/lib/FireflyIII/Shared/Facade/Amount.php create mode 100644 app/lib/FireflyIII/Shared/Toolkit/Amount.php diff --git a/README.md b/README.md index e61b574ee0..06fc100514 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ Firefly III [![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) [![Latest Stable Version](https://poser.pugx.org/grumpydictator/firefly-iii/v/stable.svg)](https://packagist.org/packages/grumpydictator/firefly-iii) [![Total Downloads](https://poser.pugx.org/grumpydictator/firefly-iii/downloads.svg)](https://packagist.org/packages/grumpydictator/firefly-iii) diff --git a/app/controllers/PiggybankController.php b/app/controllers/PiggybankController.php index 8bf024d9ef..58924755ae 100644 --- a/app/controllers/PiggybankController.php +++ b/app/controllers/PiggybankController.php @@ -199,9 +199,9 @@ class PiggyBankController extends BaseController */ Event::fire('piggy_bank.addMoney', [$piggyBank, $amount]); // new and used. - Session::flash('success', 'Added ' . mf($amount, false) . ' to "' . e($piggyBank->name) . '".'); + Session::flash('success', 'Added ' . Amount::format($amount, false) . ' to "' . e($piggyBank->name) . '".'); } else { - Session::flash('error', 'Could not add ' . mf($amount, false) . ' to "' . e($piggyBank->name) . '".'); + Session::flash('error', 'Could not add ' . Amount::format($amount, false) . ' to "' . e($piggyBank->name) . '".'); } return Redirect::route('piggy_banks.index'); @@ -228,9 +228,9 @@ class PiggyBankController extends BaseController */ Event::fire('piggy_bank.removeMoney', [$piggyBank, $amount]); // new and used. - Session::flash('success', 'Removed ' . mf($amount, false) . ' from "' . e($piggyBank->name) . '".'); + Session::flash('success', 'Removed ' . Amount::format($amount, false) . ' from "' . e($piggyBank->name) . '".'); } else { - Session::flash('error', 'Could not remove ' . mf($amount, false) . ' from "' . e($piggyBank->name) . '".'); + Session::flash('error', 'Could not remove ' . Amount::format($amount, false) . ' from "' . e($piggyBank->name) . '".'); } return Redirect::route('piggy_banks.index'); diff --git a/app/controllers/TransactionController.php b/app/controllers/TransactionController.php index da176b827d..167da8a6c0 100644 --- a/app/controllers/TransactionController.php +++ b/app/controllers/TransactionController.php @@ -69,7 +69,7 @@ class TransactionController extends BaseController $set = $this->_repository->getByIds($unique); $set->each( function (TransactionJournal $journal) { - $journal->amount = mf($journal->getAmount()); + $journal->amount = Amount::format($journal->getAmount()); } ); @@ -308,7 +308,7 @@ class TransactionController extends BaseController $result = $this->_repository->searchRelated($search, $journal); $result->each( function (TransactionJournal $j) { - $j->amount = mf($j->getAmount()); + $j->amount = Amount::format($j->getAmount()); } ); diff --git a/app/lib/FireflyIII/Database/Account/Account.php b/app/lib/FireflyIII/Database/Account/Account.php index e1ba05daa0..0cfa42dd03 100644 --- a/app/lib/FireflyIII/Database/Account/Account.php +++ b/app/lib/FireflyIII/Database/Account/Account.php @@ -7,11 +7,11 @@ use FireflyIII\Database\CommonDatabaseCallsInterface; use FireflyIII\Database\CUDInterface; use FireflyIII\Database\SwitchUser; use FireflyIII\Exception\NotImplementedException; -use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model as Eloquent; use Illuminate\Support\Collection; use Illuminate\Support\MessageBag; - +use Illuminate\Database\Query\Builder as QueryBuilder; +use Illuminate\Database\Eloquent\Builder as EloquentBuilder; /** * Class Account * @@ -223,20 +223,21 @@ class Account implements CUDInterface, CommonDatabaseCallsInterface, AccountInte public function destroy(Eloquent $model) { + // delete piggy banks // delete journals: $journals = \TransactionJournal::whereIn( - 'id', function (Builder $query) use ($model) { + 'id', function (QueryBuilder $query) use ($model) { $query->select('transaction_journal_id') ->from('transactions')->whereIn( - 'account_id', function (Builder $query) use ($model) { + 'account_id', function (QueryBuilder $query) use ($model) { $query ->select('id') ->from('accounts') ->where( - function (Builder $q) use ($model) { + function (QueryBuilder $q) use ($model) { $q->where('id', $model->id); $q->orWhere( - function (Builder $q) use ($model) { + function (QueryBuilder $q) use ($model) { $q->where('accounts.name', 'LIKE', '%' . $model->name . '%'); // TODO magic number! $q->where('accounts.account_type_id', 3); @@ -274,10 +275,10 @@ class Account implements CUDInterface, CommonDatabaseCallsInterface, AccountInte // delete accounts: \Account::where( - function (Builder $q) use ($model) { + function (EloquentBuilder $q) use ($model) { $q->where('id', $model->id); $q->orWhere( - function (Builder $q) use ($model) { + function (EloquentBuilder $q) use ($model) { $q->where('accounts.name', 'LIKE', '%' . $model->name . '%'); // TODO magic number! $q->where('accounts.account_type_id', 3); diff --git a/app/lib/FireflyIII/Database/Budget/Budget.php b/app/lib/FireflyIII/Database/Budget/Budget.php index f47f745b8f..770e703c1d 100644 --- a/app/lib/FireflyIII/Database/Budget/Budget.php +++ b/app/lib/FireflyIII/Database/Budget/Budget.php @@ -10,7 +10,7 @@ use FireflyIII\Exception\NotImplementedException; use Illuminate\Database\Eloquent\Model as Eloquent; use Illuminate\Support\Collection; use Illuminate\Support\MessageBag; -use Illuminate\Database\Eloquent\Builder; +use Illuminate\Database\Query\Builder; /** * Class Budget @@ -336,7 +336,6 @@ class Budget implements CUDInterface, CommonDatabaseCallsInterface, BudgetInterf $limit->repeat_freq = 'monthly'; $limit->repeats = 0; $result = $limit->save(); - \Log::info('Created new limit? ' . boolstr($result)); \Log::info('ID: ' . $limit->id); /* * A newly stored limit also created a limit repetition. diff --git a/app/lib/FireflyIII/Database/TransactionCurrency/TransactionCurrency.php b/app/lib/FireflyIII/Database/TransactionCurrency/TransactionCurrency.php index ff6cf9d12c..d85daa266c 100644 --- a/app/lib/FireflyIII/Database/TransactionCurrency/TransactionCurrency.php +++ b/app/lib/FireflyIII/Database/TransactionCurrency/TransactionCurrency.php @@ -35,7 +35,6 @@ class TransactionCurrency implements TransactionCurrencyInterface, CommonDatabas public function store(array $data) { $currency = new \TransactionCurrency($data); - \Log::debug('Is valid? ' . boolstr($currency->isValid())); $currency->save(); return $currency; @@ -52,7 +51,6 @@ class TransactionCurrency implements TransactionCurrencyInterface, CommonDatabas $model->symbol = $data['symbol']; $model->code = $data['code']; $model->name = $data['name']; - \Log::debug('Is valid? ' . boolstr($model->isValid())); $model->save(); return true; diff --git a/app/lib/FireflyIII/FF3ServiceProvider.php b/app/lib/FireflyIII/FF3ServiceProvider.php index 18ad6a4612..6495f65f51 100644 --- a/app/lib/FireflyIII/FF3ServiceProvider.php +++ b/app/lib/FireflyIII/FF3ServiceProvider.php @@ -7,6 +7,7 @@ use FireflyIII\Shared\Toolkit\Form; use FireflyIII\Shared\Toolkit\Navigation; use FireflyIII\Shared\Toolkit\Reminders; use FireflyIII\Shared\Toolkit\Steam; +use FireflyIII\Shared\Toolkit\Amount; use FireflyIII\Shared\Validation\FireflyValidator; use Illuminate\Foundation\AliasLoader; use Illuminate\Support\ServiceProvider; @@ -82,6 +83,11 @@ class FF3ServiceProvider extends ServiceProvider return new Steam; } ); + $this->app->bind( + 'amount', function () { + return new Amount; + } + ); } public function registerInterfaces() @@ -114,6 +120,7 @@ class FF3ServiceProvider extends ServiceProvider $loader->alias('Navigation', 'FireflyIII\Shared\Facade\Navigation'); $loader->alias('FFForm', 'FireflyIII\Shared\Facade\FFForm'); $loader->alias('Steam', 'FireflyIII\Shared\Facade\Steam'); + $loader->alias('Amount', 'FireflyIII\Shared\Facade\Amount'); } ); } diff --git a/app/lib/FireflyIII/Form/Form.php b/app/lib/FireflyIII/Form/Form.php index c44683a674..68409ab2df 100644 --- a/app/lib/FireflyIII/Form/Form.php +++ b/app/lib/FireflyIII/Form/Form.php @@ -123,7 +123,7 @@ class Form $html .= \Form::input('text', $name, $value, $options); break; case 'amount': - $html .= '
' . getCurrencySymbol() . '
'; + $html .= '
' . \Amount::getCurrencySymbol() . '
'; $html .= \Form::input('number', $name, $value, $options); $html .= '
'; break; diff --git a/app/lib/FireflyIII/Report/Report.php b/app/lib/FireflyIII/Report/Report.php index 3b012bcc1c..340179db5e 100644 --- a/app/lib/FireflyIII/Report/Report.php +++ b/app/lib/FireflyIII/Report/Report.php @@ -6,7 +6,7 @@ use Carbon\Carbon; use FireflyIII\Database\Account\Account as AccountRepository; use FireflyIII\Database\SwitchUser; use FireflyIII\Database\TransactionJournal\TransactionJournal as JournalRepository; -use Illuminate\Database\Eloquent\Builder; +use Illuminate\Database\Query\Builder; use Illuminate\Database\Query\JoinClause; use Illuminate\Support\Collection; diff --git a/app/lib/FireflyIII/Report/ReportQuery.php b/app/lib/FireflyIII/Report/ReportQuery.php index c224c80ea0..23d8113363 100644 --- a/app/lib/FireflyIII/Report/ReportQuery.php +++ b/app/lib/FireflyIII/Report/ReportQuery.php @@ -3,9 +3,9 @@ namespace FireflyIII\Report; use Carbon\Carbon; -use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Query\JoinClause; use Illuminate\Support\Collection; +use Illuminate\Database\Eloquent\Builder; /** * Class ReportQuery diff --git a/app/lib/FireflyIII/Search/Search.php b/app/lib/FireflyIII/Search/Search.php index 4324223d14..859d83b7b4 100644 --- a/app/lib/FireflyIII/Search/Search.php +++ b/app/lib/FireflyIII/Search/Search.php @@ -4,7 +4,7 @@ namespace FireflyIII\Search; use Illuminate\Support\Collection; -use Illuminate\Database\Eloquent\Builder; +use Illuminate\Database\Eloquent\Builder as EloquentBuilder; /** * Class Search @@ -21,7 +21,7 @@ class Search public function searchAccounts(array $words) { return \Auth::user()->accounts()->with('accounttype')->where( - function (Builder $q) use ($words) { + function (EloquentBuilder $q) use ($words) { foreach ($words as $word) { $q->orWhere('name', 'LIKE', '%' . e($word) . '%'); } @@ -97,7 +97,7 @@ class Search public function searchTransactions(array $words) { return \Auth::user()->transactionjournals()->withRelevantData()->where( - function (Builder $q) use ($words) { + function (EloquentBuilder $q) use ($words) { foreach ($words as $word) { $q->orWhere('description', 'LIKE', '%' . e($word) . '%'); } diff --git a/app/lib/FireflyIII/Shared/Facade/Amount.php b/app/lib/FireflyIII/Shared/Facade/Amount.php new file mode 100644 index 0000000000..4a3eb4dba4 --- /dev/null +++ b/app/lib/FireflyIII/Shared/Facade/Amount.php @@ -0,0 +1,24 @@ +getCurrencySymbol(); + + return $this->formatWithSymbol($currencySymbol, $amount, $coloured); + + + } + + /** + * @return string + */ + public function getCurrencySymbol() + { + if (defined('FFCURRENCYSYMBOL')) { + return FFCURRENCYSYMBOL; + } + if (\Cache::has('FFCURRENCYSYMBOL')) { + define('FFCURRENCYSYMBOL', \Cache::get('FFCURRENCYSYMBOL')); + + return FFCURRENCYSYMBOL; + } + + /** @var \FireflyIII\Database\TransactionCurrency\TransactionCurrency $currencies */ + $currencies = \App::make('FireflyIII\Database\TransactionCurrency\TransactionCurrency'); + + /** @var \FireflyIII\Shared\Preferences\Preferences $preferences */ + $preferences = \App::make('FireflyIII\Shared\Preferences\Preferences'); + + $currencyPreference = $preferences->get('currencyPreference', 'EUR'); + $currency = $currencies->findByCode($currencyPreference->data); + + \Cache::forever('FFCURRENCYSYMBOL', $currency->symbol); + + define('FFCURRENCYSYMBOL', $currency->symbol); + + return $currency->symbol; + } + + /** + * @param string $symbol + * @param float $amount + * @param bool $coloured + * + * @return string + */ + protected function formatWithSymbol($symbol, $amount, $coloured = true) + { + $amount = floatval($amount); + $amount = round($amount, 2); + $string = number_format($amount, 2, ',', '.'); + + if ($coloured === true) { + if ($amount === 0.0) { + return '' . $symbol . ' ' . $string . ''; + } + if ($amount > 0) { + return '' . $symbol . ' ' . $string . ''; + } + + return '' . $symbol . ' ' . $string . ''; + } + + // € + return $symbol . ' ' . $string; + } + + /** + * @param \TransactionJournal $journal + * @param float $amount + * @param bool $coloured + * + * @return string + */ + public function formatJournal(\TransactionJournal $journal, $amount, $coloured = true) + { + $symbol = $journal->transactionCurrency->symbol; + + return $this->formatWithSymbol($symbol, $amount, $coloured); + + + } + + /** + * @param \Transaction $transaction + * @param bool $coloured + * + * @return string + */ + public function formatTransaction(\Transaction $transaction, $coloured = true) + { + $symbol = $transaction->transactionJournal->transactionCurrency->symbol; + $amount = floatval($transaction->amount); + + return $this->formatWithSymbol($symbol, $amount, $coloured); + + + } + + /** + * @return string + */ + public function getCurrencyCode() + { + if (defined('FFCURRENCYCODE')) { + return FFCURRENCYCODE; + } + if (\Cache::has('FFCURRENCYCODE')) { + define('FFCURRENCYCODE', \Cache::get('FFCURRENCYCODE')); + + return FFCURRENCYCODE; + } + + /** @var \FireflyIII\Database\TransactionCurrency\TransactionCurrency $currencies */ + $currencies = \App::make('FireflyIII\Database\TransactionCurrency\TransactionCurrency'); + + /** @var \FireflyIII\Shared\Preferences\Preferences $preferences */ + $preferences = \App::make('FireflyIII\Shared\Preferences\Preferences'); + + $currencyPreference = $preferences->get('currencyPreference', 'EUR'); + $currency = $currencies->findByCode($currencyPreference->data); + + \Cache::forever('FFCURRENCYCODE', $currency->code); + + define('FFCURRENCYCODE', $currency->code); + + return $currency->code; + } + +} \ No newline at end of file diff --git a/app/lib/FireflyIII/Shared/Toolkit/Steam.php b/app/lib/FireflyIII/Shared/Toolkit/Steam.php index 4348456b4d..03f644bafc 100644 --- a/app/lib/FireflyIII/Shared/Toolkit/Steam.php +++ b/app/lib/FireflyIII/Shared/Toolkit/Steam.php @@ -25,7 +25,7 @@ class Steam */ public function balance(\Account $account, Carbon $date = null) { - $date = is_null($date) ? Carbon::now() : $date; + $date = is_null($date) ? Carbon::now() : $date; $balance = floatval( $account->transactions()->leftJoin( 'transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id' @@ -35,6 +35,23 @@ class Steam return $balance; } + /** + * @param $boolean + * + * @return string + */ + public function boolString($boolean) + { + if ($boolean === true) { + return 'BOOLEAN TRUE'; + } + if ($boolean === false) { + return 'BOOLEAN FALSE'; + } + + return 'NO BOOLEAN: ' . $boolean; + } + /** * @param \PiggyBank $piggyBank * @param \PiggyBankRepetition $repetition diff --git a/app/models/Reminder.php b/app/models/Reminder.php index 8ea1b8dddb..b9c7b326b8 100644 --- a/app/models/Reminder.php +++ b/app/models/Reminder.php @@ -1,8 +1,10 @@ where('startdate', $start->format('Y-m-d 00:00:00'))->where('enddate', $end->format('Y-m-d 00:00:00')); } diff --git a/app/models/Transaction.php b/app/models/Transaction.php index c4a77ee917..bb5c423bec 100644 --- a/app/models/Transaction.php +++ b/app/models/Transaction.php @@ -1,7 +1,7 @@ where('transactions.account_id', $account->id); } /** - * @param Builder $query + * @param EloquentBuilder $query * @param Carbon $date */ - public function scopeAfter(Builder $query, Carbon $date) + public function scopeAfter(EloquentBuilder $query, Carbon $date) { if (is_null($this->joinedJournals)) { $query->leftJoin( @@ -51,10 +51,10 @@ class Transaction extends Eloquent } /** - * @param Builder $query + * @param EloquentBuilder $query * @param Carbon $date */ - public function scopeBefore(Builder $query, Carbon $date) + public function scopeBefore(EloquentBuilder $query, Carbon $date) { if (is_null($this->joinedJournals)) { $query->leftJoin( @@ -66,28 +66,28 @@ class Transaction extends Eloquent } /** - * @param Builder $query + * @param EloquentBuilder $query * @param $amount */ - public function scopeLessThan(Builder $query, $amount) + public function scopeLessThan(EloquentBuilder $query, $amount) { $query->where('amount', '<', $amount); } /** - * @param Builder $query + * @param EloquentBuilder $query * @param $amount */ - public function scopeMoreThan(Builder $query, $amount) + public function scopeMoreThan(EloquentBuilder $query, $amount) { $query->where('amount', '>', $amount); } /** - * @param Builder $query + * @param EloquentBuilder $query * @param array $types */ - public function scopeTransactionTypes(Builder $query, array $types) + public function scopeTransactionTypes(EloquentBuilder $query, array $types) { if (is_null($this->joinedJournals)) { $query->leftJoin( diff --git a/app/models/TransactionJournal.php b/app/models/TransactionJournal.php index 66aa050a00..e39a8a4c81 100644 --- a/app/models/TransactionJournal.php +++ b/app/models/TransactionJournal.php @@ -1,10 +1,11 @@ 'required|exists:transaction_types,id', 'transaction_currency_id' => 'required|exists:transaction_currencies,id', 'description' => 'required|between:1,255', 'date' => 'required|date', 'completed' => 'required|between:0,1']; - protected $fillable - = ['transaction_type_id', 'transaction_currency_id', 'user_id', - 'description', 'date', 'completed']; + + /** + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function bill() + { + return $this->belongsTo('Bill'); + } /** * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany @@ -43,7 +52,6 @@ class TransactionJournal extends Eloquent ); } - /** * TODO remove this method in favour of something in the FireflyIII libraries. * @@ -83,18 +91,10 @@ class TransactionJournal extends Eloquent } /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + * @param EloquentBuilder $query + * @param Account $account */ - public function bill() - { - return $this->belongsTo('Bill'); - } - - /** - * @param Builder $query - * @param Account $account - */ - public function scopeAccountIs($query, \Account $account) + public function scopeAccountIs(EloquentBuilder $query, \Account $account) { if (!isset($this->joinedTransactions)) { $query->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id'); @@ -104,32 +104,32 @@ class TransactionJournal extends Eloquent } /** - * @param $query - * @param Carbon $date + * @param EloquentBuilder $query + * @param Carbon $date * * @return mixed */ - public function scopeAfter($query, Carbon $date) + public function scopeAfter(EloquentBuilder $query, Carbon $date) { return $query->where('transaction_journals.date', '>=', $date->format('Y-m-d 00:00:00')); } /** - * @param $query - * @param Carbon $date + * @param EloquentBuilder $query + * @param Carbon $date * * @return mixed */ - public function scopeBefore($query, Carbon $date) + public function scopeBefore(EloquentBuilder $query, Carbon $date) { return $query->where('transaction_journals.date', '<=', $date->format('Y-m-d 00:00:00')); } /** - * @param Builder $query - * @param $amount + * @param EloquentBuilder $query + * @param $amount */ - public function scopeLessThan($query, $amount) + public function scopeLessThan(EloquentBuilder $query, $amount) { if (is_null($this->joinedTransactions)) { $query->leftJoin( @@ -142,10 +142,10 @@ class TransactionJournal extends Eloquent } /** - * @param Builder $query - * @param $amount + * @param EloquentBuilder $query + * @param $amount */ - public function scopeMoreThan($query, $amount) + public function scopeMoreThan(EloquentBuilder $query, $amount) { if (is_null($this->joinedTransactions)) { $query->leftJoin( @@ -158,21 +158,21 @@ class TransactionJournal extends Eloquent } /** - * @param $query - * @param Carbon $date + * @param EloquentBuilder $query + * @param Carbon $date * * @return mixed */ - public function scopeOnDate($query, Carbon $date) + public function scopeOnDate(EloquentBuilder $query, Carbon $date) { return $query->where('date', '=', $date->format('Y-m-d')); } /** - * @param Builder $query - * @param array $types + * @param EloquentBuilder $query + * @param array $types */ - public function scopeTransactionTypes($query, array $types) + public function scopeTransactionTypes(EloquentBuilder $query, array $types) { if (is_null($this->joinedTransactionTypes)) { $query->leftJoin( @@ -187,14 +187,14 @@ class TransactionJournal extends Eloquent * Automatically includes the 'with' parameters to get relevant related * objects. * - * @param $query + * @param EloquentBuilder $query */ - public function scopeWithRelevantData($query) + public function scopeWithRelevantData(EloquentBuilder $query) { $query->with( - ['transactions' => function (HasMany $q) { + ['transactions' => function (HasMany $q) { $q->orderBy('amount', 'ASC'); - }, 'transactiontype', 'budgets','categories', 'transactions.account.accounttype', 'bill', 'budgets', 'categories'] + }, 'transactiontype', 'budgets', 'categories', 'transactions.account.accounttype', 'bill', 'budgets', 'categories'] ); } diff --git a/app/views/accounts/index.blade.php b/app/views/accounts/index.blade.php index 69fb63340e..e837940541 100644 --- a/app/views/accounts/index.blade.php +++ b/app/views/accounts/index.blade.php @@ -30,7 +30,7 @@ @section('scripts') diff --git a/app/views/accounts/show.blade.php b/app/views/accounts/show.blade.php index 87297603f8..e5b4fc9e04 100644 --- a/app/views/accounts/show.blade.php +++ b/app/views/accounts/show.blade.php @@ -52,7 +52,7 @@ diff --git a/app/views/bills/show.blade.php b/app/views/bills/show.blade.php index 023b3dd515..b4ad8d9e1e 100644 --- a/app/views/bills/show.blade.php +++ b/app/views/bills/show.blade.php @@ -42,7 +42,7 @@ @foreach(explode(',',$bill->match) as $word) {{{$word}}} @endforeach - between {{mf($bill->amount_min)}} and {{mf($bill->amount_max)}}. + between {{Amount::format($bill->amount_min)}} and {{Amount::format($bill->amount_max)}}. Repeats {{$bill->repeat_freq}}. @@ -106,7 +106,7 @@ @section('scripts') diff --git a/app/views/budgets/index.blade.php b/app/views/budgets/index.blade.php index 556a6fc6f1..2b5f62be48 100644 --- a/app/views/budgets/index.blade.php +++ b/app/views/budgets/index.blade.php @@ -10,11 +10,11 @@
- Budgeted: {{mf(300)}} + Budgeted: {{Amount::format(300)}}
Income {{\Session::get('start', \Carbon\Carbon::now()->startOfMonth())->format('F Y')}}: - {{mf($amount)}} + {{Amount::format($amount)}}
@@ -29,7 +29,7 @@
- Spent: {{mf($spent)}} + Spent: {{Amount::format($spent)}}
@@ -100,21 +100,21 @@ @if($budget->currentRep->amount > $budget->spent) - {{getCurrencySymbol()}} + {{Amount::getCurrencySymbol()}} @else - {{getCurrencySymbol()}} + {{Amount::getCurrencySymbol()}} @endif @else No budget - + @endif

- Spent: {{mf($budget->spent)}} + Spent: {{Amount::format($budget->spent)}}

diff --git a/app/views/budgets/show.blade.php b/app/views/budgets/show.blade.php index 4b4d983082..b6c35c646d 100644 --- a/app/views/budgets/show.blade.php +++ b/app/views/budgets/show.blade.php @@ -29,10 +29,10 @@
- Amount: {{mf($rep->amount)}} + Amount: {{Amount::format($rep->amount)}}
- Spent: {{mf($rep->spentInRepetition())}} + Spent: {{Amount::format($rep->spentInRepetition())}}
diff --git a/app/views/categories/index.blade.php b/app/views/categories/index.blade.php index e9ed09213e..3c176f36b6 100644 --- a/app/views/categories/index.blade.php +++ b/app/views/categories/index.blade.php @@ -29,7 +29,7 @@ @stop @section('scripts') diff --git a/app/views/categories/show.blade.php b/app/views/categories/show.blade.php index 66e091427d..37fa8d0e2d 100644 --- a/app/views/categories/show.blade.php +++ b/app/views/categories/show.blade.php @@ -32,7 +32,7 @@ diff --git a/app/views/index.blade.php b/app/views/index.blade.php index 68bf2afa13..22520f85b5 100644 --- a/app/views/index.blade.php +++ b/app/views/index.blade.php @@ -114,7 +114,7 @@ @stop @section('scripts') diff --git a/app/views/list/accounts.blade.php b/app/views/list/accounts.blade.php index 4ccf4f36eb..84f88bdfcc 100644 --- a/app/views/list/accounts.blade.php +++ b/app/views/list/accounts.blade.php @@ -17,7 +17,7 @@ {{{$account->name}}} {{{$account->accountRole}}} - {{mf(Steam::balance($account))}} + {{Amount::format(Steam::balance($account))}} @if($account->active) diff --git a/app/views/list/bills.blade.php b/app/views/list/bills.blade.php index 70c7989d84..a603bd9617 100644 --- a/app/views/list/bills.blade.php +++ b/app/views/list/bills.blade.php @@ -27,9 +27,9 @@ @endforeach - {{mf($entry->amount_min)}} + {{Amount::format($entry->amount_min)}} — - {{mf($entry->amount_max)}} + {{Amount::format($entry->amount_max)}} lastFoundMatch();?> diff --git a/app/views/list/journals-full.blade.php b/app/views/list/journals-full.blade.php index e5982e24ae..4979b6a428 100644 --- a/app/views/list/journals-full.blade.php +++ b/app/views/list/journals-full.blade.php @@ -58,13 +58,13 @@ @if($journal->transactiontype->type == 'Withdrawal') - {{mft($journal->transactions[1],false)}} + {{Amount::formatTransaction($journal->transactions[1],false)}} @endif @if($journal->transactiontype->type == 'Deposit') - {{mft($journal->transactions[1],false)}} + {{Amount::formatTransaction($journal->transactions[1],false)}} @endif @if($journal->transactiontype->type == 'Transfer') - {{mft($journal->transactions[1],false)}} + {{Amount::formatTransaction($journal->transactions[1],false)}} @endif diff --git a/app/views/list/journals-small.blade.php b/app/views/list/journals-small.blade.php index 113b4224a7..9bf33f4b0b 100644 --- a/app/views/list/journals-small.blade.php +++ b/app/views/list/journals-small.blade.php @@ -9,13 +9,13 @@ transactions[1]->amount);?> @if($journal->transactiontype->type == 'Withdrawal') - {{mft($journal->transactions[1],false)}} + {{Amount::formatTransaction($journal->transactions[1],false)}} @endif @if($journal->transactiontype->type == 'Deposit') - {{mft($journal->transactions[1],false)}} + {{Amount::formatTransaction($journal->transactions[1],false)}} @endif @if($journal->transactiontype->type == 'Transfer') - {{mft($journal->transactions[1],false)}} + {{Amount::formatTransaction($journal->transactions[1],false)}} @endif @@ -33,7 +33,7 @@ @if(isset($displaySum) && $displaySum === true) Sum - {{mf($tableSum)}} + {{Amount::format($tableSum)}} @endif diff --git a/app/views/list/journals-tiny.blade.php b/app/views/list/journals-tiny.blade.php index c4380ca00c..9987e28ae4 100644 --- a/app/views/list/journals-tiny.blade.php +++ b/app/views/list/journals-tiny.blade.php @@ -18,13 +18,13 @@ @if(isset($account)) @foreach($journal->transactions as $index => $t) @if($t->account_id == $account->id) - {{mft($t)}} + {{Amount::formatTransaction($t)}} @endif @endforeach @else @foreach($journal->transactions as $index => $t) @if($index == 0) - {{mft($t)}} + {{Amount::formatTransaction($t)}} @endif @endforeach @endif diff --git a/app/views/list/piggy-bank-events.blade.php b/app/views/list/piggy-bank-events.blade.php index bbd39d9798..e7527ed54e 100644 --- a/app/views/list/piggy-bank-events.blade.php +++ b/app/views/list/piggy-bank-events.blade.php @@ -23,9 +23,9 @@ @if($event->amount < 0) - Removed {{mf($event->amount*-1,false)}} + Removed {{Amount::format($event->amount*-1,false)}} @else - Added {{mf($event->amount,false)}} + Added {{Amount::format($event->amount,false)}} @endif diff --git a/app/views/piggy_banks/add.blade.php b/app/views/piggy_banks/add.blade.php index f9680880e7..b9ee7be0d0 100644 --- a/app/views/piggy_banks/add.blade.php +++ b/app/views/piggy_banks/add.blade.php @@ -8,7 +8,7 @@
@@ -109,11 +109,11 @@ @foreach($accounts as $id => $info) {{{$info['name']}}} - {{mf($info['balance'])}} - {{mf($info['leftForPiggyBanks'])}} - {{mf($info['sumOfTargets'])}} - {{mf($info['sumOfSaved'])}} - {{mf($info['leftToSave'])}} + {{Amount::format($info['balance'])}} + {{Amount::format($info['leftForPiggyBanks'])}} + {{Amount::format($info['sumOfTargets'])}} + {{Amount::format($info['sumOfSaved'])}} + {{Amount::format($info['leftToSave'])}} @endforeach diff --git a/app/views/piggy_banks/remove.blade.php b/app/views/piggy_banks/remove.blade.php index 4d157a8287..90129fecc6 100644 --- a/app/views/piggy_banks/remove.blade.php +++ b/app/views/piggy_banks/remove.blade.php @@ -8,7 +8,7 @@
@@ -149,16 +149,16 @@ ?> {{{$account['name']}}} - {{mf($account['startBalance'])}} - {{mf($account['endBalance'])}} - {{mf($account['difference'])}} + {{Amount::format($account['startBalance'])}} + {{Amount::format($account['endBalance'])}} + {{Amount::format($account['difference'])}} @endforeach Sum - {{mf($sumStart)}} - {{mf($sumEnd)}} - {{mf($sumDiff)}} + {{Amount::format($sumStart)}} + {{Amount::format($sumEnd)}} + {{Amount::format($sumDiff)}} diff --git a/app/views/reports/year.blade.php b/app/views/reports/year.blade.php index 10a332bf67..2911af39fa 100644 --- a/app/views/reports/year.blade.php +++ b/app/views/reports/year.blade.php @@ -49,16 +49,16 @@ shared @endif - {{mf($balance['start'])}} - {{mf($balance['end'])}} - {{mf($balance['end']-$balance['start'])}} + {{Amount::format($balance['start'])}} + {{Amount::format($balance['end'])}} + {{Amount::format($balance['end']-$balance['start'])}} @endforeach Sum of sums - {{mf($start)}} - {{mf($end)}} - {{mf($diff)}} + {{Amount::format($start)}} + {{Amount::format($end)}} + {{Amount::format($diff)}} @@ -83,15 +83,15 @@ - + - + - +
In{{mf($incomeSum)}}{{Amount::format($incomeSum)}}
Out{{mf($expenseSum*-1)}}{{Amount::format($expenseSum*-1)}}
Difference{{mf($incomeSum - $expenseSum)}}{{Amount::format($incomeSum - $expenseSum)}}
@@ -107,12 +107,12 @@ sum)*-1;?> {{{$income->name}}} - {{mf(floatval($income->sum)*-1)}} + {{Amount::format(floatval($income->sum)*-1)}} @endforeach Sum - {{mf($sum)}} + {{Amount::format($sum)}} @@ -126,7 +126,7 @@ @foreach($groupedExpenses as $id => $expense) {{{$expense['name']}}} - {{mf(floatval($expense['amount'])*-1)}} + {{Amount::format(floatval($expense['amount'])*-1)}} @endforeach @@ -156,7 +156,7 @@ {{HTML::script('assets/javascript/firefly/reports.js')}} diff --git a/app/views/transactions/show.blade.php b/app/views/transactions/show.blade.php index a6b7446b21..2bdc086cf1 100644 --- a/app/views/transactions/show.blade.php +++ b/app/views/transactions/show.blade.php @@ -74,7 +74,7 @@ {{{$jrnl->description}}} - {{mfj($jrnl, $jrnl->getAmount())}} + {{Amount::formatJournal($jrnl, $jrnl->getAmount())}} @endforeach @@ -97,11 +97,11 @@ - + - + @if(!is_null($t->description)) diff --git a/bootstrap/functions.php b/bootstrap/functions.php index 69c13d834b..b3d9bbc7f3 100644 --- a/bootstrap/functions.php +++ b/bootstrap/functions.php @@ -1,166 +1 @@ transactionJournal->transactionCurrency->symbol; - $amount = floatval($transaction->amount); - - return mfc($symbol, $amount, $coloured); - - - } -} - -if (!function_exists('mfj')) { - /** - * @param \TransactionJournal $journal - * @param float $amount - * @param bool $coloured - * - * @return string - */ - function mfj(\TransactionJournal $journal, $amount, $coloured = true) - { - $symbol = $journal->transactionCurrency->symbol; - - return mfc($symbol, $amount, $coloured); - - - } -} - -if (!function_exists('mfc')) { - /** - * @param string $symbol - * @param float $amount - * @param bool $coloured - * - * @return string - */ - function mfc($symbol, $amount, $coloured = true) - { - $amount = floatval($amount); - $amount = round($amount, 2); - $string = number_format($amount, 2, ',', '.'); - - if ($coloured === true) { - if ($amount === 0.0) { - return '' . $symbol . ' ' . $string . ''; - } - if ($amount > 0) { - return '' . $symbol . ' ' . $string . ''; - } - - return '' . $symbol . ' ' . $string . ''; - } - - // € - return $symbol . ' ' . $string; - } -} - -if (!function_exists('getCurrencySymbol')) { - /** - * @return string - */ - function getCurrencySymbol() - { - if (defined('FFCURRENCYSYMBOL')) { - return FFCURRENCYSYMBOL; - } - if (Cache::has('FFCURRENCYSYMBOL')) { - define('FFCURRENCYSYMBOL', Cache::get('FFCURRENCYSYMBOL')); - - return FFCURRENCYSYMBOL; - } - - /** @var \FireflyIII\Database\TransactionCurrency\TransactionCurrency $currencies */ - $currencies = App::make('FireflyIII\Database\TransactionCurrency\TransactionCurrency'); - - /** @var \FireflyIII\Shared\Preferences\Preferences $preferences */ - $preferences = App::make('FireflyIII\Shared\Preferences\Preferences'); - - $currencyPreference = $preferences->get('currencyPreference', 'EUR'); - $currency = $currencies->findByCode($currencyPreference->data); - - Cache::forever('FFCURRENCYSYMBOL', $currency->symbol); - - define('FFCURRENCYSYMBOL', $currency->symbol); - - return $currency->symbol; - } -} - -if (!function_exists('getCurrencyCode')) { - /** - * @return string - */ - function getCurrencyCode() - { - if (defined('FFCURRENCYCODE')) { - return FFCURRENCYCODE; - } - if (Cache::has('FFCURRENCYCODE')) { - define('FFCURRENCYCODE', Cache::get('FFCURRENCYCODE')); - - return FFCURRENCYCODE; - } - - /** @var \FireflyIII\Database\TransactionCurrency\TransactionCurrency $currencies */ - $currencies = App::make('FireflyIII\Database\TransactionCurrency\TransactionCurrency'); - - /** @var \FireflyIII\Shared\Preferences\Preferences $preferences */ - $preferences = App::make('FireflyIII\Shared\Preferences\Preferences'); - - $currencyPreference = $preferences->get('currencyPreference', 'EUR'); - $currency = $currencies->findByCode($currencyPreference->data); - - Cache::forever('FFCURRENCYCODE', $currency->code); - - define('FFCURRENCYCODE', $currency->code); - - return $currency->code; - } -} - -if (!function_exists('boolstr')) { - /** - * @param $boolean - * - * @return string - */ - function boolstr($boolean) - { - if (is_bool($boolean) && $boolean === true) { - return 'BOOLEAN TRUE'; - } - if (is_bool($boolean) && $boolean === false) { - return 'BOOLEAN FALSE'; - } - - return 'NO BOOLEAN: ' . $boolean; - } -} diff --git a/tests/functional/ReminderControllerCest.php b/tests/functional/ReminderControllerCest.php index 01901b2cb5..139e4e279b 100644 --- a/tests/functional/ReminderControllerCest.php +++ b/tests/functional/ReminderControllerCest.php @@ -33,7 +33,7 @@ class ReminderControllerCest ['reminders.*'] ); - $I->wantTo('act on reminder ' . boolstr(is_null($reminder))); + $I->wantTo('act on a reminder'); $I->amOnPage('/reminders/' . $reminder->id . '/act'); $I->see('Money for Nieuwe spullen'); } From fb58bf1bf518e7c82cc59871cfa53d2bef492ee1 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 2 Jan 2015 10:01:33 +0100 Subject: [PATCH 79/84] Cleaned up some todo entries [skip ci] --- app/controllers/BudgetController.php | 1 - app/controllers/GoogleChartController.php | 6 - .../Database/AccountType/AccountType.php | 7 - app/lib/FireflyIII/Database/Bill/Bill.php | 3 - app/lib/FireflyIII/Database/Budget/Budget.php | 4 +- .../FireflyIII/Database/Category/Category.php | 3 - .../Database/PiggyBank/PiggyBankShared.php | 1 - .../Database/Transaction/Transaction.php | 6 - .../TransactionCurrency.php | 3 - .../TransactionJournal/TransactionJournal.php | 1 - .../TransactionType/TransactionType.php | 7 - app/lib/FireflyIII/Report/Report.php | 2 - app/lib/FireflyIII/Shared/Toolkit/Amount.php | 2 +- app/tests/PiggybankPartTest.php | 222 ------------------ app/views/repeatedExpense/index.blade.php | 1 - bootstrap/start.php | 2 +- 16 files changed, 3 insertions(+), 268 deletions(-) delete mode 100644 app/tests/PiggybankPartTest.php diff --git a/app/controllers/BudgetController.php b/app/controllers/BudgetController.php index 4d48ce1e8f..c2888d1eab 100644 --- a/app/controllers/BudgetController.php +++ b/app/controllers/BudgetController.php @@ -99,7 +99,6 @@ class BudgetController extends BaseController /** * The index of the budget controller contains all budgets and the current relevant limit repetition. - * TODO move currentRep to the repository. * * @return $this */ diff --git a/app/controllers/GoogleChartController.php b/app/controllers/GoogleChartController.php index aadfc8e5a3..8edd0fe797 100644 --- a/app/controllers/GoogleChartController.php +++ b/app/controllers/GoogleChartController.php @@ -225,7 +225,6 @@ class GoogleChartController extends BaseController } /** - * TODO query move to helper. * * @return \Illuminate\Http\JsonResponse * @throws \FireflyIII\Exception\FireflyException @@ -256,7 +255,6 @@ class GoogleChartController extends BaseController } /** - * TODO still in use? * * @param Budget $budget * @param LimitRepetition $repetition @@ -290,7 +288,6 @@ class GoogleChartController extends BaseController } /** - * TODO still in use? * * @param Budget $budget * @param $year @@ -341,7 +338,6 @@ class GoogleChartController extends BaseController } /** - * TODO still in use? * * @param Category $component * @param $year @@ -407,7 +403,6 @@ class GoogleChartController extends BaseController } /** - * TODO see reports for better way to do this. * * @param $year * @@ -447,7 +442,6 @@ class GoogleChartController extends BaseController } /** - * TODO see reports for better way to do this. * * @param $year * diff --git a/app/lib/FireflyIII/Database/AccountType/AccountType.php b/app/lib/FireflyIII/Database/AccountType/AccountType.php index a2ec514338..58f6cebb13 100644 --- a/app/lib/FireflyIII/Database/AccountType/AccountType.php +++ b/app/lib/FireflyIII/Database/AccountType/AccountType.php @@ -25,7 +25,6 @@ class AccountType implements CUDInterface, CommonDatabaseCallsInterface */ public function destroy(Eloquent $model) { - // TODO: Implement destroy() method. throw new NotImplementedException; } @@ -37,7 +36,6 @@ class AccountType implements CUDInterface, CommonDatabaseCallsInterface */ public function store(array $data) { - // TODO: Implement store() method. throw new NotImplementedException; } @@ -50,7 +48,6 @@ class AccountType implements CUDInterface, CommonDatabaseCallsInterface */ public function update(Eloquent $model, array $data) { - // TODO: Implement update() method. throw new NotImplementedException; } @@ -65,7 +62,6 @@ class AccountType implements CUDInterface, CommonDatabaseCallsInterface */ public function validate(array $model) { - // TODO: Implement validate() method. throw new NotImplementedException; } @@ -79,7 +75,6 @@ class AccountType implements CUDInterface, CommonDatabaseCallsInterface */ public function find($objectId) { - // TODO: Implement find() method. throw new NotImplementedException; } @@ -124,7 +119,6 @@ class AccountType implements CUDInterface, CommonDatabaseCallsInterface */ public function get() { - // TODO: Implement get() method. throw new NotImplementedException; } @@ -136,7 +130,6 @@ class AccountType implements CUDInterface, CommonDatabaseCallsInterface */ public function getByIds(array $ids) { - // TODO: Implement getByIds() method. throw new NotImplementedException; } } diff --git a/app/lib/FireflyIII/Database/Bill/Bill.php b/app/lib/FireflyIII/Database/Bill/Bill.php index 22bc2f2ea0..65133d8441 100644 --- a/app/lib/FireflyIII/Database/Bill/Bill.php +++ b/app/lib/FireflyIII/Database/Bill/Bill.php @@ -142,7 +142,6 @@ class Bill implements CUDInterface, CommonDatabaseCallsInterface, BillInterface */ public function find($objectId) { - // TODO: Implement find() method. throw new NotImplementedException; } @@ -156,7 +155,6 @@ class Bill implements CUDInterface, CommonDatabaseCallsInterface, BillInterface */ public function findByWhat($what) { - // TODO: Implement findByWhat() method. throw new NotImplementedException; } @@ -178,7 +176,6 @@ class Bill implements CUDInterface, CommonDatabaseCallsInterface, BillInterface */ public function getByIds(array $ids) { - // TODO: Implement getByIds() method. throw new NotImplementedException; } diff --git a/app/lib/FireflyIII/Database/Budget/Budget.php b/app/lib/FireflyIII/Database/Budget/Budget.php index 770e703c1d..070a39adc2 100644 --- a/app/lib/FireflyIII/Database/Budget/Budget.php +++ b/app/lib/FireflyIII/Database/Budget/Budget.php @@ -119,7 +119,6 @@ class Budget implements CUDInterface, CommonDatabaseCallsInterface, BudgetInterf */ public function findByWhat($what) { - // TODO: Implement findByWhat() method. throw new NotImplementedException; } @@ -143,7 +142,6 @@ class Budget implements CUDInterface, CommonDatabaseCallsInterface, BudgetInterf */ public function getByIds(array $ids) { - // TODO: Implement getByIds() method. throw new NotImplementedException; } @@ -335,7 +333,7 @@ class Budget implements CUDInterface, CommonDatabaseCallsInterface, BudgetInterf $limit->amount = $amount; $limit->repeat_freq = 'monthly'; $limit->repeats = 0; - $result = $limit->save(); + $limit->save(); \Log::info('ID: ' . $limit->id); /* * A newly stored limit also created a limit repetition. diff --git a/app/lib/FireflyIII/Database/Category/Category.php b/app/lib/FireflyIII/Database/Category/Category.php index a8d1ef3a37..a928c2d34e 100644 --- a/app/lib/FireflyIII/Database/Category/Category.php +++ b/app/lib/FireflyIII/Database/Category/Category.php @@ -108,7 +108,6 @@ class Category implements CUDInterface, CommonDatabaseCallsInterface */ public function find($objectId) { - // TODO: Implement find() method. throw new NotImplementedException; } @@ -122,7 +121,6 @@ class Category implements CUDInterface, CommonDatabaseCallsInterface */ public function findByWhat($what) { - // TODO: Implement findByWhat() method. throw new NotImplementedException; } @@ -144,7 +142,6 @@ class Category implements CUDInterface, CommonDatabaseCallsInterface */ public function getByIds(array $ids) { - // TODO: Implement getByIds() method. throw new NotImplementedException; } diff --git a/app/lib/FireflyIII/Database/PiggyBank/PiggyBankShared.php b/app/lib/FireflyIII/Database/PiggyBank/PiggyBankShared.php index e4be2c7bf5..5a878e37f4 100644 --- a/app/lib/FireflyIII/Database/PiggyBank/PiggyBankShared.php +++ b/app/lib/FireflyIII/Database/PiggyBank/PiggyBankShared.php @@ -67,7 +67,6 @@ class PiggyBankShared */ public function findByWhat($what) { - // TODO: Implement findByWhat() method. throw new NotImplementedException; } diff --git a/app/lib/FireflyIII/Database/Transaction/Transaction.php b/app/lib/FireflyIII/Database/Transaction/Transaction.php index 7b3823b93c..a92f110d2e 100644 --- a/app/lib/FireflyIII/Database/Transaction/Transaction.php +++ b/app/lib/FireflyIII/Database/Transaction/Transaction.php @@ -28,7 +28,6 @@ class Transaction implements CUDInterface, CommonDatabaseCallsInterface */ public function destroy(Eloquent $model) { - // TODO: Implement destroy() method. throw new NotImplementedException; } @@ -68,7 +67,6 @@ class Transaction implements CUDInterface, CommonDatabaseCallsInterface */ public function update(Eloquent $model, array $data) { - // TODO: Implement update() method. throw new NotImplementedException; } @@ -103,7 +101,6 @@ class Transaction implements CUDInterface, CommonDatabaseCallsInterface */ public function find($objectId) { - // TODO: Implement find() method. throw new NotImplementedException; } @@ -117,7 +114,6 @@ class Transaction implements CUDInterface, CommonDatabaseCallsInterface */ public function findByWhat($what) { - // TODO: Implement findByWhat() method. throw new NotImplementedException; } @@ -129,7 +125,6 @@ class Transaction implements CUDInterface, CommonDatabaseCallsInterface */ public function get() { - // TODO: Implement get() method. throw new NotImplementedException; } @@ -141,7 +136,6 @@ class Transaction implements CUDInterface, CommonDatabaseCallsInterface */ public function getByIds(array $ids) { - // TODO: Implement getByIds() method. throw new NotImplementedException; } } diff --git a/app/lib/FireflyIII/Database/TransactionCurrency/TransactionCurrency.php b/app/lib/FireflyIII/Database/TransactionCurrency/TransactionCurrency.php index d85daa266c..55b7c5f502 100644 --- a/app/lib/FireflyIII/Database/TransactionCurrency/TransactionCurrency.php +++ b/app/lib/FireflyIII/Database/TransactionCurrency/TransactionCurrency.php @@ -98,7 +98,6 @@ class TransactionCurrency implements TransactionCurrencyInterface, CommonDatabas */ public function find($objectId) { - // TODO: Implement find() method. throw new NotImplementedException; } @@ -112,7 +111,6 @@ class TransactionCurrency implements TransactionCurrencyInterface, CommonDatabas */ public function findByWhat($what) { - // TODO: Implement findByWhat() method. throw new NotImplementedException; } @@ -134,7 +132,6 @@ class TransactionCurrency implements TransactionCurrencyInterface, CommonDatabas */ public function getByIds(array $objectIds) { - // TODO: Implement getByIds() method. throw new NotImplementedException; } diff --git a/app/lib/FireflyIII/Database/TransactionJournal/TransactionJournal.php b/app/lib/FireflyIII/Database/TransactionJournal/TransactionJournal.php index a10ba47570..73bc4e3877 100644 --- a/app/lib/FireflyIII/Database/TransactionJournal/TransactionJournal.php +++ b/app/lib/FireflyIII/Database/TransactionJournal/TransactionJournal.php @@ -390,7 +390,6 @@ class TransactionJournal implements TransactionJournalInterface, CUDInterface, C */ public function findByWhat($what) { - // TODO: Implement findByWhat() method. throw new NotImplementedException; } diff --git a/app/lib/FireflyIII/Database/TransactionType/TransactionType.php b/app/lib/FireflyIII/Database/TransactionType/TransactionType.php index 8312e08a2a..b3b5191de4 100644 --- a/app/lib/FireflyIII/Database/TransactionType/TransactionType.php +++ b/app/lib/FireflyIII/Database/TransactionType/TransactionType.php @@ -27,7 +27,6 @@ class TransactionType implements CUDInterface, CommonDatabaseCallsInterface */ public function destroy(Eloquent $model) { - // TODO: Implement destroy() method. throw new NotImplementedException; } @@ -39,7 +38,6 @@ class TransactionType implements CUDInterface, CommonDatabaseCallsInterface */ public function store(array $data) { - // TODO: Implement store() method. throw new NotImplementedException; } @@ -52,7 +50,6 @@ class TransactionType implements CUDInterface, CommonDatabaseCallsInterface */ public function update(Eloquent $model, array $data) { - // TODO: Implement update() method. throw new NotImplementedException; } @@ -67,7 +64,6 @@ class TransactionType implements CUDInterface, CommonDatabaseCallsInterface */ public function validate(array $model) { - // TODO: Implement validate() method. throw new NotImplementedException; } @@ -81,7 +77,6 @@ class TransactionType implements CUDInterface, CommonDatabaseCallsInterface */ public function find($objectId) { - // TODO: Implement find() method. throw new NotImplementedException; } @@ -115,7 +110,6 @@ class TransactionType implements CUDInterface, CommonDatabaseCallsInterface */ public function get() { - // TODO: Implement get() method. throw new NotImplementedException; } @@ -127,7 +121,6 @@ class TransactionType implements CUDInterface, CommonDatabaseCallsInterface */ public function getByIds(array $ids) { - // TODO: Implement getByIds() method. throw new NotImplementedException; } } diff --git a/app/lib/FireflyIII/Report/Report.php b/app/lib/FireflyIII/Report/Report.php index 340179db5e..a032068318 100644 --- a/app/lib/FireflyIII/Report/Report.php +++ b/app/lib/FireflyIII/Report/Report.php @@ -10,8 +10,6 @@ use Illuminate\Database\Query\Builder; use Illuminate\Database\Query\JoinClause; use Illuminate\Support\Collection; -// todo add methods to interface - /** * Class Report * diff --git a/app/lib/FireflyIII/Shared/Toolkit/Amount.php b/app/lib/FireflyIII/Shared/Toolkit/Amount.php index a419a6b993..39a1db073b 100644 --- a/app/lib/FireflyIII/Shared/Toolkit/Amount.php +++ b/app/lib/FireflyIII/Shared/Toolkit/Amount.php @@ -145,4 +145,4 @@ class Amount return $currency->code; } -} \ No newline at end of file +} diff --git a/app/tests/PiggybankPartTest.php b/app/tests/PiggybankPartTest.php deleted file mode 100644 index 5e98b7f5e4..0000000000 --- a/app/tests/PiggybankPartTest.php +++ /dev/null @@ -1,222 +0,0 @@ -object = new PiggyBankPart; - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() - { - } - - /** - * @covers FireflyIII\Collection\PiggyBankPart::getReminder - * @todo Implement testGetReminder(). - */ - public function testGetReminder() - { - $this->object->getReminder(); - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers FireflyIII\Collection\PiggyBankPart::setReminder - * @todo Implement testSetReminder(). - */ - public function testSetReminder() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers FireflyIII\Collection\PiggyBankPart::getStartdate - * @todo Implement testGetStartdate(). - */ - public function testGetStartdate() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers FireflyIII\Collection\PiggyBankPart::setStartdate - * @todo Implement testSetStartdate(). - */ - public function testSetStartdate() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers FireflyIII\Collection\PiggyBankPart::getTargetdate - * @todo Implement testGetTargetdate(). - */ - public function testGetTargetdate() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers FireflyIII\Collection\PiggyBankPart::setTargetdate - * @todo Implement testSetTargetdate(). - */ - public function testSetTargetdate() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers FireflyIII\Collection\PiggyBankPart::getRepetition - * @todo Implement testGetRepetition(). - */ - public function testGetRepetition() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers FireflyIII\Collection\PiggyBankPart::setRepetition - * @todo Implement testSetRepetition(). - */ - public function testSetRepetition() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers FireflyIII\Collection\PiggyBankPart::hasReminder - * @todo Implement testHasReminder(). - */ - public function testHasReminder() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers FireflyIII\Collection\PiggyBankPart::percentage - * @todo Implement testPercentage(). - */ - public function testPercentage() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers FireflyIII\Collection\PiggyBankPart::getCurrentamount - * @todo Implement testGetCurrentamount(). - */ - public function testGetCurrentamount() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers FireflyIII\Collection\PiggyBankPart::setCurrentamount - * @todo Implement testSetCurrentamount(). - */ - public function testSetCurrentamount() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers FireflyIII\Collection\PiggyBankPart::getCumulativeAmount - * @todo Implement testGetCumulativeAmount(). - */ - public function testGetCumulativeAmount() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers FireflyIII\Collection\PiggyBankPart::setCumulativeAmount - * @todo Implement testSetCumulativeAmount(). - */ - public function testSetCumulativeAmount() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers FireflyIII\Collection\PiggyBankPart::getAmountPerBar - * @todo Implement testGetAmountPerBar(). - */ - public function testGetAmountPerBar() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers FireflyIII\Collection\PiggyBankPart::setAmountPerBar - * @todo Implement testSetAmountPerBar(). - */ - public function testSetAmountPerBar() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } -} diff --git a/app/views/repeatedExpense/index.blade.php b/app/views/repeatedExpense/index.blade.php index 9690c5d830..a25336619a 100644 --- a/app/views/repeatedExpense/index.blade.php +++ b/app/views/repeatedExpense/index.blade.php @@ -9,7 +9,6 @@ - @foreach($expenses as $entry)
diff --git a/bootstrap/start.php b/bootstrap/start.php index a45a61456c..1b7c257703 100644 --- a/bootstrap/start.php +++ b/bootstrap/start.php @@ -97,5 +97,5 @@ Event::subscribe('FireflyIII\Event\TransactionJournal'); // set very tight rules on all models // create custom uniquely rules. // TODO add "Create new X" button to any list there is: categories, accounts, piggies, etc. -// TODO Install PHP5 and code thing and create very small methods. +// Install PHP5 and code thing and create very small methods. return $app; From 9a3aed80389fc5435156d97485893c319cf50a87 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 2 Jan 2015 10:53:18 +0100 Subject: [PATCH 80/84] Moved code to relate transfers to another class. Still needs some work. --- app/controllers/RelatedController.php | 139 +++++++++++++++++ app/controllers/TransactionController.php | 145 ------------------ .../TransactionJournal/TransactionJournal.php | 33 ---- app/lib/FireflyIII/FF3ServiceProvider.php | 3 + app/lib/FireflyIII/Helper/Related/Related.php | 69 +++++++++ .../Helper/Related/RelatedInterface.php | 29 ++++ app/routes.php | 17 ++ .../relate.blade.php | 0 .../javascript/firefly/related-manager.js | 10 +- 9 files changed, 262 insertions(+), 183 deletions(-) create mode 100644 app/controllers/RelatedController.php create mode 100644 app/lib/FireflyIII/Helper/Related/Related.php create mode 100644 app/lib/FireflyIII/Helper/Related/RelatedInterface.php rename app/views/{transactions => related}/relate.blade.php (100%) diff --git a/app/controllers/RelatedController.php b/app/controllers/RelatedController.php new file mode 100644 index 0000000000..1a65ae4c15 --- /dev/null +++ b/app/controllers/RelatedController.php @@ -0,0 +1,139 @@ +_repository = $repository; + + } + + /** + * @param TransactionJournal $journal + * + * @return \Illuminate\Http\JsonResponse + */ + public function alreadyRelated(TransactionJournal $journal) + { + $ids = []; + /** @var TransactionGroup $group */ + foreach ($journal->transactiongroups()->get() as $group) { + /** @var TransactionJournal $loopJournal */ + foreach ($group->transactionjournals()->get() as $loopJournal) { + if ($loopJournal->id != $journal->id) { + $ids[] = $loopJournal->id; + } + } + } + $unique = array_unique($ids); + if (count($unique) > 0) { + + $set = $this->_repository->getJournalsByIds($unique); + $set->each( + function (TransactionJournal $journal) { + $journal->amount = Amount::format($journal->getAmount()); + } + ); + + return Response::json($set->toArray()); + } else { + return Response::json((new Collection)->toArray()); + } + } + + /** + * @param TransactionJournal $parentJournal + * @param TransactionJournal $childJournal + * + * @return \Illuminate\Http\JsonResponse + */ + public function relate(TransactionJournal $parentJournal, TransactionJournal $childJournal) + { + $group = new TransactionGroup; + $group->relation = 'balance'; + $group->user_id = $this->_repository->getUser()->id; + $group->save(); + $group->transactionjournals()->save($parentJournal); + $group->transactionjournals()->save($childJournal); + + return Response::json(true); + + } + + /** + * @param TransactionJournal $journal + * + * @return \Illuminate\View\View + */ + public function related(TransactionJournal $journal) + { + $groups = $journal->transactiongroups()->get(); + $members = new Collection; + /** @var TransactionGroup $group */ + foreach ($groups as $group) { + /** @var TransactionJournal $loopJournal */ + foreach ($group->transactionjournals()->get() as $loopJournal) { + if ($loopJournal->id != $journal->id) { + $members->push($loopJournal); + } + } + } + + return View::make('related.relate', compact('journal', 'members')); + } + + /** + * @param TransactionJournal $parentJournal + * @param TransactionJournal $childJournal + * + * @return \Illuminate\Http\JsonResponse + * @throws Exception + */ + public function removeRelation(TransactionJournal $parentJournal, TransactionJournal $childJournal) + { + $groups = $parentJournal->transactiongroups()->get(); + /** @var TransactionGroup $group */ + foreach ($groups as $group) { + foreach ($group->transactionjournals()->get() as $loopJournal) { + if ($loopJournal->id == $childJournal->id) { + // remove from group: + $group->transactionjournals()->detach($childJournal); + } + } + if ($group->transactionjournals()->count() == 1) { + $group->delete(); + } + } + + return Response::json(true); + } + + /** + * @param TransactionJournal $journal + * + * @return \Illuminate\Http\JsonResponse + */ + public function search(TransactionJournal $journal) + { + + $search = e(trim(Input::get('searchValue'))); + + $result = $this->_repository->search($search, $journal); + $result->each( + function (TransactionJournal $j) { + $j->amount = Amount::format($j->getAmount()); + } + ); + + return Response::json($result->toArray()); + } + +} \ No newline at end of file diff --git a/app/controllers/TransactionController.php b/app/controllers/TransactionController.php index 167da8a6c0..d62fe5a3cb 100644 --- a/app/controllers/TransactionController.php +++ b/app/controllers/TransactionController.php @@ -40,44 +40,6 @@ class TransactionController extends BaseController View::share('mainTitleIcon', 'fa-repeat'); } - /** - * - * TODO this needs cleaning up and thinking over. - * - * @param TransactionJournal $journal - * - * @codeCoverageIgnore - * - * @return array|\Illuminate\Http\JsonResponse - */ - public function alreadyRelated(TransactionJournal $journal) - { - - $ids = []; - /** @var TransactionGroup $group */ - foreach ($journal->transactiongroups()->get() as $group) { - /** @var TransactionJournal $loopJournal */ - foreach ($group->transactionjournals()->get() as $loopJournal) { - if ($loopJournal->id != $journal->id) { - $ids[] = $loopJournal->id; - } - } - } - $unique = array_unique($ids); - if (count($unique) > 0) { - - $set = $this->_repository->getByIds($unique); - $set->each( - function (TransactionJournal $journal) { - $journal->amount = Amount::format($journal->getAmount()); - } - ); - - return Response::json($set->toArray()); - } else { - return (new Collection)->toArray(); - } - } /** * Shows the view helping the user to create a new transaction journal. @@ -156,37 +118,6 @@ class TransactionController extends BaseController return Redirect::route('transactions.index', $return); } - /** - * TODO this needs cleaning up and thinking over. - * - * @return \Illuminate\Http\JsonResponse - * @codeCoverageIgnore - * - */ - public function doRelate() - { - $brother = intval(Input::get('id')); - $sister = intval(Input::get('relateTo')); - - $journal = $this->_repository->find($brother); - $sis = $this->_repository->find($sister); - - if ($journal && $sis) { - $group = new TransactionGroup; - $group->relation = 'balance'; - $group->user_id = $this->_repository->getUser()->id; - $group->save(); - $group->transactionjournals()->save($journal); - $group->transactionjournals()->save($sis); - - return Response::json(true); - } - - return Response::json(false); - - - } - /** * Shows the view to edit a transaction. * @@ -266,54 +197,7 @@ class TransactionController extends BaseController } - /** - * TODO refactor relate stuff into another controller. - * - * @param TransactionJournal $journal - * - * @return \Illuminate\View\View - * @codeCoverageIgnore - * - */ - public function relate(TransactionJournal $journal) - { - $groups = $journal->transactiongroups()->get(); - $members = new Collection; - /** @var TransactionGroup $group */ - foreach ($groups as $group) { - /** @var TransactionJournal $loopJournal */ - foreach ($group->transactionjournals()->get() as $loopJournal) { - if ($loopJournal->id != $journal->id) { - $members->push($loopJournal); - } - } - } - return View::make('transactions.relate', compact('journal', 'members')); - } - - /** - * TODO this needs cleaning up and thinking over. - * - * @param TransactionJournal $journal - * - * @codeCoverageIgnore - * - * @return \Illuminate\Http\JsonResponse - */ - public function relatedSearch(TransactionJournal $journal) - { - $search = e(trim(Input::get('searchValue'))); - - $result = $this->_repository->searchRelated($search, $journal); - $result->each( - function (TransactionJournal $j) { - $j->amount = Amount::format($j->getAmount()); - } - ); - - return Response::json($result->toArray()); - } /** * @param TransactionJournal $journal @@ -401,35 +285,6 @@ class TransactionController extends BaseController return Redirect::route('transactions.create', $data['what'])->withInput(); } - /** - * TODO this needs cleaning up and thinking over. - * - * @param TransactionJournal $journal - * - * @codeCoverageIgnore - * @return \Illuminate\Http\JsonResponse - * @throws Exception - */ - public function unrelate(TransactionJournal $journal) - { - $groups = $journal->transactiongroups()->get(); - $relatedTo = intval(Input::get('relation')); - /** @var TransactionGroup $group */ - foreach ($groups as $group) { - foreach ($group->transactionjournals()->get() as $loopJournal) { - if ($loopJournal->id == $relatedTo) { - // remove from group: - $group->transactionjournals()->detach($relatedTo); - } - } - if ($group->transactionjournals()->count() == 1) { - $group->delete(); - } - } - - return Response::json(true); - - } /** * @param TransactionJournal $journal diff --git a/app/lib/FireflyIII/Database/TransactionJournal/TransactionJournal.php b/app/lib/FireflyIII/Database/TransactionJournal/TransactionJournal.php index 73bc4e3877..ff7cafa8e2 100644 --- a/app/lib/FireflyIII/Database/TransactionJournal/TransactionJournal.php +++ b/app/lib/FireflyIII/Database/TransactionJournal/TransactionJournal.php @@ -571,37 +571,4 @@ class TransactionJournal implements TransactionJournalInterface, CUDInterface, C return \Paginator::make($items, $count, $limit); } - - /** - * @param string $query - * @param \TransactionJournal $journal - * - * @return Collection - */ - public function searchRelated($query, \TransactionJournal $journal) - { - $start = clone $journal->date; - $end = clone $journal->date; - $start->startOfMonth(); - $end->endOfMonth(); - - // get already related transactions: - $exclude = [$journal->id]; - foreach ($journal->transactiongroups()->get() as $group) { - foreach ($group->transactionjournals() as $current) { - $exclude[] = $current->id; - } - } - $exclude = array_unique($exclude); - - $query = $this->getUser()->transactionjournals() - ->withRelevantData() - ->before($end) - ->after($start) - ->whereNotIn('id', $exclude) - ->where('description', 'LIKE', '%' . $query . '%') - ->get(); - - return $query; - } } diff --git a/app/lib/FireflyIII/FF3ServiceProvider.php b/app/lib/FireflyIII/FF3ServiceProvider.php index 6495f65f51..879313a2d2 100644 --- a/app/lib/FireflyIII/FF3ServiceProvider.php +++ b/app/lib/FireflyIII/FF3ServiceProvider.php @@ -102,6 +102,9 @@ class FF3ServiceProvider extends ServiceProvider $this->app->bind('FireflyIII\Report\ReportInterface', 'FireflyIII\Report\Report'); $this->app->bind('FireflyIII\Report\ReportQueryInterface', 'FireflyIII\Report\ReportQuery'); $this->app->bind('FireflyIII\Report\ReportHelperInterface', 'FireflyIII\Report\ReportHelper'); + + $this->app->bind('FireflyIII\Helper\Related\RelatedInterface', 'FireflyIII\Helper\Related\Related'); + $this->app->bind('FireflyIII\Helper\TransactionJournal\HelperInterface', 'FireflyIII\Helper\TransactionJournal\Helper'); // chart diff --git a/app/lib/FireflyIII/Helper/Related/Related.php b/app/lib/FireflyIII/Helper/Related/Related.php new file mode 100644 index 0000000000..2c54bd6451 --- /dev/null +++ b/app/lib/FireflyIII/Helper/Related/Related.php @@ -0,0 +1,69 @@ +setUser(\Auth::user()); + } + + /** + * @param array $objectIds + * + * @return Collection + */ + public function getJournalsByIds(array $objectIds) + { + /** @var \FireflyIII\Database\TransactionJournal\TransactionJournal $repository */ + $repository = \App::make('FireflyIII\Database\TransactionJournal\TransactionJournal'); + + return $repository->getByIds($objectIds); + } + + /** + * @param string $query + * @param \TransactionJournal $journal + * + * @return Collection + */ + public function search($query, \TransactionJournal $journal) + { + $start = clone $journal->date; + $end = clone $journal->date; + $start->startOfMonth(); + $end->endOfMonth(); + + // get already related transactions: + $exclude = [$journal->id]; + foreach ($journal->transactiongroups()->get() as $group) { + foreach ($group->transactionjournals() as $current) { + $exclude[] = $current->id; + } + } + $exclude = array_unique($exclude); + + $query = $this->getUser()->transactionjournals() + ->withRelevantData() + ->before($end) + ->after($start) + ->whereNotIn('id', $exclude) + ->where('description', 'LIKE', '%' . $query . '%') + ->get(); + + return $query; + } +} \ No newline at end of file diff --git a/app/lib/FireflyIII/Helper/Related/RelatedInterface.php b/app/lib/FireflyIII/Helper/Related/RelatedInterface.php new file mode 100644 index 0000000000..cde8e7e54a --- /dev/null +++ b/app/lib/FireflyIII/Helper/Related/RelatedInterface.php @@ -0,0 +1,29 @@ +where('user_id', Auth::user()->id)->first(); + } + + return null; +} +); Route::bind( 'currency', function ($value, $route) { @@ -247,6 +257,13 @@ Route::group( Route::get('/profile', ['uses' => 'ProfileController@index', 'as' => 'profile']); Route::get('/profile/change-password', ['uses' => 'ProfileController@changePassword', 'as' => 'change-password']); + // related controller: + Route::get('/related/removeRelation/{tj}/{tjSecond}', ['uses' => 'RelatedController@removeRelation','as' => 'related.removeRelation']); + Route::get('/related/related/{tj}', ['uses' => 'RelatedController@related','as' => 'related.related']); + Route::post('/related/search/{tj}', ['uses' => 'RelatedController@search','as' => 'related.search']); + Route::post('/related/relate/{tj}/{tjSecond}', ['uses' => 'RelatedController@relate','as' => 'related.relate']); + Route::get('/related/alreadyRelated/{tj}', ['uses' => 'RelatedController@alreadyRelated','as' => 'related.alreadyRelated']); + // bills controller Route::get('/bills', ['uses' => 'BillController@index', 'as' => 'bills.index']); Route::get('/bills/rescan/{bill}', ['uses' => 'BillController@rescan', 'as' => 'bills.rescan']); # rescan for matching. diff --git a/app/views/transactions/relate.blade.php b/app/views/related/relate.blade.php similarity index 100% rename from app/views/transactions/relate.blade.php rename to app/views/related/relate.blade.php diff --git a/public/assets/javascript/firefly/related-manager.js b/public/assets/javascript/firefly/related-manager.js index dc4171512a..923afb5147 100644 --- a/public/assets/javascript/firefly/related-manager.js +++ b/public/assets/javascript/firefly/related-manager.js @@ -9,7 +9,7 @@ function unrelateTransaction(e) { var id = target.data('id'); var relatedTo = target.data('relatedto'); - $.post('transactions/unrelate/' + relatedTo, {relation: id}).success(function (data) { + $.post('related/removeRelation/' + id + '/' + relatedTo).success(function (data) { target.parent().parent().remove(); }).fail(function () { alert('Could not!'); @@ -23,7 +23,7 @@ function relateTransaction(e) { console.log($('#searchRelated').length); - $('#relationModal').empty().load('transaction/relate/' + ID, function () { + $('#relationModal').empty().load('related/related/' + ID, function () { $('#relationModal').modal('show'); getAlreadyRelatedTransactions(e, ID); @@ -42,7 +42,7 @@ function relateTransaction(e) { function searchRelatedTransactions(e, ID) { var searchValue = $('#relatedSearchValue').val(); if (searchValue != '') { - $.post('transactions/relatedSearch/' + ID, {searchValue: searchValue}).success(function (data) { + $.post('related/search/' + ID, {searchValue: searchValue}).success(function (data) { // post each result to some div. $('#relatedSearchResults').empty(); // TODO this is the worst. @@ -74,7 +74,7 @@ function doRelateNewTransaction(e) { var relateToId = target.data('relateto'); if (!target.checked) { var relateID = target.data('id'); - $.post('transactions/doRelate', {relateTo: relateToId, id: id}).success(function (data) { + $.post('related/relate/' + id + '/' + relateToId).success(function (data) { // success! target.parent().parent().remove(); getAlreadyRelatedTransactions(null, relateToId); @@ -91,7 +91,7 @@ function doRelateNewTransaction(e) { function getAlreadyRelatedTransactions(e, ID) { //#alreadyRelated - $.post('transactions/alreadyRelated/' + ID).success(function (data) { + $.get('related/alreadyRelated/' + ID).success(function (data) { $('#alreadyRelated').empty(); $.each(data, function (i, row) { var tr = $('
'); From 426d3d948c0ca37f8e57862852134ce2cec48af4 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 2 Jan 2015 10:55:59 +0100 Subject: [PATCH 81/84] Added newlines [skip ci] --- app/controllers/RelatedController.php | 2 +- app/lib/FireflyIII/Helper/Related/Related.php | 2 +- app/lib/FireflyIII/Helper/Related/RelatedInterface.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/RelatedController.php b/app/controllers/RelatedController.php index 1a65ae4c15..747dad5e3f 100644 --- a/app/controllers/RelatedController.php +++ b/app/controllers/RelatedController.php @@ -136,4 +136,4 @@ class RelatedController extends BaseController return Response::json($result->toArray()); } -} \ No newline at end of file +} diff --git a/app/lib/FireflyIII/Helper/Related/Related.php b/app/lib/FireflyIII/Helper/Related/Related.php index 2c54bd6451..0627374e74 100644 --- a/app/lib/FireflyIII/Helper/Related/Related.php +++ b/app/lib/FireflyIII/Helper/Related/Related.php @@ -66,4 +66,4 @@ class Related implements RelatedInterface return $query; } -} \ No newline at end of file +} diff --git a/app/lib/FireflyIII/Helper/Related/RelatedInterface.php b/app/lib/FireflyIII/Helper/Related/RelatedInterface.php index cde8e7e54a..f2072cf823 100644 --- a/app/lib/FireflyIII/Helper/Related/RelatedInterface.php +++ b/app/lib/FireflyIII/Helper/Related/RelatedInterface.php @@ -26,4 +26,4 @@ interface RelatedInterface */ public function getJournalsByIds(array $objectIds); -} \ No newline at end of file +} From 3be1cdb249272680ad4e02dde8c41e14e1ea898b Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 2 Jan 2015 11:04:51 +0100 Subject: [PATCH 82/84] Some cleaning up in the reports. [skip ci] --- app/lib/FireflyIII/Report/Report.php | 32 +------------- app/lib/FireflyIII/Report/ReportQuery.php | 44 ++++++++++++++++++- .../Report/ReportQueryInterface.php | 9 ++++ app/views/reports/year.blade.php | 6 +-- 4 files changed, 57 insertions(+), 34 deletions(-) diff --git a/app/lib/FireflyIII/Report/Report.php b/app/lib/FireflyIII/Report/Report.php index a032068318..56deca08ec 100644 --- a/app/lib/FireflyIII/Report/Report.php +++ b/app/lib/FireflyIII/Report/Report.php @@ -361,36 +361,8 @@ class Report implements ReportInterface */ public function revenueGroupedByAccount(Carbon $start, Carbon $end, $limit = 15) { - return \TransactionJournal:: - leftJoin( - 'transactions as t_from', function (JoinClause $join) { - $join->on('t_from.transaction_journal_id', '=', 'transaction_journals.id')->where('t_from.amount', '<', 0); - } - ) - ->leftJoin('accounts as ac_from', 't_from.account_id', '=', 'ac_from.id') - ->leftJoin( - 'account_meta as acm_from', function (JoinClause $join) { - $join->on('ac_from.id', '=', 'acm_from.account_id')->where('acm_from.name', '=', 'accountRole'); - } - ) - ->leftJoin( - 'transactions as t_to', function (JoinClause $join) { - $join->on('t_to.transaction_journal_id', '=', 'transaction_journals.id')->where('t_to.amount', '>', 0); - } - ) - ->leftJoin('accounts as ac_to', 't_to.account_id', '=', 'ac_to.id') - ->leftJoin( - 'account_meta as acm_to', function (JoinClause $join) { - $join->on('ac_to.id', '=', 'acm_to.account_id')->where('acm_to.name', '=', 'accountRole'); - } - ) - ->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id') - ->where('transaction_types.type', 'Deposit') - ->where('acm_to.data', '!=', '"sharedExpense"') - ->before($end)->after($start) - ->where('transaction_journals.user_id', \Auth::user()->id) - ->groupBy('t_from.account_id')->orderBy('sum')->limit(15) - ->get(['t_from.account_id as account_id', 'ac_from.name as name', \DB::Raw('SUM(t_from.amount) as `sum`')]); + return $this->_queries->journalsByRevenueAccount($start, $end); + } diff --git a/app/lib/FireflyIII/Report/ReportQuery.php b/app/lib/FireflyIII/Report/ReportQuery.php index 23d8113363..1a143cbb44 100644 --- a/app/lib/FireflyIII/Report/ReportQuery.php +++ b/app/lib/FireflyIII/Report/ReportQuery.php @@ -3,9 +3,9 @@ namespace FireflyIII\Report; use Carbon\Carbon; +use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Query\JoinClause; use Illuminate\Support\Collection; -use Illuminate\Database\Eloquent\Builder; /** * Class ReportQuery @@ -319,6 +319,48 @@ class ReportQuery implements ReportQueryInterface ->get(['t_to.account_id as id', 'ac_to.name as name', \DB::Raw('SUM(t_to.amount) as `amount`')]); } + /** + * This method returns all deposits into asset accounts, grouped by the revenue account, + * + * @param Carbon $start + * @param Carbon $end + * + * @return Collection + */ + public function journalsByRevenueAccount(Carbon $start, Carbon $end) + { + return \TransactionJournal:: + leftJoin( + 'transactions as t_from', function (JoinClause $join) { + $join->on('t_from.transaction_journal_id', '=', 'transaction_journals.id')->where('t_from.amount', '<', 0); + } + ) + ->leftJoin('accounts as ac_from', 't_from.account_id', '=', 'ac_from.id') + ->leftJoin( + 'account_meta as acm_from', function (JoinClause $join) { + $join->on('ac_from.id', '=', 'acm_from.account_id')->where('acm_from.name', '=', 'accountRole'); + } + ) + ->leftJoin( + 'transactions as t_to', function (JoinClause $join) { + $join->on('t_to.transaction_journal_id', '=', 'transaction_journals.id')->where('t_to.amount', '>', 0); + } + ) + ->leftJoin('accounts as ac_to', 't_to.account_id', '=', 'ac_to.id') + ->leftJoin( + 'account_meta as acm_to', function (JoinClause $join) { + $join->on('ac_to.id', '=', 'acm_to.account_id')->where('acm_to.name', '=', 'accountRole'); + } + ) + ->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id') + ->where('transaction_types.type', 'Deposit') + ->where('acm_to.data', '!=', '"sharedExpense"') + ->before($end)->after($start) + ->where('transaction_journals.user_id', \Auth::user()->id) + ->groupBy('t_from.account_id')->orderBy('amount') + ->get(['t_from.account_id as account_id', 'ac_from.name as name', \DB::Raw('SUM(t_from.amount) as `amount`')]); + } + /** * With an equally misleading name, this query returns are transfers to shared accounts. These are considered * expenses. diff --git a/app/lib/FireflyIII/Report/ReportQueryInterface.php b/app/lib/FireflyIII/Report/ReportQueryInterface.php index 6a729480f6..a2097c6635 100644 --- a/app/lib/FireflyIII/Report/ReportQueryInterface.php +++ b/app/lib/FireflyIII/Report/ReportQueryInterface.php @@ -108,6 +108,15 @@ interface ReportQueryInterface */ public function journalsByExpenseAccount(Carbon $start, Carbon $end); + /** + * This method returns all deposits into asset accounts, grouped by the revenue account, + * @param Carbon $start + * @param Carbon $end + * + * @return Collection + */ + public function journalsByRevenueAccount(Carbon $start, Carbon $end); + /** * With an equally misleading name, this query returns are transfers to shared accounts. These are considered * expenses. diff --git a/app/views/reports/year.blade.php b/app/views/reports/year.blade.php index 2911af39fa..130f29ec55 100644 --- a/app/views/reports/year.blade.php +++ b/app/views/reports/year.blade.php @@ -71,7 +71,7 @@ $incomeSum = 0; $expenseSum = 0; foreach($groupedIncomes as $income) { - $incomeSum += floatval($income->sum); + $incomeSum += floatval($income->amount); } foreach($groupedExpenses as $exp) { $expenseSum += floatval($exp['amount']); @@ -104,10 +104,10 @@
Amount{{mft($t)}}{{Amount::formatTransaction($t)}}
New balance{{mf($t->before)}} → {{mf($t->after)}}{{Amount::format($t->before)}} → {{Amount::format($t->after)}}
@foreach($groupedIncomes as $income) - sum)*-1;?> + amount)*-1;?> - + @endforeach From 5707dc7579528a14808ed2fb1763cbad26a1dba0 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 2 Jan 2015 12:38:13 +0100 Subject: [PATCH 83/84] Lots of cleaning up. --- .gitignore | 1 + app/controllers/BillController.php | 7 ++ app/controllers/PiggybankController.php | 4 +- app/controllers/TransactionController.php | 2 +- .../FireflyIII/Database/Account/Account.php | 7 -- app/lib/FireflyIII/Database/Bill/Bill.php | 67 +++++++++++++ .../Database/Bill/BillInterface.php | 14 +++ app/lib/FireflyIII/Shared/Toolkit/Steam.php | 1 - app/models/Bill.php | 67 ------------- app/models/Piggybank.php | 21 ---- app/models/TransactionJournal.php | 2 - app/routes.php | 4 +- app/views/bills/index.blade.php | 1 - app/views/bills/show.blade.php | 5 +- app/views/categories/show.blade.php | 1 - app/views/list/bills.blade.php | 10 +- app/views/piggy_banks/show.blade.php | 6 +- bootstrap/start.php | 2 +- .../javascript/firefly/related-manager.js | 1 - tests/functional/RelatedControllerCest.php | 99 +++++++++++++++++++ 20 files changed, 201 insertions(+), 121 deletions(-) create mode 100644 tests/functional/RelatedControllerCest.php diff --git a/.gitignore b/.gitignore index 4224919aae..90cd6c6a45 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ tests/_data/db.sqlite tests/_data/dump.sql db.sqlite_snapshot c3.php +db.sqlite-journal diff --git a/app/controllers/BillController.php b/app/controllers/BillController.php index ef25c3ffff..521c21736b 100644 --- a/app/controllers/BillController.php +++ b/app/controllers/BillController.php @@ -83,6 +83,12 @@ class BillController extends BaseController public function index() { $bills = $this->_repository->get(); + $bills->each( + function (Bill $bill) { + $bill->nextExpectedMatch = $this->_repository->nextExpectedMatch($bill); + $bill->lastFoundMatch = $this->_repository->lastFoundMatch($bill); + } + ); return View::make('bills.index', compact('bills')); } @@ -115,6 +121,7 @@ class BillController extends BaseController public function show(Bill $bill) { $journals = $bill->transactionjournals()->withRelevantData()->orderBy('date', 'DESC')->get(); + $bill->nextExpectedMatch = $this->_repository->nextExpectedMatch($bill); $hideBill = true; diff --git a/app/controllers/PiggybankController.php b/app/controllers/PiggybankController.php index 58924755ae..ce7da9f704 100644 --- a/app/controllers/PiggybankController.php +++ b/app/controllers/PiggybankController.php @@ -262,11 +262,9 @@ class PiggyBankController extends BaseController * Number of reminders: */ - $amountPerReminder = $piggyBank->amountPerReminder(); - $remindersCount = $piggyBank->countFutureReminders(); $subTitle = e($piggyBank->name); - return View::make('piggy_banks.show', compact('amountPerReminder', 'remindersCount', 'piggyBank', 'events', 'subTitle')); + return View::make('piggy_banks.show', compact('piggyBank', 'events', 'subTitle')); } diff --git a/app/controllers/TransactionController.php b/app/controllers/TransactionController.php index d62fe5a3cb..a7c9b12e71 100644 --- a/app/controllers/TransactionController.php +++ b/app/controllers/TransactionController.php @@ -249,7 +249,7 @@ class TransactionController extends BaseController $data['transaction_currency_id'] = $transactionCurrency->id; $data['completed'] = 0; $data['what'] = $what; - $data['currency'] = 'EUR'; // TODO allow custom currency + $data['currency'] = 'EUR'; // always validate: $messages = $this->_repository->validate($data); diff --git a/app/lib/FireflyIII/Database/Account/Account.php b/app/lib/FireflyIII/Database/Account/Account.php index 0cfa42dd03..661db8d40c 100644 --- a/app/lib/FireflyIII/Database/Account/Account.php +++ b/app/lib/FireflyIII/Database/Account/Account.php @@ -239,7 +239,6 @@ class Account implements CUDInterface, CommonDatabaseCallsInterface, AccountInte $q->orWhere( function (QueryBuilder $q) use ($model) { $q->where('accounts.name', 'LIKE', '%' . $model->name . '%'); - // TODO magic number! $q->where('accounts.account_type_id', 3); $q->where('accounts.active', 0); } @@ -280,7 +279,6 @@ class Account implements CUDInterface, CommonDatabaseCallsInterface, AccountInte $q->orWhere( function (EloquentBuilder $q) use ($model) { $q->where('accounts.name', 'LIKE', '%' . $model->name . '%'); - // TODO magic number! $q->where('accounts.account_type_id', 3); $q->where('accounts.active', 0); } @@ -324,7 +322,6 @@ class Account implements CUDInterface, CommonDatabaseCallsInterface, AccountInte $this->storeInitialBalance($account, $data); } - // TODO this needs cleaning up and thinking over. switch ($account->accountType->type) { case 'Asset account': case 'Default account': @@ -352,7 +349,6 @@ class Account implements CUDInterface, CommonDatabaseCallsInterface, AccountInte $model->name = $data['name']; $model->active = isset($data['active']) ? intval($data['active']) : 0; - // TODO this needs cleaning up and thinking over. switch ($model->accountType->type) { case 'Asset account': case 'Default account': @@ -365,7 +361,6 @@ class Account implements CUDInterface, CommonDatabaseCallsInterface, AccountInte if (isset($data['openingbalance']) && isset($data['openingbalancedate']) && strlen($data['openingbalancedate']) > 0) { /** @noinspection PhpParamsInspection */ $openingBalance = $this->openingBalanceTransaction($model); - // TODO this needs cleaning up and thinking over. if (is_null($openingBalance)) { $this->storeInitialBalance($model, $data); } else { @@ -483,7 +478,6 @@ class Account implements CUDInterface, CommonDatabaseCallsInterface, AccountInte */ public function findByWhat($what) { - // TODO: Implement findByWhat() method. throw new NotImplementedException; } @@ -495,7 +489,6 @@ class Account implements CUDInterface, CommonDatabaseCallsInterface, AccountInte */ public function get() { - // TODO: Implement get() method. throw new NotImplementedException; } diff --git a/app/lib/FireflyIII/Database/Bill/Bill.php b/app/lib/FireflyIII/Database/Bill/Bill.php index 65133d8441..6e17ffe827 100644 --- a/app/lib/FireflyIII/Database/Bill/Bill.php +++ b/app/lib/FireflyIII/Database/Bill/Bill.php @@ -202,6 +202,73 @@ class Bill implements CUDInterface, CommonDatabaseCallsInterface, BillInterface } + /** + * @param \Bill $bill + * + * @return Carbon|null + */ + public function lastFoundMatch(\Bill $bill) + { + $last = $bill->transactionjournals()->orderBy('date', 'DESC')->first(); + if ($last) { + return $last->date; + } + + return null; + } + + /** + * @param \Bill $bill + * + * @return Carbon|null + */ + public function nextExpectedMatch(\Bill $bill) + { + /* + * The date Firefly tries to find. If this stays null, it's "unknown". + */ + $finalDate = null; + if ($bill->active == 0) { + return $finalDate; + } + + /* + * $today is the start of the next period, to make sure FF3 won't miss anything + * when the current period has a transaction journal. + */ + $today = \DateKit::addPeriod(new Carbon, $bill->repeat_freq, 0); + + /* + * FF3 loops from the $start of the bill, and to make sure + * $skip works, it adds one (for modulo). + */ + $skip = $bill->skip + 1; + $start = \DateKit::startOfPeriod(new Carbon, $bill->repeat_freq); + /* + * go back exactly one month/week/etc because FF3 does not care about 'next' + * bills if they're too far into the past. + */ + + $counter = 0; + while ($start <= $today) { + if (($counter % $skip) == 0) { + // do something. + $end = \DateKit::endOfPeriod(clone $start, $bill->repeat_freq); + $journalCount = $bill->transactionjournals()->before($end)->after($start)->count(); + if ($journalCount == 0) { + $finalDate = clone $start; + break; + } + } + + // add period for next round! + $start = \DateKit::addPeriod($start, $bill->repeat_freq, 0); + $counter++; + } + + return $finalDate; + } + /** * @param \Bill $bill * @param \TransactionJournal $journal diff --git a/app/lib/FireflyIII/Database/Bill/BillInterface.php b/app/lib/FireflyIII/Database/Bill/BillInterface.php index 6c6a247364..f6dca6325f 100644 --- a/app/lib/FireflyIII/Database/Bill/BillInterface.php +++ b/app/lib/FireflyIII/Database/Bill/BillInterface.php @@ -23,6 +23,20 @@ interface BillInterface */ public function getJournalForBillInRange(\Bill $bill, Carbon $start, Carbon $end); + /** + * @param \Bill $bill + * + * @return Carbon|null + */ + public function lastFoundMatch(\Bill $bill); + + /** + * @param \Bill $bill + * + * @return Carbon|null + */ + public function nextExpectedMatch(\Bill $bill); + /** * @param \Bill $bill * @param \TransactionJournal $journal diff --git a/app/lib/FireflyIII/Shared/Toolkit/Steam.php b/app/lib/FireflyIII/Shared/Toolkit/Steam.php index 03f644bafc..2a2696372f 100644 --- a/app/lib/FireflyIII/Shared/Toolkit/Steam.php +++ b/app/lib/FireflyIII/Shared/Toolkit/Steam.php @@ -16,7 +16,6 @@ class Steam { /** - * TODO find a way to reliably remove cache entries for accounts. * * @param \Account $account * @param Carbon $date diff --git a/app/models/Bill.php b/app/models/Bill.php index 586d1146c1..00d7d2c1e4 100644 --- a/app/models/Bill.php +++ b/app/models/Bill.php @@ -30,21 +30,6 @@ class Bill extends Eloquent return ['created_at', 'updated_at', 'date']; } - /** - * TODO remove this method in favour of something in the FireflyIII libraries. - * - * @return null - */ - public function lastFoundMatch() - { - $last = $this->transactionjournals()->orderBy('date', 'DESC')->first(); - if ($last) { - return $last->date; - } - - return null; - } - /** * @return \Illuminate\Database\Eloquent\Relations\HasMany */ @@ -54,58 +39,6 @@ class Bill extends Eloquent } - /** - * TODO remove this method in favour of something in the FireflyIII libraries. - * - * Find the next expected match based on the set journals and the date stuff from the bill. - */ - public function nextExpectedMatch() - { - - /* - * The date Firefly tries to find. If this stays null, it's "unknown". - */ - $finalDate = null; - if ($this->active == 0) { - return $finalDate; - } - - /* - * $today is the start of the next period, to make sure FF3 won't miss anything - * when the current period has a transaction journal. - */ - $today = DateKit::addPeriod(new Carbon, $this->repeat_freq, 0); - - /* - * FF3 loops from the $start of the bill, and to make sure - * $skip works, it adds one (for modulo). - */ - $skip = $this->skip + 1; - $start = DateKit::startOfPeriod(new Carbon, $this->repeat_freq); - /* - * go back exactly one month/week/etc because FF3 does not care about 'next' - * bills if they're too far into the past. - */ - - $counter = 0; - while ($start <= $today) { - if (($counter % $skip) == 0) { - // do something. - $end = DateKit::endOfPeriod(clone $start, $this->repeat_freq); - $journalCount = $this->transactionjournals()->before($end)->after($start)->count(); - if ($journalCount == 0) { - $finalDate = clone $start; - break; - } - } - - // add period for next round! - $start = DateKit::addPeriod($start, $this->repeat_freq, 0); - $counter++; - } - - return $finalDate; - } /** * @return \Illuminate\Database\Eloquent\Relations\BelongsTo diff --git a/app/models/Piggybank.php b/app/models/Piggybank.php index c3ba7e0054..1e375b7dee 100644 --- a/app/models/Piggybank.php +++ b/app/models/Piggybank.php @@ -37,27 +37,6 @@ class PiggyBank extends Eloquent return $this->belongsTo('Account'); } - /** - * TODO remove this method in favour of something in the FireflyIII libraries. - * - * @return int - */ - public function amountPerReminder() - { - return 0; - - } - - /** - * TODO remove this method in favour of something in the FireflyIII libraries. - * - * @return int - */ - public function countFutureReminders() - { - return 0; - } - /** * TODO remove this method in favour of something in the FireflyIII libraries. * diff --git a/app/models/TransactionJournal.php b/app/models/TransactionJournal.php index e39a8a4c81..ffbd0f32e5 100644 --- a/app/models/TransactionJournal.php +++ b/app/models/TransactionJournal.php @@ -70,8 +70,6 @@ class TransactionJournal extends Eloquent return floatval($t->amount); } } - - return -0.01; } /** diff --git a/app/routes.php b/app/routes.php index 4e37cce682..9513bb3e20 100644 --- a/app/routes.php +++ b/app/routes.php @@ -258,11 +258,11 @@ Route::group( Route::get('/profile/change-password', ['uses' => 'ProfileController@changePassword', 'as' => 'change-password']); // related controller: + Route::get('/related/alreadyRelated/{tj}', ['uses' => 'RelatedController@alreadyRelated','as' => 'related.alreadyRelated']); + Route::post('/related/relate/{tj}/{tjSecond}', ['uses' => 'RelatedController@relate','as' => 'related.relate']); Route::get('/related/removeRelation/{tj}/{tjSecond}', ['uses' => 'RelatedController@removeRelation','as' => 'related.removeRelation']); Route::get('/related/related/{tj}', ['uses' => 'RelatedController@related','as' => 'related.related']); Route::post('/related/search/{tj}', ['uses' => 'RelatedController@search','as' => 'related.search']); - Route::post('/related/relate/{tj}/{tjSecond}', ['uses' => 'RelatedController@relate','as' => 'related.relate']); - Route::get('/related/alreadyRelated/{tj}', ['uses' => 'RelatedController@alreadyRelated','as' => 'related.alreadyRelated']); // bills controller Route::get('/bills', ['uses' => 'BillController@index', 'as' => 'bills.index']); diff --git a/app/views/bills/index.blade.php b/app/views/bills/index.blade.php index 3e1b231ec4..c9319ac213 100644 --- a/app/views/bills/index.blade.php +++ b/app/views/bills/index.blade.php @@ -6,7 +6,6 @@
{{{$title}}} -
@include('list.bills') diff --git a/app/views/bills/show.blade.php b/app/views/bills/show.blade.php index b4ad8d9e1e..6437e6fdcb 100644 --- a/app/views/bills/show.blade.php +++ b/app/views/bills/show.blade.php @@ -49,9 +49,8 @@
@endif - @if($remindersCount > 0) - + - + - @endif
{{{$income->name}}}{{Amount::format(floatval($income->sum)*-1)}}{{Amount::format(floatval($income->amount)*-1)}}
Next expected match - nextExpectedMatch();?> - @if($nextExpectedMatch) - {{$nextExpectedMatch->format('j F Y')}} + @if($bill->nextExpectedMatch) + {{$bill->nextExpectedMatch->format('j F Y')}} @else Unknown @endif diff --git a/app/views/categories/show.blade.php b/app/views/categories/show.blade.php index 37fa8d0e2d..bdfefd3e52 100644 --- a/app/views/categories/show.blade.php +++ b/app/views/categories/show.blade.php @@ -22,7 +22,6 @@
- BLa bla something here.
diff --git a/app/views/list/bills.blade.php b/app/views/list/bills.blade.php index a603bd9617..1540af42de 100644 --- a/app/views/list/bills.blade.php +++ b/app/views/list/bills.blade.php @@ -32,17 +32,15 @@ {{Amount::format($entry->amount_max)}}
- lastFoundMatch();?> - @if($lastMatch) - {{$lastMatch->format('j F Y')}} + @if($entry->lastFoundMatch) + {{$entry->lastFoundMatch->format('j F Y')}} @else Unknown @endif - nextExpectedMatch();?> - @if($nextExpectedMatch) - {{$nextExpectedMatch->format('j F Y')}} + @if($entry->nextExpectedMatch) + {{$entry->nextExpectedMatch->format('j F Y')}} @else Unknown @endif diff --git a/app/views/piggy_banks/show.blade.php b/app/views/piggy_banks/show.blade.php index 47c4e86327..f11b4a74ac 100644 --- a/app/views/piggy_banks/show.blade.php +++ b/app/views/piggy_banks/show.blade.php @@ -88,16 +88,14 @@
Reminders left{{$remindersCount}}(in progress...)
Expected amount per reminder{{Amount::format($amountPerReminder)}}(in progress...)
diff --git a/bootstrap/start.php b/bootstrap/start.php index 1b7c257703..30dc7625b0 100644 --- a/bootstrap/start.php +++ b/bootstrap/start.php @@ -96,6 +96,6 @@ Event::subscribe('FireflyIII\Event\TransactionJournal'); // see if the various has-many-throughs actually get used. // set very tight rules on all models // create custom uniquely rules. -// TODO add "Create new X" button to any list there is: categories, accounts, piggies, etc. +// add "Create new X" button to any list there is: categories, accounts, piggies, etc. // Install PHP5 and code thing and create very small methods. return $app; diff --git a/public/assets/javascript/firefly/related-manager.js b/public/assets/javascript/firefly/related-manager.js index 923afb5147..2c3e55f8af 100644 --- a/public/assets/javascript/firefly/related-manager.js +++ b/public/assets/javascript/firefly/related-manager.js @@ -45,7 +45,6 @@ function searchRelatedTransactions(e, ID) { $.post('related/search/' + ID, {searchValue: searchValue}).success(function (data) { // post each result to some div. $('#relatedSearchResults').empty(); - // TODO this is the worst. $.each(data, function (i, row) { var tr = $(''); diff --git a/tests/functional/RelatedControllerCest.php b/tests/functional/RelatedControllerCest.php new file mode 100644 index 0000000000..629ee5e975 --- /dev/null +++ b/tests/functional/RelatedControllerCest.php @@ -0,0 +1,99 @@ +amLoggedAs(['email' => 'thegrumpydictator@gmail.com', 'password' => 'james']); + + } + + public function alreadyRelated(FunctionalTester $I) + { + $group = TransactionGroup::first(); + $journal = $group->transactionjournals()->first(); + + $I->wantTo('see already related transactions'); + $I->amOnPage('/related/alreadyRelated/' . $journal->id); + $I->see('Big expense in '); + + } + + public function alreadyRelatedNoRelations(FunctionalTester $I) + { + $journal = TransactionJournal::first(); + + $I->wantTo('see already related transactions for a journal without any'); + $I->amOnPage('/related/alreadyRelated/' . $journal->id); + $I->see('[]'); + + } + + public function relate(FunctionalTester $I) + { + $journal = TransactionJournal::leftJoin( + 'transaction_group_transaction_journal', 'transaction_journals.id', '=', 'transaction_group_transaction_journal.transaction_journal_id' + ) + ->whereNull('transaction_group_transaction_journal.transaction_group_id')->first(['transaction_journals.*']); + $otherJournal = TransactionJournal::leftJoin( + 'transaction_group_transaction_journal', 'transaction_journals.id', '=', 'transaction_group_transaction_journal.transaction_journal_id' + ) + ->whereNull('transaction_group_transaction_journal.transaction_group_id')->where( + 'transaction_journals.id', '!=', $journal->id + )->first( + ['transaction_journals.*'] + ); + $I->wantTo('relate two journals'); + $I->sendAjaxPostRequest('/related/relate/' . $journal->id . '/' . $otherJournal->id); + $I->see('true'); + } + + public function related(FunctionalTester $I) + { + $group = TransactionGroup::first(); + $journal = $group->transactionjournals()->first(); + + $I->wantTo('see the popup with already related transactions'); + $I->amOnPage('/related/related/' . $journal->id); + $I->see('Big expense in '); + } + + public function removeRelation(FunctionalTester $I) + { + $group = TransactionGroup::first(); + $one = $group->transactionjournals[0]; + $two = $group->transactionjournals[1]; + $I->wantTo('relate two journals'); + $I->amOnPage('/related/removeRelation/' . $one->id . '/' . $two->id); + $I->see('true'); + + } + + public function search(FunctionalTester $I) + { + $group = TransactionGroup::first(); + $one = $group->transactionjournals[0]; + + $I->wantTo('search for a transaction to relate'); + + $I->sendAjaxPostRequest('/related/search/' . $one->id . '?searchValue=expense'); + $I->see('Big expense in'); + } +} \ No newline at end of file From 423f9fefa9506267a8d654874e81910b26fc4e38 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 2 Jan 2015 12:42:29 +0100 Subject: [PATCH 84/84] Removed todo entries and made issues instead. [skip ci] --- app/models/LimitRepetition.php | 1 - app/models/Piggybank.php | 2 -- app/models/TransactionJournal.php | 2 -- 3 files changed, 5 deletions(-) diff --git a/app/models/LimitRepetition.php b/app/models/LimitRepetition.php index 4d38d9054f..fc9eec5943 100644 --- a/app/models/LimitRepetition.php +++ b/app/models/LimitRepetition.php @@ -34,7 +34,6 @@ class LimitRepetition extends Eloquent } /** - * TODO remove this method in favour of something in the FireflyIII libraries. * * @return float */ diff --git a/app/models/Piggybank.php b/app/models/Piggybank.php index 1e375b7dee..49e7563445 100644 --- a/app/models/Piggybank.php +++ b/app/models/Piggybank.php @@ -38,8 +38,6 @@ class PiggyBank extends Eloquent } /** - * TODO remove this method in favour of something in the FireflyIII libraries. - * * Grabs the PiggyBankRepetition that's currently relevant / active * * @returns \PiggyBankRepetition diff --git a/app/models/TransactionJournal.php b/app/models/TransactionJournal.php index ffbd0f32e5..48b25b2ece 100644 --- a/app/models/TransactionJournal.php +++ b/app/models/TransactionJournal.php @@ -53,8 +53,6 @@ class TransactionJournal extends Eloquent } /** - * TODO remove this method in favour of something in the FireflyIII libraries. - * * @param Account $account * * @return float