mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
This is a fix for #487
This commit is contained in:
parent
3250c4830d
commit
6fc971c4cb
@ -243,12 +243,12 @@ class AccountController extends Controller
|
|||||||
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $account->accountType->type);
|
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $account->accountType->type);
|
||||||
$subTitle = $account->name;
|
$subTitle = $account->name;
|
||||||
$range = Preferences::get('viewRange', '1M')->data;
|
$range = Preferences::get('viewRange', '1M')->data;
|
||||||
|
|
||||||
$start = session('start', Navigation::startOfPeriod(new Carbon, $range));
|
$start = session('start', Navigation::startOfPeriod(new Carbon, $range));
|
||||||
$end = session('end', Navigation::endOfPeriod(new Carbon, $range));
|
$end = session('end', Navigation::endOfPeriod(new Carbon, $range));
|
||||||
$page = intval(Input::get('page')) === 0 ? 1 : intval(Input::get('page'));
|
$page = intval(Input::get('page')) === 0 ? 1 : intval(Input::get('page'));
|
||||||
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
|
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
|
||||||
$chartUri = route('chart.account.single', [$account->id]);
|
$chartUri = route('chart.account.single', [$account->id]);
|
||||||
|
|
||||||
// grab those journals:
|
// grab those journals:
|
||||||
$collector->setAccounts(new Collection([$account]))->setRange($start, $end)->setLimit($pageSize)->setPage($page);
|
$collector->setAccounts(new Collection([$account]))->setRange($start, $end)->setLimit($pageSize)->setPage($page);
|
||||||
$journals = $collector->getPaginatedJournals();
|
$journals = $collector->getPaginatedJournals();
|
||||||
|
@ -438,7 +438,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
{
|
{
|
||||||
$amount = $data['openingBalance'];
|
$amount = $data['openingBalance'];
|
||||||
$name = $data['name'];
|
$name = $data['name'];
|
||||||
$opposing = $this->storeOpposingAccount($amount, $name);
|
$opposing = $this->storeOpposingAccount($name);
|
||||||
$transactionType = TransactionType::whereType(TransactionType::OPENING_BALANCE)->first();
|
$transactionType = TransactionType::whereType(TransactionType::OPENING_BALANCE)->first();
|
||||||
$journal = TransactionJournal::create(
|
$journal = TransactionJournal::create(
|
||||||
[
|
[
|
||||||
@ -481,17 +481,16 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
*
|
*
|
||||||
* @return Account
|
* @return Account
|
||||||
*/
|
*/
|
||||||
protected function storeOpposingAccount(float $amount, string $name): Account
|
protected function storeOpposingAccount(string $name): Account
|
||||||
{
|
{
|
||||||
$type = $amount < 0 ? 'expense' : 'revenue';
|
|
||||||
$opposingData = [
|
$opposingData = [
|
||||||
'accountType' => $type,
|
'accountType' => 'initial',
|
||||||
'name' => $name . ' initial balance',
|
'name' => $name . ' initial balance',
|
||||||
'active' => false,
|
'active' => false,
|
||||||
'iban' => '',
|
'iban' => '',
|
||||||
'virtualBalance' => 0,
|
'virtualBalance' => 0,
|
||||||
];
|
];
|
||||||
Log::debug('Going to create an opening balance opposing account');
|
Log::debug('Going to create an opening balance opposing account.');
|
||||||
|
|
||||||
return $this->storeAccount($opposingData);
|
return $this->storeAccount($opposingData);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user