From 9b69a6addd36d238987cfd6eb60f38a3549f94f2 Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 2 Mar 2016 13:51:56 +0100 Subject: [PATCH] Lots of todo's [skip ci] --- app/Export/Entry.php | 6 +++--- app/Handlers/Events/ConnectJournalToPiggyBank.php | 4 ++-- app/Handlers/Events/UpdateJournalConnection.php | 2 +- app/Http/Controllers/TransactionController.php | 2 +- app/Repositories/Account/AccountRepository.php | 2 +- app/Repositories/Budget/BudgetRepository.php | 2 +- app/Repositories/Tag/TagRepository.php | 8 ++++---- app/Rules/Triggers/AmountExactly.php | 2 +- app/Rules/Triggers/AmountLess.php | 2 +- app/Rules/Triggers/AmountMore.php | 2 +- app/Rules/Triggers/FromAccountContains.php | 2 +- app/Rules/Triggers/FromAccountEnds.php | 2 +- app/Rules/Triggers/FromAccountStarts.php | 2 +- app/Rules/Triggers/ToAccountContains.php | 2 +- app/Rules/Triggers/ToAccountEnds.php | 2 +- app/Rules/Triggers/ToAccountIs.php | 2 +- app/Rules/Triggers/ToAccountStarts.php | 2 +- app/Support/Search/Search.php | 4 ++-- 18 files changed, 25 insertions(+), 25 deletions(-) diff --git a/app/Export/Entry.php b/app/Export/Entry.php index df417b83a8..eea850edbb 100644 --- a/app/Export/Entry.php +++ b/app/Export/Entry.php @@ -80,7 +80,7 @@ class Entry $entry = new self; $entry->setDescription($journal->description); $entry->setDate($journal->date->format('Y-m-d')); - $entry->setAmount($journal->amount); + $entry->setAmount($journal->amount); // TODO TransactionJournal cannot deliver "amount". /** @var Budget $budget */ $budget = $journal->budgets->first(); @@ -102,14 +102,14 @@ class Entry } /** @var Account $sourceAccount */ - $sourceAccount = $journal->source_account; + $sourceAccount = $journal->source_account; // TODO TransactionJournal cannot deliver "source_account" $entry->setFromAccountId($sourceAccount->id); $entry->setFromAccountName($sourceAccount->name); $entry->setFromAccountIban($sourceAccount->iban); $entry->setFromAccountType($sourceAccount->accountType->type); /** @var Account $destination */ - $destination = $journal->destination_account; + $destination = $journal->destination_account; // TODO TransactionJournal cannot deliver "destination_account" $entry->setToAccountId($destination->id); $entry->setToAccountName($destination->name); $entry->setToAccountIban($destination->iban); diff --git a/app/Handlers/Events/ConnectJournalToPiggyBank.php b/app/Handlers/Events/ConnectJournalToPiggyBank.php index 3a7d0bbb49..5d13b25735 100644 --- a/app/Handlers/Events/ConnectJournalToPiggyBank.php +++ b/app/Handlers/Events/ConnectJournalToPiggyBank.php @@ -44,9 +44,9 @@ class ConnectJournalToPiggyBank } bcscale(2); - $amount = $journal->amount_positive; + $amount = $journal->amount_positive; // TODO TransactionJournal cannot deliver "amount_positive". // if piggy account matches source account, the amount is positive - if ($piggyBank->account_id == $journal->source_account->id) { + if ($piggyBank->account_id == $journal->source_account->id) {// TODO TransactionJournal cannot deliver "source_account" $amount = bcmul($amount, '-1'); } diff --git a/app/Handlers/Events/UpdateJournalConnection.php b/app/Handlers/Events/UpdateJournalConnection.php index 7328caa16a..7f8487a092 100644 --- a/app/Handlers/Events/UpdateJournalConnection.php +++ b/app/Handlers/Events/UpdateJournalConnection.php @@ -44,7 +44,7 @@ class UpdateJournalConnection } bcscale(2); - $amount = $journal->amount; + $amount = $journal->amount; // TODO TransactionJournal cannot deliver "amount". $diff = bcsub($amount, $event->amount); // update current repetition $repetition->currentamount = bcadd($repetition->currentamount, $diff); diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.php index d9444f8182..e96d36e1e1 100644 --- a/app/Http/Controllers/TransactionController.php +++ b/app/Http/Controllers/TransactionController.php @@ -183,7 +183,7 @@ class TransactionController extends Controller $preFilled['piggy_bank_id'] = $journal->piggyBankEvents()->orderBy('date', 'DESC')->first()->piggy_bank_id; } - $preFilled['amount'] = $journal->amount_positive; + $preFilled['amount'] = $journal->amount_positive; // TODO TransactionJournal cannot deliver "amount_positive". if ($journal->isWithdrawal()) { $preFilled['account_id'] = $journal->source_account_id; diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php index f9db1ebf7a..0635041597 100644 --- a/app/Repositories/Account/AccountRepository.php +++ b/app/Repositories/Account/AccountRepository.php @@ -211,7 +211,7 @@ class AccountRepository implements AccountRepositoryInterface $offset = ($page - 1) * 50; $query = Auth::user() ->transactionJournals() - ->withRelevantData() + ->withRelevantData() // TODO firefly will crash here. ->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') ->where('transactions.account_id', $account->id) ->orderBy('transaction_journals.date', 'DESC') diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php index 90a7809637..8254e26cd8 100644 --- a/app/Repositories/Budget/BudgetRepository.php +++ b/app/Repositories/Budget/BudgetRepository.php @@ -414,7 +414,7 @@ class BudgetRepository extends ComponentRepository implements BudgetRepositoryIn public function getJournals(Budget $budget, LimitRepetition $repetition = null, int $take = 50) { $offset = intval(Input::get('page')) > 0 ? intval(Input::get('page')) * $take : 0; - $setQuery = $budget->transactionjournals()->withRelevantData()->take($take)->offset($offset) + $setQuery = $budget->transactionjournals()->withRelevantData()->take($take)->offset($offset) // TODO firefly will crash here. ->orderBy('transaction_journals.date', 'DESC') ->orderBy('transaction_journals.order', 'ASC') ->orderBy('transaction_journals.id', 'DESC'); diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.php index 23be5e227e..6c8812770e 100644 --- a/app/Repositories/Tag/TagRepository.php +++ b/app/Repositories/Tag/TagRepository.php @@ -129,8 +129,8 @@ class TagRepository implements TagRepositoryInterface /** @var TransactionJournal $journal */ foreach ($journals as $journal) { - if ($journal->destination_account->id == $account->id) { - $amount = bcadd($amount, $journal->amount); + if ($journal->destination_account->id == $account->id) { // TODO TransactionJournal cannot deliver "destination_account" + $amount = bcadd($amount, $journal->amount); // TODO TransactionJournal cannot deliver "amount". } } } @@ -376,10 +376,10 @@ class TagRepository implements TagRepositoryInterface foreach ($tag->transactionjournals as $check) { // $checkAccount is the source_account for a withdrawal // $checkAccount is the destination_account for a deposit - if ($check->isWithdrawal() && $check->source_account->id != $journal->destination_account->id) { + if ($check->isWithdrawal() && $check->source_account->id != $journal->destination_account->id) { // TODO TransactionJournal cannot deliver "source_account" $match = false; } - if ($check->isDeposit() && $check->destination_account->id != $journal->destination_account->id) { + if ($check->isDeposit() && $check->destination_account->id != $journal->destination_account->id) { // TODO TransactionJournal cannot deliver "destination_account" $match = false; } diff --git a/app/Rules/Triggers/AmountExactly.php b/app/Rules/Triggers/AmountExactly.php index 642d17a19a..b52c54b413 100644 --- a/app/Rules/Triggers/AmountExactly.php +++ b/app/Rules/Triggers/AmountExactly.php @@ -54,7 +54,7 @@ final class AmountExactly extends AbstractTrigger implements TriggerInterface */ public function triggered(TransactionJournal $journal) { - $amount = $journal->amount_positive; + $amount = $journal->amount_positive; // TODO TransactionJournal cannot deliver "amount_positive". $compare = $this->triggerValue; $result = bccomp($amount, $compare, 4); if ($result === 0) { diff --git a/app/Rules/Triggers/AmountLess.php b/app/Rules/Triggers/AmountLess.php index 2ea1a2365c..1366b4c8af 100644 --- a/app/Rules/Triggers/AmountLess.php +++ b/app/Rules/Triggers/AmountLess.php @@ -54,7 +54,7 @@ final class AmountLess extends AbstractTrigger implements TriggerInterface */ public function triggered(TransactionJournal $journal) { - $amount = $journal->amount_positive; + $amount = $journal->amount_positive; // TODO TransactionJournal cannot deliver "amount_positive". $compare = $this->triggerValue; $result = bccomp($amount, $compare, 4); if ($result === -1) { diff --git a/app/Rules/Triggers/AmountMore.php b/app/Rules/Triggers/AmountMore.php index 5b41b9e7c5..8bda7fefa1 100644 --- a/app/Rules/Triggers/AmountMore.php +++ b/app/Rules/Triggers/AmountMore.php @@ -54,7 +54,7 @@ final class AmountMore extends AbstractTrigger implements TriggerInterface */ public function triggered(TransactionJournal $journal) { - $amount = $journal->amount_positive; + $amount = $journal->amount_positive; // TODO TransactionJournal cannot deliver "amount_positive". $compare = $this->triggerValue; $result = bccomp($amount, $compare, 4); if ($result === 1) { diff --git a/app/Rules/Triggers/FromAccountContains.php b/app/Rules/Triggers/FromAccountContains.php index 012ef8d249..cd368bc6b7 100644 --- a/app/Rules/Triggers/FromAccountContains.php +++ b/app/Rules/Triggers/FromAccountContains.php @@ -53,7 +53,7 @@ final class FromAccountContains extends AbstractTrigger implements TriggerInterf */ public function triggered(TransactionJournal $journal) { - $fromAccountName = strtolower($journal->source_account->name); + $fromAccountName = strtolower($journal->source_account->name);// TODO TransactionJournal cannot deliver "source_account" $search = strtolower($this->triggerValue); $strpos = strpos($fromAccountName, $search); diff --git a/app/Rules/Triggers/FromAccountEnds.php b/app/Rules/Triggers/FromAccountEnds.php index fd3e152321..47682a120a 100644 --- a/app/Rules/Triggers/FromAccountEnds.php +++ b/app/Rules/Triggers/FromAccountEnds.php @@ -53,7 +53,7 @@ final class FromAccountEnds extends AbstractTrigger implements TriggerInterface */ public function triggered(TransactionJournal $journal) { - $name = strtolower($journal->source_account->name); + $name = strtolower($journal->source_account->name);// TODO TransactionJournal cannot deliver "source_account" $nameLength = strlen($name); $search = strtolower($this->triggerValue); $searchLength = strlen($search); diff --git a/app/Rules/Triggers/FromAccountStarts.php b/app/Rules/Triggers/FromAccountStarts.php index aa24d02973..4238215995 100644 --- a/app/Rules/Triggers/FromAccountStarts.php +++ b/app/Rules/Triggers/FromAccountStarts.php @@ -53,7 +53,7 @@ final class FromAccountStarts extends AbstractTrigger implements TriggerInterfac */ public function triggered(TransactionJournal $journal) { - $fromAccountName = strtolower($journal->source_account->name); + $fromAccountName = strtolower($journal->source_account->name);// TODO TransactionJournal cannot deliver "source_account" $search = strtolower($this->triggerValue); $part = substr($fromAccountName, 0, strlen($search)); diff --git a/app/Rules/Triggers/ToAccountContains.php b/app/Rules/Triggers/ToAccountContains.php index a8f580f136..50f38a1ec6 100644 --- a/app/Rules/Triggers/ToAccountContains.php +++ b/app/Rules/Triggers/ToAccountContains.php @@ -53,7 +53,7 @@ final class ToAccountContains extends AbstractTrigger implements TriggerInterfac */ public function triggered(TransactionJournal $journal) { - $toAccountName = strtolower($journal->destination_account->name); + $toAccountName = strtolower($journal->destination_account->name); // TODO TransactionJournal cannot deliver "destination_account" $search = strtolower($this->triggerValue); $strpos = strpos($toAccountName, $search); diff --git a/app/Rules/Triggers/ToAccountEnds.php b/app/Rules/Triggers/ToAccountEnds.php index 1179f415e4..17dbb05233 100644 --- a/app/Rules/Triggers/ToAccountEnds.php +++ b/app/Rules/Triggers/ToAccountEnds.php @@ -53,7 +53,7 @@ final class ToAccountEnds extends AbstractTrigger implements TriggerInterface */ public function triggered(TransactionJournal $journal) { - $toAccountName = strtolower($journal->destination_account->name); + $toAccountName = strtolower($journal->destination_account->name); // TODO TransactionJournal cannot deliver "destination_account" $toAccountNameLength = strlen($toAccountName); $search = strtolower($this->triggerValue); $searchLength = strlen($search); diff --git a/app/Rules/Triggers/ToAccountIs.php b/app/Rules/Triggers/ToAccountIs.php index 65215ba9f5..206ed27515 100644 --- a/app/Rules/Triggers/ToAccountIs.php +++ b/app/Rules/Triggers/ToAccountIs.php @@ -53,7 +53,7 @@ final class ToAccountIs extends AbstractTrigger implements TriggerInterface */ public function triggered(TransactionJournal $journal) { - $toAccountName = strtolower($journal->destination_account->name); + $toAccountName = strtolower($journal->destination_account->name); // TODO TransactionJournal cannot deliver "destination_account" $search = strtolower($this->triggerValue); if ($toAccountName == $search) { diff --git a/app/Rules/Triggers/ToAccountStarts.php b/app/Rules/Triggers/ToAccountStarts.php index c5ec517544..21f4133354 100644 --- a/app/Rules/Triggers/ToAccountStarts.php +++ b/app/Rules/Triggers/ToAccountStarts.php @@ -53,7 +53,7 @@ final class ToAccountStarts extends AbstractTrigger implements TriggerInterface */ public function triggered(TransactionJournal $journal) { - $toAccountName = strtolower($journal->destination_account->name); + $toAccountName = strtolower($journal->destination_account->name); // TODO TransactionJournal cannot deliver "destination_account" $search = strtolower($this->triggerValue); $part = substr($toAccountName, 0, strlen($search)); diff --git a/app/Support/Search/Search.php b/app/Support/Search/Search.php index 5af6acd5d1..17446d7e1d 100644 --- a/app/Support/Search/Search.php +++ b/app/Support/Search/Search.php @@ -103,7 +103,7 @@ class Search implements SearchInterface public function searchTransactions(array $words): Collection { // decrypted transaction journals: - $decrypted = Auth::user()->transactionjournals()->withRelevantData()->where('encrypted', 0)->where( + $decrypted = Auth::user()->transactionjournals()->withRelevantData()->where('encrypted', 0)->where( // TODO firefly will crash here. function (EloquentBuilder $q) use ($words) { foreach ($words as $word) { $q->orWhere('description', 'LIKE', '%' . e($word) . '%'); @@ -112,7 +112,7 @@ class Search implements SearchInterface )->get(); // encrypted - $all = Auth::user()->transactionjournals()->withRelevantData()->where('encrypted', 1)->get(); + $all = Auth::user()->transactionjournals()->withRelevantData()->where('encrypted', 1)->get(); // TODO firefly will crash here. $set = $all->filter( function (TransactionJournal $journal) use ($words) { foreach ($words as $word) {