From affa9014d248a61a45894031604bd594a2348be5 Mon Sep 17 00:00:00 2001 From: James Cole Date: Thu, 11 Sep 2014 21:59:27 +0200 Subject: [PATCH] Repositories can now deal with new account types. --- .../EloquentTransactionJournalRepository.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/lib/Firefly/Storage/TransactionJournal/EloquentTransactionJournalRepository.php b/app/lib/Firefly/Storage/TransactionJournal/EloquentTransactionJournalRepository.php index 542bac96e4..2830db6c29 100644 --- a/app/lib/Firefly/Storage/TransactionJournal/EloquentTransactionJournalRepository.php +++ b/app/lib/Firefly/Storage/TransactionJournal/EloquentTransactionJournalRepository.php @@ -84,7 +84,7 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito $journalType = \TransactionType::where('type', 'Opening balance')->first(); break; - case ($fromAT == 'Default account' && $toAT == 'Default account'): // both are yours: + case (in_array($fromAT,['Default account','Asset account']) && in_array($toAT,['Default account','Asset account'])): // both are yours: // determin transaction type. If both accounts are new, it's an initial balance transfer. $journalType = \TransactionType::where('type', 'Transfer')->first(); break; @@ -92,11 +92,11 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito $journalType = \TransactionType::where('type', 'Deposit')->first(); break; // is deposit into one of your own accounts: - case ($toAT == 'Default account'): + case ($toAT == 'Default account' || $toAT == 'Asset account'): $journalType = \TransactionType::where('type', 'Deposit')->first(); break; // is withdrawal from one of your own accounts: - case ($fromAT == 'Default account'): + case ($fromAT == 'Default account' || $fromAT == 'Asset account'): $journalType = \TransactionType::where('type', 'Withdrawal')->first(); break; }