Fix some bugs related to cash accounts.

This commit is contained in:
James Cole
2016-11-19 12:57:35 +01:00
parent 781621960d
commit ee6b72afa5
6 changed files with 62 additions and 47 deletions

View File

@@ -189,9 +189,9 @@ class SingleController extends Controller
'budget_id' => TransactionJournal::budgetId($journal),
'tags' => join(',', $journal->tags->pluck('tag')->toArray()),
'source_account_id' => $sourceAccounts->first()->id,
'source_account_name' => $sourceAccounts->first()->name,
'source_account_name' => $sourceAccounts->first()->edit_name,
'destination_account_id' => $destinationAccounts->first()->id,
'destination_account_name' => $destinationAccounts->first()->name,
'destination_account_name' => $destinationAccounts->first()->edit_name,
'amount' => TransactionJournal::amountPositive($journal),
// new custom fields:

View File

@@ -19,6 +19,7 @@ use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalTaskerInterface;
use Illuminate\Http\Request;
use Log;
use Preferences;
use Response;
use View;
@@ -63,8 +64,13 @@ class TransactionController extends Controller
$subTitle = trans('firefly.title_' . $what);
$page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page'));
$collector = new JournalCollector(auth()->user());
$collector->setTypes($types)->setLimit($pageSize)->setPage($page)->setAllAssetAccounts()
->withOpposingAccount();
$collector->setTypes($types)->setLimit($pageSize)->setPage($page)->setAllAssetAccounts();
// do not filter transfers if $what = transfer.
if (!in_array($what, ['transfer', 'transfers'])) {
Log::debug('Also get opposing account info.');
$collector->withOpposingAccount();
}
$journals = $collector->getPaginatedJournals();
$journals->setPath('transactions/' . $what);