mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Moved another method.
This commit is contained in:
parent
a866d13b75
commit
85dc7f3643
@ -127,7 +127,7 @@ class AccountController extends Controller
|
||||
$what = config('firefly.shortNamesByFullName')[$account->accountType->type];
|
||||
$subTitle = trans('firefly.edit_' . $what . '_account', ['name' => $account->name]);
|
||||
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $what);
|
||||
$openingBalance = $repository->openingBalanceTransaction($account);
|
||||
$openingBalance = $account->openingBalanceTransaction($account);
|
||||
|
||||
// put previous url in session if not redirect from store (not "return_to_edit").
|
||||
if (session('accounts.edit.fromUpdate') !== true) {
|
||||
|
@ -158,23 +158,4 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
return $first;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Account $account
|
||||
*
|
||||
* @return TransactionJournal|null
|
||||
*/
|
||||
public function openingBalanceTransaction(Account $account): TransactionJournal
|
||||
{
|
||||
$journal = TransactionJournal
|
||||
::sortCorrectly()
|
||||
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->where('transactions.account_id', $account->id)
|
||||
->transactionTypes([TransactionType::OPENING_BALANCE])
|
||||
->first(['transaction_journals.*']);
|
||||
if (is_null($journal)) {
|
||||
return new TransactionJournal;
|
||||
}
|
||||
|
||||
return $journal;
|
||||
}
|
||||
}
|
||||
|
@ -78,12 +78,4 @@ interface AccountRepositoryInterface
|
||||
*/
|
||||
public function oldestJournalDate(Account $account): Carbon;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param Account $account
|
||||
*
|
||||
* @return TransactionJournal
|
||||
*/
|
||||
public function openingBalanceTransaction(Account $account) : TransactionJournal;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user