mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-06 22:21:42 +00:00
Various code cleanup.
This commit is contained in:
@@ -452,9 +452,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
{
|
||||
$journal = $this->getOpeningBalance($account);
|
||||
$group = null;
|
||||
if (null !== $journal) {
|
||||
$group = $journal->transactionGroup;
|
||||
}
|
||||
$group = $journal?->transactionGroup;
|
||||
|
||||
return $group;
|
||||
}
|
||||
@@ -598,9 +596,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
{
|
||||
$result = null;
|
||||
$journal = $this->oldestJournal($account);
|
||||
if (null !== $journal) {
|
||||
$result = $journal->date;
|
||||
}
|
||||
$result = $journal?->date;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -228,9 +228,7 @@ class JournalRepository implements JournalRepositoryInterface
|
||||
{
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user->transactionJournals()->find($journalId);
|
||||
if (null !== $journal) {
|
||||
$journal->transactions()->update(['reconciled' => true]);
|
||||
}
|
||||
$journal?->transactions()->update(['reconciled' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -331,7 +331,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface
|
||||
public function updateLink(TransactionJournalLink $journalLink, array $data): TransactionJournalLink
|
||||
{
|
||||
$journalLink->source_id = $data['inward_id'] ?: $journalLink->source_id;
|
||||
$journalLink->destination_id = $data['outward_id'] ? $data['outward_id'] : $journalLink->destination_id;
|
||||
$journalLink->destination_id = $data['outward_id'] ?: $journalLink->destination_id;
|
||||
$journalLink->save();
|
||||
if (array_key_exists('link_type_name', $data)) {
|
||||
$linkType = LinkType::whereName($data['link_type_name'])->first();
|
||||
|
||||
@@ -267,7 +267,7 @@ trait ModifiesPiggyBanks
|
||||
if ($newOrder > $oldOrder) {
|
||||
$this->user->piggyBanks()->where('piggy_banks.order', '<=', $newOrder)->where('piggy_banks.order', '>', $oldOrder)
|
||||
->where('piggy_banks.id', '!=', $piggyBank->id)
|
||||
->decrement('piggy_banks.order', 1);
|
||||
->decrement('piggy_banks.order');
|
||||
$piggyBank->order = $newOrder;
|
||||
Log::debug(sprintf('Order of piggy #%d ("%s") is now %d', $piggyBank->id, $piggyBank->name, $newOrder));
|
||||
$piggyBank->save();
|
||||
@@ -277,7 +277,7 @@ trait ModifiesPiggyBanks
|
||||
|
||||
$this->user->piggyBanks()->where('piggy_banks.order', '>=', $newOrder)->where('piggy_banks.order', '<', $oldOrder)
|
||||
->where('piggy_banks.id', '!=', $piggyBank->id)
|
||||
->increment('piggy_banks.order', 1);
|
||||
->increment('piggy_banks.order');
|
||||
$piggyBank->order = $newOrder;
|
||||
Log::debug(sprintf('Order of piggy #%d ("%s") is now %d', $piggyBank->id, $piggyBank->name, $newOrder));
|
||||
$piggyBank->save();
|
||||
|
||||
@@ -45,6 +45,7 @@ use FireflyIII\Support\Repositories\Recurring\FiltersWeekends;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Collection;
|
||||
use JsonException;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
@@ -290,7 +291,7 @@ class RecurringRepository implements RecurringRepositoryInterface
|
||||
* @param RecurrenceTransaction $transaction
|
||||
*
|
||||
* @return array
|
||||
* @throws \JsonException
|
||||
* @throws JsonException
|
||||
*/
|
||||
public function getTags(RecurrenceTransaction $transaction): array
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Repositories\User;
|
||||
|
||||
use Exception;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\BudgetLimit;
|
||||
use FireflyIII\Models\Role;
|
||||
use FireflyIII\User;
|
||||
@@ -375,7 +376,7 @@ class UserRepository implements UserRepositoryInterface
|
||||
* @param string $newEmail
|
||||
*
|
||||
* @return bool
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
* @throws FireflyException
|
||||
* @see changeEmail
|
||||
*/
|
||||
public function updateEmail(User $user, string $newEmail): bool
|
||||
|
||||
Reference in New Issue
Block a user