mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-22 20:16:22 +00:00
Make sure sorting doesnt break opening balance.
This commit is contained in:
@@ -697,4 +697,20 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
|
||||
return TransactionCurrency::whereIn('id', $currencyIds)->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function resetAccountOrder(array $types): void
|
||||
{
|
||||
$list = $this->getAccountsByType($types);
|
||||
/**
|
||||
* @var int $index
|
||||
* @var Account $account
|
||||
*/
|
||||
foreach ($list as $index => $account) {
|
||||
$account->order = $index + 1;
|
||||
$account->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -47,6 +47,13 @@ interface AccountRepositoryInterface
|
||||
*/
|
||||
public function count(array $types): int;
|
||||
|
||||
/**
|
||||
* Reset order types of the mentioned accounts.
|
||||
*
|
||||
* @param array $types
|
||||
*/
|
||||
public function resetAccountOrder(array $types): void;
|
||||
|
||||
/**
|
||||
* @param Account $account
|
||||
*
|
||||
|
Reference in New Issue
Block a user