mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Various code cleanup.
This commit is contained in:
parent
55c8b9012c
commit
c8a87833c6
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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';
|
||||
|
||||
|
@ -55,7 +55,6 @@ class StartFireflySession extends StartSession
|
||||
&& 'GET' === $request->method()
|
||||
&& !$request->ajax()) {
|
||||
$session->setPreviousUrl($uri);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -203,11 +203,6 @@ interface CurrencyRepositoryInterface
|
||||
*/
|
||||
public function getCurrencyByPreference(Preference $preference): TransactionCurrency;
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getEnabled(): Collection;
|
||||
|
||||
/**
|
||||
* Get currency exchange rate.
|
||||
*
|
||||
|
@ -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.
|
||||
*
|
||||
|
24
composer.lock
generated
24
composer.lock
generated
@ -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",
|
||||
|
@ -194,8 +194,7 @@ return [
|
||||
],
|
||||
'AccountForm' => [
|
||||
'is_safe' => [
|
||||
'activeAssetAccountList', 'activeLongAccountList', 'activeWithdrawalDestinations', 'activeDepositDestinations',
|
||||
'assetAccountCheckList', 'assetAccountList', 'longAccountList',
|
||||
'activeWithdrawalDestinations', 'activeDepositDestinations', 'assetAccountCheckList', 'assetAccountList', 'longAccountList',
|
||||
],
|
||||
],
|
||||
'CurrencyForm' => [
|
||||
|
@ -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>
|
||||
|
@ -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')}) }} #}
|
||||
|
Loading…
Reference in New Issue
Block a user