mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Various code cleanup
This commit is contained in:
@@ -28,7 +28,6 @@ use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
@@ -38,7 +37,6 @@ use Illuminate\Http\JsonResponse;
|
||||
class DestroyController extends Controller
|
||||
{
|
||||
private CurrencyRepositoryInterface $repository;
|
||||
private UserRepositoryInterface $userRepository;
|
||||
|
||||
/**
|
||||
* CurrencyRepository constructor.
|
||||
@@ -50,8 +48,7 @@ class DestroyController extends Controller
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
$this->repository = app(CurrencyRepositoryInterface::class);
|
||||
$this->userRepository = app(UserRepositoryInterface::class);
|
||||
$this->repository = app(CurrencyRepositoryInterface::class);
|
||||
$this->repository->setUser(auth()->user());
|
||||
|
||||
return $next($request);
|
||||
|
@@ -67,8 +67,6 @@ class ListController extends Controller
|
||||
use TransactionFilter;
|
||||
|
||||
private CurrencyRepositoryInterface $repository;
|
||||
private UserRepositoryInterface $userRepository;
|
||||
|
||||
/**
|
||||
* CurrencyRepository constructor.
|
||||
*
|
||||
@@ -80,7 +78,6 @@ class ListController extends Controller
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
$this->repository = app(CurrencyRepositoryInterface::class);
|
||||
$this->userRepository = app(UserRepositoryInterface::class);
|
||||
$this->repository->setUser(auth()->user());
|
||||
|
||||
return $next($request);
|
||||
|
@@ -28,7 +28,6 @@ use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Api\V1\Requests\Models\TransactionCurrency\StoreRequest;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use FireflyIII\Support\Http\Api\AccountFilter;
|
||||
use FireflyIII\Support\Http\Api\TransactionFilter;
|
||||
use FireflyIII\Transformers\CurrencyTransformer;
|
||||
@@ -45,7 +44,6 @@ class StoreController extends Controller
|
||||
use TransactionFilter;
|
||||
|
||||
private CurrencyRepositoryInterface $repository;
|
||||
private UserRepositoryInterface $userRepository;
|
||||
|
||||
/**
|
||||
* CurrencyRepository constructor.
|
||||
@@ -57,8 +55,7 @@ class StoreController extends Controller
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
$this->repository = app(CurrencyRepositoryInterface::class);
|
||||
$this->userRepository = app(UserRepositoryInterface::class);
|
||||
$this->repository = app(CurrencyRepositoryInterface::class);
|
||||
$this->repository->setUser(auth()->user());
|
||||
|
||||
return $next($request);
|
||||
|
@@ -46,7 +46,6 @@ class UpdateController extends Controller
|
||||
use TransactionFilter;
|
||||
|
||||
private CurrencyRepositoryInterface $repository;
|
||||
private UserRepositoryInterface $userRepository;
|
||||
|
||||
/**
|
||||
* CurrencyRepository constructor.
|
||||
@@ -58,8 +57,7 @@ class UpdateController extends Controller
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
$this->repository = app(CurrencyRepositoryInterface::class);
|
||||
$this->userRepository = app(UserRepositoryInterface::class);
|
||||
$this->repository = app(CurrencyRepositoryInterface::class);
|
||||
$this->repository->setUser(auth()->user());
|
||||
|
||||
return $next($request);
|
||||
|
@@ -46,7 +46,6 @@ class ListController extends Controller
|
||||
use TransactionFilter;
|
||||
|
||||
private LinkTypeRepositoryInterface $repository;
|
||||
private UserRepositoryInterface $userRepository;
|
||||
|
||||
/**
|
||||
* LinkTypeController constructor.
|
||||
@@ -61,7 +60,6 @@ class ListController extends Controller
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$this->repository = app(LinkTypeRepositoryInterface::class);
|
||||
$this->userRepository = app(UserRepositoryInterface::class);
|
||||
$this->repository->setUser($user);
|
||||
|
||||
return $next($request);
|
||||
|
@@ -46,7 +46,6 @@ class ShowController extends Controller
|
||||
use TransactionFilter;
|
||||
|
||||
private LinkTypeRepositoryInterface $repository;
|
||||
private UserRepositoryInterface $userRepository;
|
||||
|
||||
/**
|
||||
* LinkTypeController constructor.
|
||||
@@ -61,7 +60,6 @@ class ShowController extends Controller
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$this->repository = app(LinkTypeRepositoryInterface::class);
|
||||
$this->userRepository = app(UserRepositoryInterface::class);
|
||||
$this->repository->setUser($user);
|
||||
|
||||
return $next($request);
|
||||
|
@@ -96,7 +96,7 @@ class UserUpdateRequest extends FormRequest
|
||||
*/
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
/** @var User $current */
|
||||
/** @var User|null $current */
|
||||
$current = $this->route()->parameter('user');
|
||||
$validator->after(
|
||||
static function (Validator $validator) use ($current) {
|
||||
|
@@ -38,7 +38,6 @@ class NetWorthController extends Controller
|
||||
use ConvertsExchangeRates;
|
||||
|
||||
private NetWorthInterface $netWorth;
|
||||
private AccountRepositoryInterface $repository;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -48,7 +47,6 @@ class NetWorthController extends Controller
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
$this->repository = app(AccountRepositoryInterface::class);
|
||||
$this->netWorth = app(NetWorthInterface::class);
|
||||
$this->netWorth->setUser(auth()->user());
|
||||
return $next($request);
|
||||
|
@@ -146,11 +146,7 @@ class DeleteOrphanedTransactions extends Command
|
||||
// delete journals
|
||||
$journal = TransactionJournal::find((int)$transaction->transaction_journal_id);
|
||||
if ($journal) {
|
||||
try {
|
||||
$journal->delete();
|
||||
} catch (QueryException $e) {
|
||||
Log::info(sprintf('Could not delete journal %s', $e->getMessage()));
|
||||
}
|
||||
$journal->delete();
|
||||
}
|
||||
Transaction::where('transaction_journal_id', (int)$transaction->transaction_journal_id)->delete();
|
||||
$this->line(
|
||||
|
@@ -60,11 +60,7 @@ class DeleteZeroAmount extends Command
|
||||
/** @var TransactionJournal $journal */
|
||||
foreach ($journals as $journal) {
|
||||
$this->info(sprintf('Deleted transaction journal #%d because the amount is zero (0.00).', $journal->id));
|
||||
try {
|
||||
$journal->delete();
|
||||
} catch (QueryException $e) {
|
||||
$this->line($e->getMessage());
|
||||
}
|
||||
$journal->delete();
|
||||
|
||||
Transaction::where('transaction_journal_id', $journal->id)->delete();
|
||||
}
|
||||
|
@@ -64,7 +64,7 @@ class FixPiggies extends Command
|
||||
if (null === $event->transaction_journal_id) {
|
||||
continue;
|
||||
}
|
||||
/** @var TransactionJournal $journal */
|
||||
/** @var TransactionJournal|null $journal */
|
||||
$journal = $event->transactionJournal;
|
||||
|
||||
if (null === $journal) {
|
||||
|
@@ -146,6 +146,7 @@ class FixTransactionTypes extends Command
|
||||
}
|
||||
/** @var Transaction $transaction */
|
||||
$transaction = $collection->first();
|
||||
/** @var Account|null $account */
|
||||
$account = $transaction->account;
|
||||
if (null === $account) {
|
||||
throw new FireflyException(sprintf('Journal #%d, transaction #%d has no source account.', $journal->id, $transaction->id));
|
||||
@@ -175,6 +176,7 @@ class FixTransactionTypes extends Command
|
||||
}
|
||||
/** @var Transaction $transaction */
|
||||
$transaction = $collection->first();
|
||||
/** @var Account|null $account */
|
||||
$account = $transaction->account;
|
||||
if (null === $account) {
|
||||
throw new FireflyException(sprintf('Journal #%d, transaction #%d has no destination account.', $journal->id, $transaction->id));
|
||||
|
@@ -93,7 +93,7 @@ class FixUnevenAmount extends Command
|
||||
if (!$journal) {
|
||||
return;
|
||||
}
|
||||
/** @var Transaction $source */
|
||||
/** @var Transaction|null $source */
|
||||
$source = $journal->transactions()->where('amount', '<', 0)->first();
|
||||
|
||||
if (null === $source) {
|
||||
@@ -113,7 +113,7 @@ class FixUnevenAmount extends Command
|
||||
$amount = bcmul('-1', (string)$source->amount);
|
||||
|
||||
// fix amount of destination:
|
||||
/** @var Transaction $destination */
|
||||
/** @var Transaction|null $destination */
|
||||
$destination = $journal->transactions()->where('amount', '>', 0)->first();
|
||||
|
||||
if (null === $destination) {
|
||||
|
@@ -53,7 +53,7 @@ class RemoveBills extends Command
|
||||
public function handle(): int
|
||||
{
|
||||
$start = microtime(true);
|
||||
/** @var TransactionType $withdrawal */
|
||||
/** @var TransactionType|null $withdrawal */
|
||||
$withdrawal = TransactionType::where('type', TransactionType::WITHDRAWAL)->first();
|
||||
if (null === $withdrawal) {
|
||||
return 0;
|
||||
|
@@ -163,16 +163,16 @@ class BackToJournals extends Command
|
||||
private function migrateBudgetsForJournal(TransactionJournal $journal): void
|
||||
{
|
||||
// grab category from first transaction
|
||||
/** @var Transaction $transaction */
|
||||
/** @var Transaction|null $transaction */
|
||||
$transaction = $journal->transactions->first();
|
||||
if (null === $transaction) {
|
||||
$this->info(sprintf('Transaction journal #%d has no transactions. Will be fixed later.', $journal->id));
|
||||
|
||||
return;
|
||||
}
|
||||
/** @var Budget $budget */
|
||||
/** @var Budget|null $budget */
|
||||
$budget = $transaction->budgets->first();
|
||||
/** @var Budget $journalBudget */
|
||||
/** @var Budget|null $journalBudget */
|
||||
$journalBudget = $journal->budgets->first();
|
||||
|
||||
// both have a budget, but they don't match.
|
||||
@@ -239,16 +239,16 @@ class BackToJournals extends Command
|
||||
private function migrateCategoriesForJournal(TransactionJournal $journal): void
|
||||
{
|
||||
// grab category from first transaction
|
||||
/** @var Transaction $transaction */
|
||||
/** @var Transaction|null $transaction */
|
||||
$transaction = $journal->transactions->first();
|
||||
if (null === $transaction) {
|
||||
$this->info(sprintf('Transaction journal #%d has no transactions. Will be fixed later.', $journal->id));
|
||||
|
||||
return;
|
||||
}
|
||||
/** @var Category $category */
|
||||
/** @var Category|null $category */
|
||||
$category = $transaction->categories->first();
|
||||
/** @var Category $journalCategory */
|
||||
/** @var Category|null $journalCategory */
|
||||
$journalCategory = $journal->categories->first();
|
||||
|
||||
// both have a category, but they don't match.
|
||||
|
@@ -134,6 +134,7 @@ class CreateGroupMemberships extends Command
|
||||
throw new FireflyException('Firefly III could not find a user role. Please make sure all validations have run.');
|
||||
}
|
||||
|
||||
/** @var GroupMembership|null $membership */
|
||||
$membership = GroupMembership::create(
|
||||
[
|
||||
'user_id' => $user->id,
|
||||
|
@@ -81,11 +81,7 @@ class MigrateJournalNotes extends Command
|
||||
$note->text = $meta->data;
|
||||
$note->save();
|
||||
Log::debug(sprintf('Migrated meta note #%d to Note #%d', $meta->id, $note->id));
|
||||
try {
|
||||
$meta->delete();
|
||||
} catch (QueryException $e) {
|
||||
Log::error(sprintf('Could not delete old meta entry #%d: %s', $meta->id, $e->getMessage()));
|
||||
}
|
||||
$meta->delete();
|
||||
|
||||
$count++;
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Console\Commands\Upgrade;
|
||||
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\Recurrence;
|
||||
use FireflyIII\Models\RecurrenceMeta;
|
||||
use FireflyIII\Models\RecurrenceTransactionMeta;
|
||||
use Illuminate\Console\Command;
|
||||
@@ -124,6 +125,7 @@ class MigrateRecurrenceMeta extends Command
|
||||
*/
|
||||
private function migrateEntry(RecurrenceMeta $meta): int
|
||||
{
|
||||
/** @var Recurrence|null $recurrence */
|
||||
$recurrence = $meta->recurrence;
|
||||
if (null === $recurrence) {
|
||||
return 0;
|
||||
|
@@ -351,7 +351,7 @@ class MigrateToGroups extends Command
|
||||
Log::debug('Now in getTransactionBudget()');
|
||||
|
||||
// try to get a budget ID from the left transaction:
|
||||
/** @var Budget $budget */
|
||||
/** @var Budget|null $budget */
|
||||
$budget = $left->budgets()->first();
|
||||
if (null !== $budget) {
|
||||
Log::debug(sprintf('Return budget #%d, from transaction #%d', $budget->id, $left->id));
|
||||
@@ -360,7 +360,7 @@ class MigrateToGroups extends Command
|
||||
}
|
||||
|
||||
// try to get a budget ID from the right transaction:
|
||||
/** @var Budget $budget */
|
||||
/** @var Budget|null $budget */
|
||||
$budget = $right->budgets()->first();
|
||||
if (null !== $budget) {
|
||||
Log::debug(sprintf('Return budget #%d, from transaction #%d', $budget->id, $right->id));
|
||||
@@ -384,7 +384,7 @@ class MigrateToGroups extends Command
|
||||
Log::debug('Now in getTransactionCategory()');
|
||||
|
||||
// try to get a category ID from the left transaction:
|
||||
/** @var Category $category */
|
||||
/** @var Category|null $category */
|
||||
$category = $left->categories()->first();
|
||||
if (null !== $category) {
|
||||
Log::debug(sprintf('Return category #%d, from transaction #%d', $category->id, $left->id));
|
||||
@@ -393,7 +393,7 @@ class MigrateToGroups extends Command
|
||||
}
|
||||
|
||||
// try to get a category ID from the left transaction:
|
||||
/** @var Category $category */
|
||||
/** @var Category|null $category */
|
||||
$category = $right->categories()->first();
|
||||
if (null !== $category) {
|
||||
Log::debug(sprintf('Return category #%d, from transaction #%d', $category->id, $category->id));
|
||||
|
@@ -57,8 +57,6 @@ class TransactionIdentifier extends Command
|
||||
private $cliRepository;
|
||||
/** @var int */
|
||||
private $count;
|
||||
/** @var JournalRepositoryInterface */
|
||||
private $journalRepository;
|
||||
|
||||
/**
|
||||
* This method gives all transactions which are part of a split journal (so more than 2) a sort of "order" so they are easier
|
||||
@@ -117,7 +115,6 @@ class TransactionIdentifier extends Command
|
||||
*/
|
||||
private function stupidLaravel(): void
|
||||
{
|
||||
$this->journalRepository = app(JournalRepositoryInterface::class);
|
||||
$this->cliRepository = app(JournalCLIRepositoryInterface::class);
|
||||
$this->count = 0;
|
||||
}
|
||||
|
@@ -33,7 +33,7 @@ class DestroyedTransactionLink extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
private TransactionJournalLink $link;
|
||||
private TransactionJournalLink $link; /// @phpstan-ignore-line PHPStan thinks this property is never read.
|
||||
|
||||
/**
|
||||
* DestroyedTransactionLink constructor.
|
||||
|
@@ -138,7 +138,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
|
||||
* @param Request $request
|
||||
* @param Throwable $exception
|
||||
*
|
||||
* @return Redirector|Response
|
||||
* @return Response
|
||||
* @throws Throwable
|
||||
*/
|
||||
private function handleAccount(Request $request, Throwable $exception)
|
||||
@@ -154,7 +154,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
|
||||
if (!($param instanceof Account)) {
|
||||
$accountId = (int)$param;
|
||||
}
|
||||
/** @var Account $account */
|
||||
/** @var Account|null $account */
|
||||
$account = $user->accounts()->with(['accountType'])->withTrashed()->find($accountId);
|
||||
if (null === $account) {
|
||||
Log::error(sprintf('Could not find account %d, so give big fat error.', $accountId));
|
||||
@@ -172,7 +172,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
|
||||
* @param Request $request
|
||||
* @param Throwable $exception
|
||||
*
|
||||
* @return RedirectResponse|\Illuminate\Http\Response|Redirector|Response
|
||||
* @return Response
|
||||
* @throws Throwable
|
||||
*/
|
||||
private function handleGroup(Request $request, Throwable $exception)
|
||||
@@ -183,14 +183,14 @@ class GracefulNotFoundHandler extends ExceptionHandler
|
||||
$route = $request->route();
|
||||
$groupId = (int)$route->parameter('transactionGroup');
|
||||
|
||||
/** @var TransactionGroup $group */
|
||||
/** @var TransactionGroup|null $group */
|
||||
$group = $user->transactionGroups()->withTrashed()->find($groupId);
|
||||
if (null === $group) {
|
||||
Log::error(sprintf('Could not find group %d, so give big fat error.', $groupId));
|
||||
|
||||
return parent::render($request, $exception);
|
||||
}
|
||||
/** @var TransactionJournal $journal */
|
||||
/** @var TransactionJournal|null $journal */
|
||||
$journal = $group->transactionJournals()->withTrashed()->first();
|
||||
if (null === $journal) {
|
||||
Log::error(sprintf('Could not find journal for group %d, so give big fat error.', $groupId));
|
||||
@@ -211,7 +211,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
|
||||
* @param Request $request
|
||||
* @param Throwable $exception
|
||||
*
|
||||
* @return RedirectResponse|Redirector|Response
|
||||
* @return Response
|
||||
* @throws Throwable
|
||||
*/
|
||||
private function handleAttachment(Request $request, Throwable $exception)
|
||||
|
@@ -177,10 +177,7 @@ class Handler extends ExceptionHandler
|
||||
$userData['email'] = auth()->user()->email;
|
||||
}
|
||||
|
||||
$headers = [];
|
||||
if (request()->headers) {
|
||||
$headers = request()->headers->all();
|
||||
}
|
||||
$headers = request()->headers->all();
|
||||
|
||||
$data = [
|
||||
'class' => get_class($e),
|
||||
|
@@ -26,7 +26,6 @@ namespace FireflyIII\Factory;
|
||||
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountMeta;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
@@ -45,7 +44,7 @@ class AccountMetaFactory
|
||||
*/
|
||||
public function crud(Account $account, string $field, string $value): ?AccountMeta
|
||||
{
|
||||
/** @var AccountMeta $entry */
|
||||
/** @var AccountMeta|null $entry */
|
||||
$entry = $account->accountMeta()->where('name', $field)->first();
|
||||
// must not be an empty string:
|
||||
if ('' !== $value) {
|
||||
@@ -62,11 +61,7 @@ class AccountMetaFactory
|
||||
Log::debug(sprintf('Updated meta-field "%s":"%s" for #%d ("%s") ', $field, $value, $account->id, $account->name));
|
||||
}
|
||||
if ('' === $value && null !== $entry) {
|
||||
try {
|
||||
$entry->delete();
|
||||
} catch (QueryException $e) {
|
||||
Log::debug(sprintf('Could not delete entry: %s', $e->getMessage()));
|
||||
}
|
||||
$entry->delete();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@@ -51,7 +51,7 @@ class AttachmentFactory
|
||||
|
||||
// get journal instead of transaction.
|
||||
if (Transaction::class === $model) {
|
||||
/** @var Transaction $transaction */
|
||||
/** @var Transaction|null $transaction */
|
||||
$transaction = $this->user->transactions()->find((int)$data['attachable_id']);
|
||||
if (null === $transaction) {
|
||||
throw new FireflyException('Unexpectedly could not find transaction');
|
||||
|
@@ -45,7 +45,7 @@ class TagFactory
|
||||
$tag = trim($tag);
|
||||
Log::debug(sprintf('Now in TagFactory::findOrCreate("%s")', $tag));
|
||||
|
||||
/** @var Tag $dbTag */
|
||||
/** @var Tag|null $dbTag */
|
||||
$dbTag = $this->user->tags()->where('tag', $tag)->first();
|
||||
if (null !== $dbTag) {
|
||||
Log::debug(sprintf('Tag exists (#%d), return it.', $dbTag->id));
|
||||
|
@@ -43,7 +43,6 @@ class TransactionFactory
|
||||
private ?TransactionCurrency $foreignCurrency;
|
||||
private TransactionJournal $journal;
|
||||
private bool $reconciled;
|
||||
private User $user;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -85,7 +84,6 @@ class TransactionFactory
|
||||
*/
|
||||
private function create(string $amount, ?string $foreignAmount): Transaction
|
||||
{
|
||||
$result = null;
|
||||
if ('' === $foreignAmount) {
|
||||
$foreignAmount = null;
|
||||
}
|
||||
@@ -101,6 +99,7 @@ class TransactionFactory
|
||||
'identifier' => 0,
|
||||
];
|
||||
try {
|
||||
/** @var Transaction|null $result */
|
||||
$result = Transaction::create($data);
|
||||
} catch (QueryException $e) {
|
||||
Log::error(sprintf('Could not create transaction: %s', $e->getMessage()), $data);
|
||||
@@ -112,25 +111,23 @@ class TransactionFactory
|
||||
throw new FireflyException('Transaction is NULL.');
|
||||
}
|
||||
|
||||
if (null !== $result) {
|
||||
Log::debug(
|
||||
sprintf(
|
||||
'Created transaction #%d (%s %s, account %s), part of journal #%d',
|
||||
$result->id,
|
||||
$this->currency->code,
|
||||
$amount,
|
||||
$this->account->name,
|
||||
$this->journal->id
|
||||
)
|
||||
);
|
||||
Log::debug(
|
||||
sprintf(
|
||||
'Created transaction #%d (%s %s, account %s), part of journal #%d',
|
||||
$result->id,
|
||||
$this->currency->code,
|
||||
$amount,
|
||||
$this->account->name,
|
||||
$this->journal->id
|
||||
)
|
||||
);
|
||||
|
||||
// do foreign currency thing: add foreign currency info to $one and $two if necessary.
|
||||
if (null !== $this->foreignCurrency && null !== $foreignAmount && $this->foreignCurrency->id !== $this->currency->id && '' !== $foreignAmount) {
|
||||
$result->foreign_currency_id = $this->foreignCurrency->id;
|
||||
$result->foreign_amount = $foreignAmount;
|
||||
}
|
||||
$result->save();
|
||||
// do foreign currency thing: add foreign currency info to $one and $two if necessary.
|
||||
if (null !== $this->foreignCurrency && null !== $foreignAmount && $this->foreignCurrency->id !== $this->currency->id && '' !== $foreignAmount) {
|
||||
$result->foreign_currency_id = $this->foreignCurrency->id;
|
||||
$result->foreign_amount = $foreignAmount;
|
||||
}
|
||||
$result->save();
|
||||
|
||||
return $result;
|
||||
}
|
||||
@@ -213,6 +210,6 @@ class TransactionFactory
|
||||
*/
|
||||
public function setUser(User $user): void
|
||||
{
|
||||
$this->user = $user;
|
||||
// empty function.
|
||||
}
|
||||
}
|
||||
|
@@ -28,6 +28,7 @@ use Exception;
|
||||
use FireflyIII\Exceptions\DuplicateTransactionException;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\Preference;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
@@ -45,7 +46,6 @@ use FireflyIII\Services\Internal\Support\JournalServiceTrait;
|
||||
use FireflyIII\Support\NullArrayObject;
|
||||
use FireflyIII\User;
|
||||
use FireflyIII\Validation\AccountValidator;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Collection;
|
||||
use JsonException;
|
||||
use Log;
|
||||
@@ -312,10 +312,6 @@ class TransactionJournalFactory
|
||||
|
||||
unset($dataRow['import_hash_v2'], $dataRow['original_source']);
|
||||
$json = json_encode($dataRow, JSON_THROW_ON_ERROR);
|
||||
if (false === $json) {
|
||||
$json = json_encode((string)microtime(), JSON_THROW_ON_ERROR);
|
||||
Log::error(sprintf('Could not hash the original row! %s', json_last_error_msg()), $dataRow);
|
||||
}
|
||||
$hash = hash('sha256', $json);
|
||||
Log::debug(sprintf('The hash is: %s', $hash), $dataRow);
|
||||
|
||||
@@ -336,15 +332,12 @@ class TransactionJournalFactory
|
||||
if (false === $this->errorOnHash) {
|
||||
return;
|
||||
}
|
||||
$result = null;
|
||||
if ($this->errorOnHash) {
|
||||
Log::debug('Will verify duplicate!');
|
||||
/** @var TransactionJournalMeta $result */
|
||||
$result = TransactionJournalMeta::withTrashed()
|
||||
->where('data', json_encode($hash, JSON_THROW_ON_ERROR))
|
||||
->with(['transactionJournal', 'transactionJournal.transactionGroup'])
|
||||
->first();
|
||||
}
|
||||
Log::debug('Will verify duplicate!');
|
||||
/** @var TransactionJournalMeta|null $result */
|
||||
$result = TransactionJournalMeta::withTrashed()
|
||||
->where('data', json_encode($hash, JSON_THROW_ON_ERROR))
|
||||
->with(['transactionJournal', 'transactionJournal.transactionGroup'])
|
||||
->first();
|
||||
if (null !== $result) {
|
||||
app('log')->warning(sprintf('Found a duplicate in errorIfDuplicate because hash %s is not unique!', $hash));
|
||||
$journal = $result->transactionJournal()->withTrashed()->first();
|
||||
@@ -474,6 +467,7 @@ class TransactionJournalFactory
|
||||
private function getCurrency(?TransactionCurrency $currency, Account $account): TransactionCurrency
|
||||
{
|
||||
Log::debug('Now in getCurrency()');
|
||||
/** @var Preference|null $preference */
|
||||
$preference = $this->accountRepository->getAccountCurrency($account);
|
||||
if (null === $preference && null === $currency) {
|
||||
// return user's default:
|
||||
@@ -555,13 +549,7 @@ class TransactionJournalFactory
|
||||
*/
|
||||
private function forceTrDelete(Transaction $transaction): void
|
||||
{
|
||||
try {
|
||||
$transaction->delete();
|
||||
} catch (QueryException $e) {
|
||||
Log::error($e->getMessage());
|
||||
Log::error($e->getTraceAsString());
|
||||
Log::error('Could not delete negative transaction.');
|
||||
}
|
||||
$transaction->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -42,15 +42,11 @@ class TransactionJournalMetaFactory
|
||||
{
|
||||
//Log::debug('In updateOrCreate()');
|
||||
$value = $data['data'];
|
||||
/** @var TransactionJournalMeta $entry */
|
||||
/** @var TransactionJournalMeta|null $entry */
|
||||
$entry = $data['journal']->transactionJournalMeta()->where('name', $data['name'])->first();
|
||||
if (null === $value && null !== $entry) {
|
||||
//Log::debug('Value is empty, delete meta value.');
|
||||
try {
|
||||
$entry->delete();
|
||||
} catch (QueryException $e) {
|
||||
Log::error(sprintf('Could not delete transaction journal meta: %s', $e->getMessage()));
|
||||
}
|
||||
$entry->delete();
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -64,11 +60,7 @@ class TransactionJournalMetaFactory
|
||||
// don't store blank strings.
|
||||
if (null !== $entry) {
|
||||
Log::debug('Will not store empty strings, delete meta value');
|
||||
try {
|
||||
$entry->delete();
|
||||
} catch (QueryException $e) {
|
||||
Log::error(sprintf('Could not delete transaction journal meta: %s', $e->getMessage()));
|
||||
}
|
||||
$entry->delete();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@@ -39,8 +39,6 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
{
|
||||
private Collection $accounts;
|
||||
private Carbon $end;
|
||||
private array $expenses;
|
||||
private array $income;
|
||||
private Carbon $start;
|
||||
private Collection $tags;
|
||||
|
||||
@@ -49,8 +47,6 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->expenses = [];
|
||||
$this->income = [];
|
||||
$this->tags = new Collection();
|
||||
$this->accounts = new Collection();
|
||||
}
|
||||
|
@@ -44,6 +44,7 @@ class BillEventHandler
|
||||
Log::debug(sprintf('Now in %s', __METHOD__));
|
||||
|
||||
$bill = $event->bill;
|
||||
/** @var bool $preference */
|
||||
$preference = Preferences::getForUser($bill->user, 'notification_bill_reminder', true)->data;
|
||||
|
||||
if (true === $preference) {
|
||||
|
@@ -125,7 +125,7 @@ class UpdatedGroupEventHandler
|
||||
return;
|
||||
}
|
||||
// first journal:
|
||||
/** @var TransactionJournal $first */
|
||||
/** @var TransactionJournal|null $first */
|
||||
$first = $group->transactionJournals()
|
||||
->orderBy('transaction_journals.date', 'DESC')
|
||||
->orderBy('transaction_journals.order', 'ASC')
|
||||
|
@@ -143,7 +143,7 @@ class UserEventHandler
|
||||
throw new FireflyException('Email address can no longer be used for registrations.');
|
||||
}
|
||||
}
|
||||
/** @var UserRole $role */
|
||||
/** @var UserRole|null $role */
|
||||
$role = UserRole::where('title', UserRole::OWNER)->first();
|
||||
if (null === $role) {
|
||||
throw new FireflyException('The user role is unexpectedly empty. Did you run all migrations?');
|
||||
@@ -366,6 +366,7 @@ class UserEventHandler
|
||||
];
|
||||
}
|
||||
$preference = array_values($preference);
|
||||
/** @var bool $send */
|
||||
$send = app('preferences')->getForUser($user, 'notification_user_login', true)->data;
|
||||
app('preferences')->setForUser($user, 'login_ip_history', $preference);
|
||||
|
||||
|
@@ -323,9 +323,9 @@ trait AttachmentCollection
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
foreach ($transaction['attachments'] as $attachment) {
|
||||
/** @var Attachment $object */
|
||||
/** @var Attachment|null $object */
|
||||
$object = auth()->user()->attachments()->find($attachment['id']);
|
||||
$notes = (string)$object->notes()?->first()?->text;
|
||||
$notes = (string)$object?->notes()->first()?->text;
|
||||
return $notes !== '' && $notes === $value;
|
||||
}
|
||||
}
|
||||
@@ -349,9 +349,9 @@ trait AttachmentCollection
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
foreach ($transaction['attachments'] as $attachment) {
|
||||
/** @var Attachment $object */
|
||||
/** @var Attachment|null $object */
|
||||
$object = auth()->user()->attachments()->find($attachment['id']);
|
||||
$notes = (string)$object->notes()?->first()?->text;
|
||||
$notes = (string)$object?->notes()->first()?->text;
|
||||
return $notes !== '' && $notes !== $value;
|
||||
}
|
||||
}
|
||||
@@ -375,9 +375,9 @@ trait AttachmentCollection
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
foreach ($transaction['attachments'] as $attachment) {
|
||||
/** @var Attachment $object */
|
||||
/** @var Attachment|null $object */
|
||||
$object = auth()->user()->attachments()->find($attachment['id']);
|
||||
$notes = (string)$object->notes()?->first()?->text;
|
||||
$notes = (string)$object?->notes()->first()?->text;
|
||||
return $notes !== '' && str_contains(strtolower($notes), strtolower($value));
|
||||
}
|
||||
}
|
||||
@@ -401,9 +401,9 @@ trait AttachmentCollection
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
foreach ($transaction['attachments'] as $attachment) {
|
||||
/** @var Attachment $object */
|
||||
/** @var Attachment|null $object */
|
||||
$object = auth()->user()->attachments()->find($attachment['id']);
|
||||
$notes = (string)$object->notes()?->first()?->text;
|
||||
$notes = (string)$object?->notes()->first()?->text;
|
||||
return $notes !== '' && !str_contains(strtolower($notes), strtolower($value));
|
||||
}
|
||||
}
|
||||
@@ -427,9 +427,9 @@ trait AttachmentCollection
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
foreach ($transaction['attachments'] as $attachment) {
|
||||
/** @var Attachment $object */
|
||||
/** @var Attachment|null $object */
|
||||
$object = auth()->user()->attachments()->find($attachment['id']);
|
||||
$notes = (string)$object->notes()?->first()?->text;
|
||||
$notes = (string)$object?->notes()->first()?->text;
|
||||
return $notes !== '' && !str_ends_with(strtolower($notes), strtolower($value));
|
||||
}
|
||||
}
|
||||
@@ -453,9 +453,9 @@ trait AttachmentCollection
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
foreach ($transaction['attachments'] as $attachment) {
|
||||
/** @var Attachment $object */
|
||||
/** @var Attachment|null $object */
|
||||
$object = auth()->user()->attachments()->find($attachment['id']);
|
||||
$notes = (string)$object->notes()?->first()?->text;
|
||||
$notes = (string)$object?->notes()->first()?->text;
|
||||
return $notes !== '' && !str_starts_with(strtolower($notes), strtolower($value));
|
||||
}
|
||||
}
|
||||
@@ -479,9 +479,9 @@ trait AttachmentCollection
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
foreach ($transaction['attachments'] as $attachment) {
|
||||
/** @var Attachment $object */
|
||||
/** @var Attachment|null $object */
|
||||
$object = auth()->user()->attachments()->find($attachment['id']);
|
||||
$notes = (string)$object->notes()?->first()?->text;
|
||||
$notes = (string)$object?->notes()->first()?->text;
|
||||
return $notes !== '' && str_ends_with(strtolower($notes), strtolower($value));
|
||||
}
|
||||
}
|
||||
@@ -505,9 +505,9 @@ trait AttachmentCollection
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
foreach ($transaction['attachments'] as $attachment) {
|
||||
/** @var Attachment $object */
|
||||
/** @var Attachment|null $object */
|
||||
$object = auth()->user()->attachments()->find($attachment['id']);
|
||||
$notes = (string)$object->notes()?->first()?->text;
|
||||
$notes = (string)$object?->notes()->first()?->text;
|
||||
return $notes !== '' && str_starts_with(strtolower($notes), strtolower($value));
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ namespace FireflyIII\Helpers\Collector;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Carbon\Exceptions\InvalidDateException;
|
||||
use Carbon\Exceptions\InvalidFormatException;
|
||||
use Closure;
|
||||
use Exception;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
@@ -602,7 +603,7 @@ class GroupCollector implements GroupCollectorInterface
|
||||
$tagDate = null;
|
||||
try {
|
||||
$tagDate = Carbon::parse($augumentedJournal['tag_date']);
|
||||
} catch (InvalidDateException $e) {
|
||||
} catch (InvalidFormatException $e) {
|
||||
Log::debug(sprintf('Could not parse date: %s', $e->getMessage()));
|
||||
}
|
||||
|
||||
@@ -682,7 +683,7 @@ class GroupCollector implements GroupCollectorInterface
|
||||
$tagDate = null;
|
||||
try {
|
||||
$tagDate = Carbon::parse($newArray['tag_date']);
|
||||
} catch (InvalidDateException $e) {
|
||||
} catch (InvalidFormatException $e) {
|
||||
Log::debug(sprintf('Could not parse date: %s', $e->getMessage()));
|
||||
}
|
||||
|
||||
@@ -754,10 +755,7 @@ class GroupCollector implements GroupCollectorInterface
|
||||
$groups[$groudId]['sums'][$currencyId]['currency_decimal_places'] = $transaction['foreign_currency_decimal_places'];
|
||||
$groups[$groudId]['sums'][$currencyId]['amount'] = '0';
|
||||
}
|
||||
$groups[$groudId]['sums'][$currencyId]['amount'] = bcadd(
|
||||
$groups[$groudId]['sums'][$currencyId]['amount'],
|
||||
$transaction['foreign_amount'] ?? '0'
|
||||
);
|
||||
$groups[$groudId]['sums'][$currencyId]['amount'] = bcadd($groups[$groudId]['sums'][$currencyId]['amount'], $transaction['foreign_amount']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -28,7 +28,6 @@ use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Http\Requests\AccountFormRequest;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use FireflyIII\Support\Http\Controllers\ModelInformation;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
@@ -44,9 +43,8 @@ class EditController extends Controller
|
||||
{
|
||||
use ModelInformation;
|
||||
|
||||
private AttachmentHelperInterface $attachments;
|
||||
private CurrencyRepositoryInterface $currencyRepos;
|
||||
private AccountRepositoryInterface $repository;
|
||||
private AttachmentHelperInterface $attachments;
|
||||
private AccountRepositoryInterface $repository;
|
||||
|
||||
/**
|
||||
* EditController constructor.
|
||||
@@ -61,9 +59,8 @@ class EditController extends Controller
|
||||
app('view')->share('mainTitleIcon', 'fa-credit-card');
|
||||
app('view')->share('title', (string)trans('firefly.accounts'));
|
||||
|
||||
$this->repository = app(AccountRepositoryInterface::class);
|
||||
$this->currencyRepos = app(CurrencyRepositoryInterface::class);
|
||||
$this->attachments = app(AttachmentHelperInterface::class);
|
||||
$this->repository = app(AccountRepositoryInterface::class);
|
||||
$this->attachments = app(AttachmentHelperInterface::class);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
@@ -33,7 +33,6 @@ use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
@@ -50,12 +49,8 @@ use Psr\Container\NotFoundExceptionInterface;
|
||||
*/
|
||||
class ReconcileController extends Controller
|
||||
{
|
||||
/** @var AccountRepositoryInterface The account repository */
|
||||
private $accountRepos;
|
||||
/** @var CurrencyRepositoryInterface The currency repository */
|
||||
private $currencyRepos;
|
||||
/** @var JournalRepositoryInterface Journals and transactions overview */
|
||||
private $repository;
|
||||
private AccountRepositoryInterface $accountRepos;
|
||||
private JournalRepositoryInterface $repository;
|
||||
|
||||
/**
|
||||
* ReconcileController constructor.
|
||||
@@ -71,9 +66,8 @@ class ReconcileController extends Controller
|
||||
function ($request, $next) {
|
||||
app('view')->share('mainTitleIcon', 'fa-credit-card');
|
||||
app('view')->share('title', (string)trans('firefly.accounts'));
|
||||
$this->repository = app(JournalRepositoryInterface::class);
|
||||
$this->accountRepos = app(AccountRepositoryInterface::class);
|
||||
$this->currencyRepos = app(CurrencyRepositoryInterface::class);
|
||||
$this->repository = app(JournalRepositoryInterface::class);
|
||||
$this->accountRepos = app(AccountRepositoryInterface::class);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
@@ -29,7 +29,6 @@ use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use FireflyIII\Support\Http\Controllers\PeriodOverview;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
@@ -49,8 +48,7 @@ class ShowController extends Controller
|
||||
{
|
||||
use PeriodOverview;
|
||||
|
||||
private CurrencyRepositoryInterface $currencyRepos;
|
||||
private AccountRepositoryInterface $repository;
|
||||
private AccountRepositoryInterface $repository;
|
||||
|
||||
/**
|
||||
* ShowController constructor.
|
||||
@@ -69,8 +67,7 @@ class ShowController extends Controller
|
||||
app('view')->share('mainTitleIcon', 'fa-credit-card');
|
||||
app('view')->share('title', (string)trans('firefly.accounts'));
|
||||
|
||||
$this->repository = app(AccountRepositoryInterface::class);
|
||||
$this->currencyRepos = app(CurrencyRepositoryInterface::class);
|
||||
$this->repository = app(AccountRepositoryInterface::class);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
@@ -305,6 +305,10 @@ class IndexController extends Controller
|
||||
}
|
||||
}
|
||||
// final calculation for 'left':
|
||||
/**
|
||||
* @var int $currencyId
|
||||
* @var array $info
|
||||
*/
|
||||
foreach ($sums['budgeted'] as $currencyId => $info) {
|
||||
$spent = $sums['spent'][$currencyId]['amount'] ?? '0';
|
||||
$budgeted = $sums['budgeted'][$currencyId]['amount'] ?? '0';
|
||||
|
@@ -185,6 +185,7 @@ class ExpenseReportController extends Controller
|
||||
// remove all empty entries to prevent cluttering:
|
||||
$newSet = [];
|
||||
foreach ($chartData as $key => $entry) {
|
||||
// TODO not sure, this is a bad comparison.
|
||||
if (0 === !array_sum($entry['entries'])) {
|
||||
$newSet[$key] = $entry;
|
||||
}
|
||||
|
@@ -83,7 +83,7 @@ class PiggyBankController extends Controller
|
||||
// get first event or start date of piggy bank or today
|
||||
$startDate = $piggyBank->startdate ?? today(config('app.timezone'));
|
||||
|
||||
/** @var PiggyBankEvent $firstEvent */
|
||||
/** @var PiggyBankEvent|null $firstEvent */
|
||||
$firstEvent = $set->first();
|
||||
$firstDate = null === $firstEvent ? new Carbon() : $firstEvent->date;
|
||||
|
||||
|
@@ -30,8 +30,6 @@ use FireflyIII\Models\TransactionCurrency;
|
||||
use FireflyIII\Repositories\Budget\AvailableBudgetRepositoryInterface;
|
||||
use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface;
|
||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
use FireflyIII\Repositories\Budget\OperationsRepositoryInterface;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use FireflyIII\Support\Http\Controllers\DateCalculation;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
@@ -42,16 +40,9 @@ class BudgetController extends Controller
|
||||
{
|
||||
use DateCalculation;
|
||||
|
||||
/** @var AvailableBudgetRepositoryInterface */
|
||||
private $abRepository;
|
||||
/** @var BudgetLimitRepositoryInterface */
|
||||
private $blRepository;
|
||||
/** @var CurrencyRepositoryInterface */
|
||||
private $currencyRepository;
|
||||
/** @var OperationsRepositoryInterface */
|
||||
private $opsRepository;
|
||||
/** @var BudgetRepositoryInterface The budget repository */
|
||||
private $repository;
|
||||
private AvailableBudgetRepositoryInterface $abRepository;
|
||||
private BudgetLimitRepositoryInterface $blRepository;
|
||||
private BudgetRepositoryInterface $repository;
|
||||
|
||||
/**
|
||||
* IndexController constructor.
|
||||
@@ -66,11 +57,9 @@ class BudgetController extends Controller
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string)trans('firefly.budgets'));
|
||||
app('view')->share('mainTitleIcon', 'fa-pie-chart');
|
||||
$this->repository = app(BudgetRepositoryInterface::class);
|
||||
$this->opsRepository = app(OperationsRepositoryInterface::class);
|
||||
$this->abRepository = app(AvailableBudgetRepositoryInterface::class);
|
||||
$this->currencyRepository = app(CurrencyRepositoryInterface::class);
|
||||
$this->blRepository = app(BudgetLimitRepositoryInterface::class);
|
||||
$this->repository = app(BudgetRepositoryInterface::class);
|
||||
$this->abRepository = app(AvailableBudgetRepositoryInterface::class);
|
||||
$this->blRepository = app(BudgetLimitRepositoryInterface::class);
|
||||
$this->repository->cleanupBudgets();
|
||||
|
||||
return $next($request);
|
||||
|
@@ -47,8 +47,6 @@ use Throwable;
|
||||
class ReconcileController extends Controller
|
||||
{
|
||||
private AccountRepositoryInterface $accountRepos;
|
||||
private CurrencyRepositoryInterface $currencyRepos;
|
||||
private JournalRepositoryInterface $repository;
|
||||
|
||||
/**
|
||||
* ReconcileController constructor.
|
||||
@@ -64,9 +62,7 @@ class ReconcileController extends Controller
|
||||
function ($request, $next) {
|
||||
app('view')->share('mainTitleIcon', 'fa-credit-card');
|
||||
app('view')->share('title', (string)trans('firefly.accounts'));
|
||||
$this->repository = app(JournalRepositoryInterface::class);
|
||||
$this->accountRepos = app(AccountRepositoryInterface::class);
|
||||
$this->currencyRepos = app(CurrencyRepositoryInterface::class);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
@@ -88,7 +88,7 @@ class PreferencesController extends Controller
|
||||
$role = sprintf('opt_group_l_%s', $type);
|
||||
}
|
||||
|
||||
if ('' === $role || 'opt_group_' === $role) {
|
||||
if ('opt_group_' === $role) {
|
||||
$role = 'opt_group_defaultAsset';
|
||||
}
|
||||
$groupedAccounts[trans(sprintf('firefly.%s', $role))][$account->id] = $account->name;
|
||||
|
@@ -197,9 +197,9 @@ class ProfileController extends Controller
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Application|RedirectResponse|Redirector
|
||||
* @return View|RedirectResponse
|
||||
*/
|
||||
public function deleteAccount(Request $request): Application|RedirectResponse|Redirector
|
||||
public function deleteAccount(Request $request): View|RedirectResponse
|
||||
{
|
||||
if (!$this->internalAuth || !$this->internalIdentity) {
|
||||
$request->session()->flash('error', trans('firefly.external_user_mgt_disabled'));
|
||||
|
@@ -28,9 +28,6 @@ use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\Budget;
|
||||
use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface;
|
||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
use FireflyIII\Repositories\Budget\NoBudgetRepositoryInterface;
|
||||
use FireflyIII\Repositories\Budget\OperationsRepositoryInterface;
|
||||
use FireflyIII\Support\CacheProperties;
|
||||
use FireflyIII\Support\Http\Controllers\BasicDataSupport;
|
||||
@@ -49,10 +46,7 @@ class BudgetController extends Controller
|
||||
{
|
||||
use BasicDataSupport;
|
||||
|
||||
private BudgetLimitRepositoryInterface $blRepository;
|
||||
private NoBudgetRepositoryInterface $nbRepository;
|
||||
private OperationsRepositoryInterface $opsRepository;
|
||||
private BudgetRepositoryInterface $repository;
|
||||
private OperationsRepositoryInterface $opsRepository;
|
||||
|
||||
/**
|
||||
* ExpenseReportController constructor.
|
||||
@@ -65,9 +59,6 @@ class BudgetController extends Controller
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
$this->opsRepository = app(OperationsRepositoryInterface::class);
|
||||
$this->repository = app(BudgetRepositoryInterface::class);
|
||||
$this->blRepository = app(BudgetLimitRepositoryInterface::class);
|
||||
$this->nbRepository = app(NoBudgetRepositoryInterface::class);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
@@ -290,7 +290,7 @@ class ReportController extends Controller
|
||||
$role = sprintf('opt_group_l_%s', $type);
|
||||
}
|
||||
|
||||
if ('' === $role || 'opt_group_' === $role) {
|
||||
if ('opt_group_' === $role) {
|
||||
$role = 'opt_group_defaultAsset';
|
||||
}
|
||||
$groupedAccounts[trans(sprintf('firefly.%s', $role))][$account->id] = $account;
|
||||
|
Reference in New Issue
Block a user