mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
Code reordering and reformatting. I should really start employing style CI.
This commit is contained in:
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers\Account;
|
||||
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Http\Requests\AccountFormRequest;
|
||||
@@ -135,7 +136,7 @@ class CreateController extends Controller
|
||||
* @param AccountFormRequest $request
|
||||
*
|
||||
* @return RedirectResponse|Redirector
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function store(AccountFormRequest $request)
|
||||
{
|
||||
|
@@ -72,7 +72,7 @@ class DeleteController extends Controller
|
||||
public function delete(Account $account)
|
||||
{
|
||||
if (!$this->isEditableAccount($account)) {
|
||||
return $this->redirectAccountToAccount($account);
|
||||
return $this->redirectAccountToAccount($account);
|
||||
}
|
||||
|
||||
$typeName = config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type));
|
||||
@@ -98,7 +98,7 @@ class DeleteController extends Controller
|
||||
public function destroy(Request $request, Account $account)
|
||||
{
|
||||
if (!$this->isEditableAccount($account)) {
|
||||
return $this->redirectAccountToAccount($account);
|
||||
return $this->redirectAccountToAccount($account);
|
||||
}
|
||||
|
||||
$type = $account->accountType->type;
|
||||
|
@@ -44,9 +44,9 @@ class EditController extends Controller
|
||||
{
|
||||
use ModelInformation;
|
||||
|
||||
private AttachmentHelperInterface $attachments;
|
||||
private AttachmentHelperInterface $attachments;
|
||||
private CurrencyRepositoryInterface $currencyRepos;
|
||||
private AccountRepositoryInterface $repository;
|
||||
private AccountRepositoryInterface $repository;
|
||||
|
||||
/**
|
||||
* EditController constructor.
|
||||
@@ -82,7 +82,7 @@ class EditController extends Controller
|
||||
public function edit(Request $request, Account $account, AccountRepositoryInterface $repository)
|
||||
{
|
||||
if (!$this->isEditableAccount($account)) {
|
||||
return $this->redirectAccountToAccount($account);
|
||||
return $this->redirectAccountToAccount($account);
|
||||
}
|
||||
|
||||
$objectType = config('firefly.shortNamesByFullName')[$account->accountType->type];
|
||||
@@ -123,11 +123,11 @@ class EditController extends Controller
|
||||
$request->session()->forget('accounts.edit.fromUpdate');
|
||||
|
||||
$openingBalanceAmount = app('steam')->positive((string)$repository->getOpeningBalanceAmount($account));
|
||||
if('0' === $openingBalanceAmount) {
|
||||
if ('0' === $openingBalanceAmount) {
|
||||
$openingBalanceAmount = '';
|
||||
}
|
||||
$openingBalanceDate = $repository->getOpeningBalanceDate($account);
|
||||
$currency = $this->repository->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency();
|
||||
$openingBalanceDate = $repository->getOpeningBalanceDate($account);
|
||||
$currency = $this->repository->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency();
|
||||
|
||||
// include this account in net-worth charts?
|
||||
$includeNetWorth = $repository->getMetaValue($account, 'include_net_worth');
|
||||
@@ -144,7 +144,7 @@ class EditController extends Controller
|
||||
'opening_balance_date' => $openingBalanceDate,
|
||||
'liability_type_id' => $account->account_type_id,
|
||||
'opening_balance' => $openingBalanceAmount,
|
||||
'liability_direction' => $this->repository->getMetaValue($account, 'liability_direction'),
|
||||
'liability_direction' => $this->repository->getMetaValue($account, 'liability_direction'),
|
||||
'virtual_balance' => $account->virtual_balance,
|
||||
'currency_id' => $currency->id,
|
||||
'include_net_worth' => $includeNetWorth,
|
||||
@@ -185,7 +185,7 @@ class EditController extends Controller
|
||||
public function update(AccountFormRequest $request, Account $account)
|
||||
{
|
||||
if (!$this->isEditableAccount($account)) {
|
||||
return $this->redirectAccountToAccount($account);
|
||||
return $this->redirectAccountToAccount($account);
|
||||
}
|
||||
|
||||
$data = $request->getAccountData();
|
||||
@@ -204,7 +204,7 @@ class EditController extends Controller
|
||||
}
|
||||
|
||||
if (count($this->attachments->getMessages()->get('attachments')) > 0) {
|
||||
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments'));
|
||||
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments'));
|
||||
}
|
||||
|
||||
// redirect
|
||||
|
@@ -25,6 +25,7 @@ namespace FireflyIII\Http\Controllers\Account;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Exception;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
@@ -72,7 +73,7 @@ class IndexController extends Controller
|
||||
* @param string $objectType
|
||||
*
|
||||
* @return Factory|View
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function inactive(Request $request, string $objectType)
|
||||
{
|
||||
@@ -160,13 +161,15 @@ class IndexController extends Controller
|
||||
|
||||
$accounts->each(
|
||||
function (Account $account) use ($activities, $startBalances, $endBalances) {
|
||||
// See reference nr. 68
|
||||
// See reference nr. 68
|
||||
$account->lastActivityDate = $this->isInArray($activities, $account->id);
|
||||
$account->startBalance = $this->isInArray($startBalances, $account->id);
|
||||
$account->endBalance = $this->isInArray($endBalances, $account->id);
|
||||
$account->difference = bcsub($account->endBalance, $account->startBalance);
|
||||
$account->interest = number_format((float)$this->repository->getMetaValue($account, 'interest'), 4, '.', '');
|
||||
$account->interestPeriod = (string)trans(sprintf('firefly.interest_calc_%s', $this->repository->getMetaValue($account, 'interest_period')));
|
||||
$account->interestPeriod = (string)trans(
|
||||
sprintf('firefly.interest_calc_%s', $this->repository->getMetaValue($account, 'interest_period'))
|
||||
);
|
||||
$account->accountTypeString = (string)trans(sprintf('firefly.account_type_%s', $account->accountType->type));
|
||||
$account->location = $this->repository->getLocation($account);
|
||||
$account->liability_direction = $this->repository->getMetaValue($account, 'liability_direction');
|
||||
|
@@ -91,7 +91,7 @@ class ReconcileController extends Controller
|
||||
public function reconcile(Account $account, Carbon $start = null, Carbon $end = null)
|
||||
{
|
||||
if (!$this->isEditableAccount($account)) {
|
||||
return $this->redirectAccountToAccount($account);
|
||||
return $this->redirectAccountToAccount($account);
|
||||
}
|
||||
if (AccountType::ASSET !== $account->accountType->type) {
|
||||
|
||||
@@ -169,7 +169,7 @@ class ReconcileController extends Controller
|
||||
public function submit(ReconciliationStoreRequest $request, Account $account, Carbon $start, Carbon $end)
|
||||
{
|
||||
if (!$this->isEditableAccount($account)) {
|
||||
return $this->redirectAccountToAccount($account);
|
||||
return $this->redirectAccountToAccount($account);
|
||||
}
|
||||
|
||||
Log::debug('In ReconcileController::submit()');
|
||||
@@ -218,7 +218,7 @@ class ReconcileController extends Controller
|
||||
private function createReconciliation(Account $account, Carbon $start, Carbon $end, string $difference)
|
||||
{
|
||||
if (!$this->isEditableAccount($account)) {
|
||||
return $this->redirectAccountToAccount($account);
|
||||
return $this->redirectAccountToAccount($account);
|
||||
}
|
||||
|
||||
$reconciliation = $this->accountRepos->getReconciliation($account);
|
||||
|
@@ -91,7 +91,7 @@ class ShowController extends Controller
|
||||
$objectType = config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type));
|
||||
|
||||
if (!$this->isEditableAccount($account)) {
|
||||
return $this->redirectAccountToAccount($account);
|
||||
return $this->redirectAccountToAccount($account);
|
||||
}
|
||||
|
||||
/** @var Carbon $start */
|
||||
@@ -100,7 +100,7 @@ class ShowController extends Controller
|
||||
$end = $end ?? session('end');
|
||||
|
||||
if ($end < $start) {
|
||||
[$start, $end] = [$end, $start];
|
||||
[$start, $end] = [$end, $start];
|
||||
}
|
||||
$location = $this->repository->getLocation($account);
|
||||
$attachments = $this->repository->getAttachments($account);
|
||||
@@ -164,7 +164,7 @@ class ShowController extends Controller
|
||||
public function showAll(Request $request, Account $account)
|
||||
{
|
||||
if (!$this->isEditableAccount($account)) {
|
||||
return $this->redirectAccountToAccount($account);
|
||||
return $this->redirectAccountToAccount($account);
|
||||
}
|
||||
$location = $this->repository->getLocation($account);
|
||||
$isLiability = $this->repository->isLiability($account);
|
||||
|
Reference in New Issue
Block a user