Update journal collector so currency information is taken from the transaction.

This commit is contained in:
James Cole 2017-06-04 08:49:37 +02:00
parent 4ce4c3138c
commit 771ebde295
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E

View File

@ -60,7 +60,6 @@ class JournalCollector implements JournalCollectorInterface
'transaction_journals.description',
'transaction_journals.date',
'transaction_journals.encrypted',
'transaction_currencies.code as transaction_currency_code',
'transaction_types.type as transaction_type_type',
'transaction_journals.bill_id',
'bills.name as bill_name',
@ -71,6 +70,7 @@ class JournalCollector implements JournalCollectorInterface
'transactions.account_id',
'transactions.identifier',
'transactions.transaction_journal_id',
'transaction_currencies.code as transaction_currency_code',
'accounts.name as account_name',
'accounts.encrypted as account_encrypted',
'account_types.type as account_type',
@ -484,11 +484,11 @@ class JournalCollector implements JournalCollectorInterface
Log::debug('journalCollector::startQuery');
/** @var EloquentBuilder $query */
$query = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
->leftJoin('transaction_currencies', 'transaction_currencies.id', 'transaction_journals.transaction_currency_id')
->leftJoin('transaction_types', 'transaction_types.id', 'transaction_journals.transaction_type_id')
->leftJoin('bills', 'bills.id', 'transaction_journals.bill_id')
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
->leftJoin('account_types', 'accounts.account_type_id', 'account_types.id')
->leftJoin('transaction_currencies', 'transaction_currencies.id', 'transactions.transaction_currency_id')
->whereNull('transactions.deleted_at')
->whereNull('transaction_journals.deleted_at')
->where('transaction_journals.user_id', $this->user->id)