mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-29 02:11:12 -06:00
More narrow result for popup. [skip ci]
This commit is contained in:
parent
b22dd29835
commit
04dee404c0
@ -212,15 +212,18 @@ class ReportController extends Controller
|
|||||||
private function incomeEntry(array $attributes): string
|
private function incomeEntry(array $attributes): string
|
||||||
{
|
{
|
||||||
/** @var AccountRepositoryInterface $repository */
|
/** @var AccountRepositoryInterface $repository */
|
||||||
$repository = app(AccountRepositoryInterface::class);
|
$repository = app(AccountRepositoryInterface::class);
|
||||||
$account = $repository->find(intval($attributes['accountId']));
|
$account = $repository->find(intval($attributes['accountId']));
|
||||||
$types = [TransactionType::DEPOSIT, TransactionType::TRANSFER];
|
$types = [TransactionType::DEPOSIT, TransactionType::TRANSFER];
|
||||||
$journals = $repository->journalsInPeriod(new Collection([$account]), $types, $attributes['startDate'], $attributes['endDate']);
|
$journals = $repository->journalsInPeriod(new Collection([$account]), $types, $attributes['startDate'], $attributes['endDate']);
|
||||||
|
$destinations = $attributes['accounts']->pluck('id')->toArray();
|
||||||
// filter for transfers and withdrawals FROM the given $account
|
// filter for transfers and withdrawals FROM the given $account
|
||||||
$journals = $journals->filter(
|
$journals = $journals->filter(
|
||||||
function (TransactionJournal $journal) use ($account) {
|
function (TransactionJournal $journal) use ($account, $destinations) {
|
||||||
if ($journal->source_account_id === $account->id) {
|
if (
|
||||||
|
$journal->source_account_id === $account->id &&
|
||||||
|
in_array($journal->destination_account_id, $destinations)
|
||||||
|
) {
|
||||||
return $journal;
|
return $journal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user