mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-09 20:11:22 +00:00
Various code cleanup.
This commit is contained in:
@@ -77,6 +77,8 @@ class AccountUpdateService
|
||||
* @param array $data
|
||||
*
|
||||
* @return Account
|
||||
* @throws FireflyException
|
||||
* @throws \JsonException
|
||||
*/
|
||||
public function update(Account $account, array $data): Account
|
||||
{
|
||||
@@ -179,6 +181,8 @@ class AccountUpdateService
|
||||
|
||||
/**
|
||||
* @param string $type
|
||||
*
|
||||
* @return AccountType
|
||||
*/
|
||||
private function getAccountType(string $type): AccountType
|
||||
{
|
||||
@@ -219,7 +223,7 @@ class AccountUpdateService
|
||||
$this->user->accounts()->where('accounts.order', '<=', $newOrder)->where('accounts.order', '>', $oldOrder)
|
||||
->where('accounts.id', '!=', $account->id)
|
||||
->whereIn('accounts.account_type_id', $list)
|
||||
->decrement('order', 1);
|
||||
->decrement('order');
|
||||
$account->order = $newOrder;
|
||||
Log::debug(sprintf('Order of account #%d ("%s") is now %d', $account->id, $account->name, $newOrder));
|
||||
$account->save();
|
||||
@@ -230,7 +234,7 @@ class AccountUpdateService
|
||||
$this->user->accounts()->where('accounts.order', '>=', $newOrder)->where('accounts.order', '<', $oldOrder)
|
||||
->where('accounts.id', '!=', $account->id)
|
||||
->whereIn('accounts.account_type_id', $list)
|
||||
->increment('order', 1);
|
||||
->increment('order');
|
||||
$account->order = $newOrder;
|
||||
Log::debug(sprintf('Order of account #%d ("%s") is now %d', $account->id, $account->name, $newOrder));
|
||||
$account->save();
|
||||
@@ -339,6 +343,8 @@ class AccountUpdateService
|
||||
|
||||
/**
|
||||
* @param Account $account
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function updatePreferences(Account $account): void
|
||||
{
|
||||
|
||||
@@ -184,14 +184,14 @@ class BillUpdateService
|
||||
if ($newOrder > $oldOrder) {
|
||||
$this->user->bills()->where('order', '<=', $newOrder)->where('order', '>', $oldOrder)
|
||||
->where('bills.id', '!=', $bill->id)
|
||||
->decrement('bills.order', 1);
|
||||
->decrement('bills.order');
|
||||
$bill->order = $newOrder;
|
||||
$bill->save();
|
||||
}
|
||||
if ($newOrder < $oldOrder) {
|
||||
$this->user->bills()->where('order', '>=', $newOrder)->where('order', '<', $oldOrder)
|
||||
->where('bills.id', '!=', $bill->id)
|
||||
->increment('bills.order', 1);
|
||||
->increment('bills.order');
|
||||
$bill->order = $newOrder;
|
||||
$bill->save();
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@ class CategoryUpdateService
|
||||
* @param array $data
|
||||
*
|
||||
* @return Category
|
||||
* @throws Exception
|
||||
*/
|
||||
public function update(Category $category, array $data): Category
|
||||
{
|
||||
|
||||
@@ -165,6 +165,7 @@ class GroupUpdateService
|
||||
* @param array $data
|
||||
*
|
||||
* @throws FireflyException
|
||||
* @throws \FireflyIII\Exceptions\DuplicateTransactionException
|
||||
*/
|
||||
private function createTransactionJournal(TransactionGroup $transactionGroup, array $data): void
|
||||
{
|
||||
|
||||
@@ -143,6 +143,8 @@ class RecurrenceUpdateService
|
||||
*
|
||||
* @param Recurrence $recurrence
|
||||
* @param array $repetitions
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function updateRepetitions(Recurrence $recurrence, array $repetitions): void
|
||||
{
|
||||
@@ -184,7 +186,8 @@ class RecurrenceUpdateService
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @param Recurrence $recurrence
|
||||
* @param array $data
|
||||
*
|
||||
* @return RecurrenceRepetition|null
|
||||
*/
|
||||
@@ -308,7 +311,8 @@ class RecurrenceUpdateService
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @param Recurrence $recurrence
|
||||
* @param array $data
|
||||
*
|
||||
* @return RecurrenceTransaction|null
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user