Skip to content

Firefly III: a personal finances manager

Fix popup in report helper

James Cole8220d491f9b1
diff --git a/app/Helpers/Report/PopupReport.php b/app/Helpers/Report/PopupReport.php
index 414cd57d78..674d72c10a 100644
--- a/app/Helpers/Report/PopupReport.php
+++ b/app/Helpers/Report/PopupReport.php
@@ -46,11 +46,10 @@ class PopupReport implements PopupReportInterface
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector->setAccounts(new Collection()->push($account))
- ->withAccountInformation()
- ->withBudgetInformation()
- ->withCategoryInformation()
- ->setRange($attributes['startDate'], $attributes['endDate'])->setBudget($budget)
- ;
+ ->withAccountInformation()
+ ->withBudgetInformation()
+ ->withCategoryInformation()
+ ->setRange($attributes['startDate'], $attributes['endDate'])->setBudget($budget);
return $collector->getExtractedJournals();
}
@@ -66,19 +65,18 @@ class PopupReport implements PopupReportInterface
if (null !== $currencyId) {
/** @var CurrencyRepositoryInterface $repos */
$repos = app(CurrencyRepositoryInterface::class);
- $currency = $repos->find((int) $currencyId);
+ $currency = $repos->find((int)$currencyId);
}
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector
->setAccounts(new Collection()->push($account))
->setTypes([TransactionTypeEnum::WITHDRAWAL->value])
->withAccountInformation()
->withCategoryInformation()
->setRange($attributes['startDate'], $attributes['endDate'])
- ->withoutBudget()
- ;
+ ->withoutBudget();
if (null !== $currency) {
$collector->setCurrency($currency);
@@ -98,18 +96,17 @@ class PopupReport implements PopupReportInterface
if (null !== $currencyId) {
/** @var CurrencyRepositoryInterface $repos */
$repos = app(CurrencyRepositoryInterface::class);
- $currency = $repos->find((int) $currencyId);
+ $currency = $repos->find((int)$currencyId);
}
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector
->setAccounts($attributes['accounts'])
->withAccountInformation()
->withBudgetInformation()
->withCategoryInformation()
- ->setRange($attributes['startDate'], $attributes['endDate'])
- ;
+ ->setRange($attributes['startDate'], $attributes['endDate']);
if (null !== $currency) {
$collector->setCurrency($currency);
@@ -135,19 +132,18 @@ class PopupReport implements PopupReportInterface
if (null !== $currencyId) {
/** @var CurrencyRepositoryInterface $repos */
$repos = app(CurrencyRepositoryInterface::class);
- $currency = $repos->find((int) $currencyId);
+ $currency = $repos->find((int)$currencyId);
}
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setAccounts($attributes['accounts'])
- ->setTypes([TransactionTypeEnum::WITHDRAWAL->value, TransactionTypeEnum::TRANSFER->value, TransactionTypeEnum::DEPOSIT->value])
- ->withAccountInformation()
- ->withBudgetInformation()
- ->withCategoryInformation()
- ->setRange($attributes['startDate'], $attributes['endDate'])->withAccountInformation()
- ;
+ ->setTypes([TransactionTypeEnum::WITHDRAWAL->value, TransactionTypeEnum::TRANSFER->value, TransactionTypeEnum::DEPOSIT->value])
+ ->withAccountInformation()
+ ->withBudgetInformation()
+ ->withCategoryInformation()
+ ->setRange($attributes['startDate'], $attributes['endDate'])->withAccountInformation();
if ($category instanceof Category) {
$collector->setCategory($category);
@@ -169,35 +165,35 @@ class PopupReport implements PopupReportInterface
public function byExpenses(Account $account, array $attributes): array
{
// filter by currency, if set.
- $currencyId = $attributes['currencyId'] ?? null;
- $currency = null;
+ $currencyId = $attributes['currencyId'] ?? null;
+ $currency = null;
if (null !== $currencyId) {
/** @var CurrencyRepositoryInterface $repos */
$repos = app(CurrencyRepositoryInterface::class);
- $currency = $repos->find((int) $currencyId);
+ $currency = $repos->find((int)$currencyId);
}
+
/** @var JournalRepositoryInterface $repository */
- $repository = app(JournalRepositoryInterface::class);
+ $repository = app(JournalRepositoryInterface::class);
$repository->setUser($account->user);
$accountRepository = app(AccountRepositoryInterface::class);
$accountRepository->setUser($account->user);
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
- // set report accounts + the request accounts:
- // $set = $attributes['accounts'] ?? new Collection;
- // $set->push($account);
+ // the source account must be in the set.
+ $set = $attributes['accounts'] ?? new Collection;
$collector->setDestinationAccounts(new Collection()->push($account))
- ->setRange($attributes['startDate'], $attributes['endDate'])
- ->withAccountInformation()
- ->withBudgetInformation()
- ->withCategoryInformation()
- ->setTypes([TransactionTypeEnum::WITHDRAWAL->value, TransactionTypeEnum::TRANSFER->value])
- ;
+ ->setSourceAccounts($set)
+ ->setRange($attributes['startDate'], $attributes['endDate'])
+ ->withAccountInformation()
+ ->withBudgetInformation()
+ ->withCategoryInformation()
+ ->setTypes([TransactionTypeEnum::WITHDRAWAL->value, TransactionTypeEnum::TRANSFER->value]);
if (null !== $currency) {
$collector->setCurrency($currency);
@@ -216,7 +212,7 @@ class PopupReport implements PopupReportInterface
$repository->setUser($account->user);
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector
->setSourceAccounts(new Collection()->push($account))
->setDestinationAccounts($attributes['accounts'])
@@ -225,8 +221,7 @@ class PopupReport implements PopupReportInterface
->withAccountInformation()
->withBudgetInformation()
->withCategoryInformation()
- ->withAccountInformation()
- ;
+ ->withAccountInformation();
return $collector->getExtractedJournals();
}
diff --git a/app/Support/Http/Controllers/RenderPartialViews.php b/app/Support/Http/Controllers/RenderPartialViews.php
index 962e9d5155..b831727b81 100644
--- a/app/Support/Http/Controllers/RenderPartialViews.php
+++ b/app/Support/Http/Controllers/RenderPartialViews.php
@@ -245,7 +245,6 @@ trait RenderPartialViews
if (null === $account) {
return 'This is an unknown account. Apologies.';
}
-
$journals = $popupHelper->byExpenses($account, $attributes);
try {