Skip to content

Firefly III: a personal finances manager

Various code cleanup.

James Colec8a87833c61b
diff --git a/app/Generator/Report/Account/MonthReportGenerator.php b/app/Generator/Report/Account/MonthReportGenerator.php
index 34c7c63b74..e8af125c61 100644
--- a/app/Generator/Report/Account/MonthReportGenerator.php
+++ b/app/Generator/Report/Account/MonthReportGenerator.php
@@ -35,14 +35,10 @@ use Throwable;
*/
class MonthReportGenerator implements ReportGeneratorInterface
{
- /** @var Collection The accounts involved in the report. */
- private $accounts;
- /** @var Carbon The end date */
- private $end;
- /** @var Collection The expense accounts. */
- private $expense;
- /** @var Carbon The start date. */
- private $start;
+ private Collection $accounts;
+ private Carbon $end;
+ private Collection $expense;
+ private Carbon $start;
/**
* Generate the report.
diff --git a/app/Generator/Report/Budget/MonthReportGenerator.php b/app/Generator/Report/Budget/MonthReportGenerator.php
index 4bb58e507c..e44cce9469 100644
--- a/app/Generator/Report/Budget/MonthReportGenerator.php
+++ b/app/Generator/Report/Budget/MonthReportGenerator.php
@@ -41,16 +41,11 @@ use Throwable;
*/
class MonthReportGenerator implements ReportGeneratorInterface
{
- /** @var Collection The accounts in the report. */
- private $accounts;
- /** @var Collection The budgets in the report. */
- private $budgets;
- /** @var Carbon The end date. */
- private $end;
- /** @var array The expenses in the report. */
- private $expenses;
- /** @var Carbon The start date. */
- private $start;
+ private Collection $accounts;
+ private Collection $budgets;
+ private Carbon $end;
+ private array $expenses;
+ private Carbon $start;
/**
* MonthReportGenerator constructor.
diff --git a/app/Helpers/Collector/GroupCollector.php b/app/Helpers/Collector/GroupCollector.php
index 543701d9db..d0b1729589 100644
--- a/app/Helpers/Collector/GroupCollector.php
+++ b/app/Helpers/Collector/GroupCollector.php
@@ -244,20 +244,6 @@ class GroupCollector implements GroupCollectorInterface
return $this;
}
- /**
- * Limit the result to a specific transaction group.
- *
- * @param TransactionGroup $transactionGroup
- *
- * @return GroupCollectorInterface
- */
- public function setGroup(TransactionGroup $transactionGroup): GroupCollectorInterface
- {
- $this->query->where('transaction_groups.id', $transactionGroup->id);
-
- return $this;
- }
-
/**
* Limit the result to a set of specific journals.
*
diff --git a/app/Helpers/Collector/GroupCollectorInterface.php b/app/Helpers/Collector/GroupCollectorInterface.php
index 23f4c4f4ac..97e8029457 100644
--- a/app/Helpers/Collector/GroupCollectorInterface.php
+++ b/app/Helpers/Collector/GroupCollectorInterface.php
@@ -238,15 +238,6 @@ interface GroupCollectorInterface
*/
public function setDestinationAccounts(Collection $accounts): GroupCollectorInterface;
- /**
- * Limit the result to a specific transaction group.
- *
- * @param TransactionGroup $transactionGroup
- *
- * @return GroupCollectorInterface
- */
- public function setGroup(TransactionGroup $transactionGroup): GroupCollectorInterface;
-
/**
* Limit the result to a set of specific transaction journals.
*
diff --git a/app/Http/Controllers/Budget/AvailableBudgetController.php b/app/Http/Controllers/Budget/AvailableBudgetController.php
index 324d7de3a5..cd00d2b196 100644
--- a/app/Http/Controllers/Budget/AvailableBudgetController.php
+++ b/app/Http/Controllers/Budget/AvailableBudgetController.php
@@ -111,7 +111,7 @@ class AvailableBudgetController extends Controller
*/
public function createAlternative(Request $request, Carbon $start, Carbon $end)
{
- $currencies = $this->currencyRepos->getEnabled();
+ $currencies = $this->currencyRepos->get();
$availableBudgets = $this->abRepository->get($start, $end);
// remove already budgeted currencies:
diff --git a/app/Http/Controllers/Budget/BudgetLimitController.php b/app/Http/Controllers/Budget/BudgetLimitController.php
index 5e25cdbdb4..0647658859 100644
--- a/app/Http/Controllers/Budget/BudgetLimitController.php
+++ b/app/Http/Controllers/Budget/BudgetLimitController.php
@@ -86,7 +86,7 @@ class BudgetLimitController extends Controller
*/
public function create(Budget $budget, Carbon $start, Carbon $end)
{
- $collection = $this->currencyRepos->getEnabled();
+ $collection = $this->currencyRepos->get();
$budgetLimits = $this->blRepository->getBudgetLimits($budget, $start, $end);
// remove already budgeted currencies:
diff --git a/app/Http/Controllers/Budget/IndexController.php b/app/Http/Controllers/Budget/IndexController.php
index 8f4222a979..c55e0b61e9 100644
--- a/app/Http/Controllers/Budget/IndexController.php
+++ b/app/Http/Controllers/Budget/IndexController.php
@@ -99,7 +99,7 @@ class IndexController extends Controller
$start = $start ?? session('start', Carbon::now()->startOfMonth());
$end = $end ?? app('navigation')->endOfPeriod($start, $range);
$defaultCurrency = app('amount')->getDefaultCurrency();
- $currencies = $this->currencyRepository->getEnabled();
+ $currencies = $this->currencyRepository->get();
$budgeted = '0';
$spent = '0';
diff --git a/app/Http/Middleware/StartFireflySession.php b/app/Http/Middleware/StartFireflySession.php
index ba72763e6e..7d205367c1 100644
--- a/app/Http/Middleware/StartFireflySession.php
+++ b/app/Http/Middleware/StartFireflySession.php
@@ -55,7 +55,6 @@ class StartFireflySession extends StartSession
&& 'GET' === $request->method()
&& !$request->ajax()) {
$session->setPreviousUrl($uri);
- return;
}
}
}
diff --git a/app/Repositories/Currency/CurrencyRepository.php b/app/Repositories/Currency/CurrencyRepository.php
index 038cd8d106..815f1ba3df 100644
--- a/app/Repositories/Currency/CurrencyRepository.php
+++ b/app/Repositories/Currency/CurrencyRepository.php
@@ -401,14 +401,6 @@ class CurrencyRepository implements CurrencyRepositoryInterface
return $preferred;
}
- /**
- * @return Collection
- */
- public function getEnabled(): Collection
- {
- return TransactionCurrency::where('enabled', true)->orderBy('code', 'ASC')->get();
- }
-
/**
* Get currency exchange rate.
*
diff --git a/app/Repositories/Currency/CurrencyRepositoryInterface.php b/app/Repositories/Currency/CurrencyRepositoryInterface.php
index 440257fa34..60d3eb7760 100644
--- a/app/Repositories/Currency/CurrencyRepositoryInterface.php
+++ b/app/Repositories/Currency/CurrencyRepositoryInterface.php
@@ -203,11 +203,6 @@ interface CurrencyRepositoryInterface
*/
public function getCurrencyByPreference(Preference $preference): TransactionCurrency;
- /**
- * @return Collection
- */
- public function getEnabled(): Collection;
-
/**
* Get currency exchange rate.
*
diff --git a/app/Support/Form/AccountForm.php b/app/Support/Form/AccountForm.php
index 78915668db..314e396472 100644
--- a/app/Support/Form/AccountForm.php
+++ b/app/Support/Form/AccountForm.php
@@ -72,41 +72,6 @@ class AccountForm
return $grouped;
}
- /**
- * Shows a <select> with all active asset accounts.
- *
- * @param string $name
- * @param mixed $value
- * @param array $options
- *
- * @return string
- */
- public function activeAssetAccountList(string $name, $value = null, array $options = null): string
- {
- $types = [AccountType::ASSET, AccountType::DEFAULT];
- $grouped = $this->getAccountsGrouped($types);
-
- return $this->select($name, $grouped, $value, $options);
- }
-
-
- /**
- * Return a list that includes liabilities.
- *
- * @param string $name
- * @param mixed $value
- * @param array $options
- *
- * @return string
- */
- public function activeLongAccountList(string $name, $value = null, array $options = null): string
- {
- $types = [AccountType::ASSET, AccountType::DEFAULT, AccountType::MORTGAGE, AccountType::DEBT, AccountType::CREDITCARD, AccountType::LOAN,];
- $grouped = $this->getAccountsGrouped($types);
-
- return $this->select($name, $grouped, $value, $options);
- }
-
/**
* Grouped dropdown list of all accounts that are valid as the destination of a withdrawal.
*
diff --git a/composer.lock b/composer.lock
index e3c558a84e..8926a69e3c 100644
--- a/composer.lock
+++ b/composer.lock
@@ -1182,16 +1182,16 @@
},
{
"name": "gdbots/query-parser",
- "version": "v2.0.1",
+ "version": "v2.0.2",
"source": {
"type": "git",
"url": "https://github.com/gdbots/query-parser-php.git",
- "reference": "21fffb3dae156792c0ffe5d4c2ba25e7607ac264"
+ "reference": "d35cb9ae613ee8d6a94b5758fb0047668ab1d34c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/gdbots/query-parser-php/zipball/21fffb3dae156792c0ffe5d4c2ba25e7607ac264",
- "reference": "21fffb3dae156792c0ffe5d4c2ba25e7607ac264",
+ "url": "https://api.github.com/repos/gdbots/query-parser-php/zipball/d35cb9ae613ee8d6a94b5758fb0047668ab1d34c",
+ "reference": "d35cb9ae613ee8d6a94b5758fb0047668ab1d34c",
"shasum": ""
},
"require": {
@@ -1215,9 +1215,9 @@
"homepage": "https://github.com/gdbots/query-parser-php",
"support": {
"issues": "https://github.com/gdbots/query-parser-php/issues",
- "source": "https://github.com/gdbots/query-parser-php/tree/v2.0.1"
+ "source": "https://github.com/gdbots/query-parser-php/tree/v2.0.2"
},
- "time": "2020-10-18T02:58:06+00:00"
+ "time": "2020-10-30T23:41:54+00:00"
},
{
"name": "graham-campbell/result-type",
@@ -7012,16 +7012,16 @@
},
{
"name": "composer/composer",
- "version": "2.0.3",
+ "version": "2.0.4",
"source": {
"type": "git",
"url": "https://github.com/composer/composer.git",
- "reference": "f7eebdd092873f5d63929f21183e69ec9f5e83cd"
+ "reference": "4053eab90a7cdf0b81dd93073dc6c18c15d487fd"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/composer/composer/zipball/f7eebdd092873f5d63929f21183e69ec9f5e83cd",
- "reference": "f7eebdd092873f5d63929f21183e69ec9f5e83cd",
+ "url": "https://api.github.com/repos/composer/composer/zipball/4053eab90a7cdf0b81dd93073dc6c18c15d487fd",
+ "reference": "4053eab90a7cdf0b81dd93073dc6c18c15d487fd",
"shasum": ""
},
"require": {
@@ -7089,7 +7089,7 @@
"support": {
"irc": "irc://irc.freenode.org/composer",
"issues": "https://github.com/composer/composer/issues",
- "source": "https://github.com/composer/composer/tree/2.0.3"
+ "source": "https://github.com/composer/composer/tree/2.0.4"
},
"funding": [
{
@@ -7105,7 +7105,7 @@
"type": "tidelift"
}
],
- "time": "2020-10-28T14:50:56+00:00"
+ "time": "2020-10-30T21:39:11+00:00"
},
{
"name": "composer/package-versions-deprecated",
diff --git a/config/twigbridge.php b/config/twigbridge.php
index 494c8c8d74..1c0352a489 100644
--- a/config/twigbridge.php
+++ b/config/twigbridge.php
@@ -194,8 +194,7 @@ return [
],
'AccountForm' => [
'is_safe' => [
- 'activeAssetAccountList', 'activeLongAccountList', 'activeWithdrawalDestinations', 'activeDepositDestinations',
- 'assetAccountCheckList', 'assetAccountList', 'longAccountList',
+ 'activeWithdrawalDestinations', 'activeDepositDestinations', 'assetAccountCheckList', 'assetAccountList', 'longAccountList',
],
],
'CurrencyForm' => [
diff --git a/resources/views/v1/piggy-banks/create.twig b/resources/views/v1/piggy-banks/create.twig
index 40043c920e..0b8a2dad0e 100644
--- a/resources/views/v1/piggy-banks/create.twig
+++ b/resources/views/v1/piggy-banks/create.twig
@@ -18,7 +18,7 @@
<div class="box-body">
{{ ExpandedForm.text('name') }}
- {{ AccountForm.activeAssetAccountList('account_id', null, {label: 'saveOnAccount'|_ }) }}
+ {{ AccountForm.assetAccountList('account_id', null, {label: 'saveOnAccount'|_ }) }}
{{ ExpandedForm.amountNoCurrency('targetamount') }}
</div>
diff --git a/resources/views/v1/recurring/create.twig b/resources/views/v1/recurring/create.twig
index b972eca6d4..e7b041f9aa 100644
--- a/resources/views/v1/recurring/create.twig
+++ b/resources/views/v1/recurring/create.twig
@@ -90,13 +90,13 @@
{{ ExpandedForm.amountNoCurrency('amount') }}
{# source account if withdrawal, or if transfer: #}
- {{ AccountForm.activeLongAccountList('source_id', null, {label: trans('form.asset_source_account')}) }}
+ {{ AccountForm.longAccountList('source_id', null, {label: trans('form.asset_source_account')}) }}
{# for deposits, a drop down with revenue accounts, loan debt cash and mortgage #}
{{ AccountForm.activeDepositDestinations('deposit_source_id', null, {label: trans('form.deposit_source_id')}) }}
{# destination if deposit or transfer: #}
- {{ AccountForm.activeLongAccountList('destination_id', null, {label: trans('form.asset_destination_account')} ) }}
+ {{ AccountForm.longAccountList('destination_id', null, {label: trans('form.asset_destination_account')} ) }}
{# destination account name for withdrawals #}
{#{{ ExpandedForm.text('destination_name', null, {label: trans('form.expense_account')}) }} #}