Merge pull request #7068 from firefly-iii/cleanup-comments

Cleanup comments
This commit is contained in:
James Cole 2023-02-22 18:16:02 +01:00 committed by GitHub
commit a18cd23154
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
321 changed files with 949 additions and 1263 deletions

View File

@ -58,7 +58,6 @@ class TransactionTypeController extends Controller
* @param AutocompleteRequest $request * @param AutocompleteRequest $request
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function transactionTypes(AutocompleteRequest $request): JsonResponse public function transactionTypes(AutocompleteRequest $request): JsonResponse
{ {

View File

@ -63,7 +63,6 @@ class DestroyController extends Controller
* *
* @param Account $account * @param Account $account
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function destroy(Account $account): JsonResponse public function destroy(Account $account): JsonResponse

View File

@ -76,7 +76,6 @@ class ListController extends Controller
* @param Account $account * @param Account $account
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function attachments(Account $account): JsonResponse public function attachments(Account $account): JsonResponse
@ -110,7 +109,6 @@ class ListController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function piggyBanks(Account $account): JsonResponse public function piggyBanks(Account $account): JsonResponse
{ {
@ -145,7 +143,6 @@ class ListController extends Controller
* *
* Show all transaction groups related to the account. * Show all transaction groups related to the account.
* *
* *
* @param Request $request * @param Request $request
* @param Account $account * @param Account $account

View File

@ -75,7 +75,6 @@ class ShowController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function index(Request $request): JsonResponse public function index(Request $request): JsonResponse
{ {

View File

@ -64,7 +64,6 @@ class DestroyController extends Controller
* *
* Remove the specified resource from storage. * Remove the specified resource from storage.
* *
* *
* @param Attachment $attachment * @param Attachment $attachment
* *

View File

@ -73,7 +73,6 @@ class ShowController extends Controller
* *
* @param Attachment $attachment * @param Attachment $attachment
* *
* @return LaravelResponse * @return LaravelResponse
* @throws FireflyException * @throws FireflyException
*/ */
@ -118,7 +117,6 @@ class ShowController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function index(): JsonResponse public function index(): JsonResponse
{ {

View File

@ -95,7 +95,6 @@ class StoreController extends Controller
/** /**
* Upload an attachment. * Upload an attachment.
* *
* *
* @param Request $request * @param Request $request
* @param Attachment $attachment * @param Attachment $attachment

View File

@ -70,7 +70,6 @@ class ShowController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function index(): JsonResponse public function index(): JsonResponse
{ {
@ -110,7 +109,6 @@ class ShowController extends Controller
* @param AvailableBudget $availableBudget * @param AvailableBudget $availableBudget
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function show(AvailableBudget $availableBudget): JsonResponse public function show(AvailableBudget $availableBudget): JsonResponse
{ {

View File

@ -62,7 +62,6 @@ class DestroyController extends Controller
* @param Bill $bill * @param Bill $bill
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function destroy(Bill $bill): JsonResponse public function destroy(Bill $bill): JsonResponse
{ {

View File

@ -76,7 +76,6 @@ class ListController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function attachments(Bill $bill): JsonResponse public function attachments(Bill $bill): JsonResponse
{ {
@ -111,7 +110,6 @@ class ListController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function rules(Bill $bill): JsonResponse public function rules(Bill $bill): JsonResponse
{ {
@ -150,7 +148,6 @@ class ListController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function transactions(Request $request, Bill $bill): JsonResponse public function transactions(Request $request, Bill $bill): JsonResponse
{ {

View File

@ -67,7 +67,6 @@ class ShowController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function index(): JsonResponse public function index(): JsonResponse
{ {
@ -98,7 +97,6 @@ class ShowController extends Controller
* @param Bill $bill * @param Bill $bill
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function show(Bill $bill): JsonResponse public function show(Bill $bill): JsonResponse
{ {

View File

@ -62,7 +62,6 @@ class DestroyController extends Controller
* @param Budget $budget * @param Budget $budget
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function destroy(Budget $budget): JsonResponse public function destroy(Budget $budget): JsonResponse
{ {

View File

@ -78,7 +78,6 @@ class ListController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function attachments(Budget $budget): JsonResponse public function attachments(Budget $budget): JsonResponse
{ {
@ -113,7 +112,6 @@ class ListController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function budgetLimits(Budget $budget): JsonResponse public function budgetLimits(Budget $budget): JsonResponse
{ {
@ -147,7 +145,6 @@ class ListController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function transactions(Request $request, Budget $budget): JsonResponse public function transactions(Request $request, Budget $budget): JsonResponse
{ {
@ -211,7 +208,6 @@ class ListController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function withoutBudget(Request $request): JsonResponse public function withoutBudget(Request $request): JsonResponse
{ {

View File

@ -71,7 +71,6 @@ class ShowController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function index(): JsonResponse public function index(): JsonResponse
{ {
@ -105,7 +104,6 @@ class ShowController extends Controller
* @param Budget $budget * @param Budget $budget
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function show(Budget $budget): JsonResponse public function show(Budget $budget): JsonResponse
{ {

View File

@ -69,7 +69,6 @@ class DestroyController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function destroy(Budget $budget, BudgetLimit $budgetLimit): JsonResponse public function destroy(Budget $budget, BudgetLimit $budgetLimit): JsonResponse
{ {

View File

@ -77,7 +77,6 @@ class ListController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function transactions(Request $request, Budget $budget, BudgetLimit $budgetLimit): JsonResponse public function transactions(Request $request, Budget $budget, BudgetLimit $budgetLimit): JsonResponse
{ {

View File

@ -80,7 +80,6 @@ class ShowController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function index(Request $request, Budget $budget): JsonResponse public function index(Request $request, Budget $budget): JsonResponse
{ {
@ -113,7 +112,6 @@ class ShowController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function indexAll(DateRequest $request): JsonResponse public function indexAll(DateRequest $request): JsonResponse
{ {

View File

@ -62,7 +62,6 @@ class DestroyController extends Controller
* @param Category $category * @param Category $category
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function destroy(Category $category): JsonResponse public function destroy(Category $category): JsonResponse
{ {

View File

@ -73,7 +73,6 @@ class ListController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function attachments(Category $category): JsonResponse public function attachments(Category $category): JsonResponse
{ {
@ -110,7 +109,6 @@ class ListController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function transactions(Request $request, Category $category): JsonResponse public function transactions(Request $request, Category $category): JsonResponse
{ {

View File

@ -67,7 +67,6 @@ class ShowController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function index(): JsonResponse public function index(): JsonResponse
{ {
@ -103,7 +102,6 @@ class ShowController extends Controller
* @param Category $category * @param Category $category
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function show(Category $category): JsonResponse public function show(Category $category): JsonResponse
{ {

View File

@ -64,7 +64,6 @@ class DestroyController extends Controller
* *
* @param ObjectGroup $objectGroup * @param ObjectGroup $objectGroup
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function destroy(ObjectGroup $objectGroup): JsonResponse public function destroy(ObjectGroup $objectGroup): JsonResponse

View File

@ -72,7 +72,6 @@ class ListController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function bills(ObjectGroup $objectGroup): JsonResponse public function bills(ObjectGroup $objectGroup): JsonResponse
{ {
@ -108,7 +107,6 @@ class ListController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function piggyBanks(ObjectGroup $objectGroup): JsonResponse public function piggyBanks(ObjectGroup $objectGroup): JsonResponse
{ {

View File

@ -73,7 +73,6 @@ class ShowController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function index(Request $request): JsonResponse public function index(Request $request): JsonResponse
{ {

View File

@ -62,7 +62,6 @@ class DestroyController extends Controller
* @param PiggyBank $piggyBank * @param PiggyBank $piggyBank
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function destroy(PiggyBank $piggyBank): JsonResponse public function destroy(PiggyBank $piggyBank): JsonResponse
{ {

View File

@ -67,7 +67,6 @@ class ListController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function attachments(PiggyBank $piggyBank): JsonResponse public function attachments(PiggyBank $piggyBank): JsonResponse
{ {
@ -102,7 +101,6 @@ class ListController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function piggyBankEvents(PiggyBank $piggyBank): JsonResponse public function piggyBankEvents(PiggyBank $piggyBank): JsonResponse
{ {

View File

@ -67,7 +67,6 @@ class ShowController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function index(): JsonResponse public function index(): JsonResponse
{ {
@ -103,7 +102,6 @@ class ShowController extends Controller
* @param PiggyBank $piggyBank * @param PiggyBank $piggyBank
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function show(PiggyBank $piggyBank): JsonResponse public function show(PiggyBank $piggyBank): JsonResponse
{ {

View File

@ -62,7 +62,6 @@ class DestroyController extends Controller
* @param Recurrence $recurrence * @param Recurrence $recurrence
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function destroy(Recurrence $recurrence): JsonResponse public function destroy(Recurrence $recurrence): JsonResponse
{ {

View File

@ -74,7 +74,6 @@ class ListController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function transactions(Request $request, Recurrence $recurrence): JsonResponse public function transactions(Request $request, Recurrence $recurrence): JsonResponse
{ {

View File

@ -67,7 +67,6 @@ class ShowController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function index(): JsonResponse public function index(): JsonResponse
{ {
@ -104,7 +103,6 @@ class ShowController extends Controller
* @param Recurrence $recurrence * @param Recurrence $recurrence
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function show(Recurrence $recurrence): JsonResponse public function show(Recurrence $recurrence): JsonResponse
{ {

View File

@ -66,7 +66,6 @@ class DestroyController extends Controller
* @param Rule $rule * @param Rule $rule
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function destroy(Rule $rule): JsonResponse public function destroy(Rule $rule): JsonResponse
{ {

View File

@ -71,7 +71,6 @@ class ShowController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function index(): JsonResponse public function index(): JsonResponse
{ {
@ -108,7 +107,6 @@ class ShowController extends Controller
* @param Rule $rule * @param Rule $rule
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function show(Rule $rule): JsonResponse public function show(Rule $rule): JsonResponse
{ {

View File

@ -66,7 +66,6 @@ class DestroyController extends Controller
* @param RuleGroup $ruleGroup * @param RuleGroup $ruleGroup
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function destroy(RuleGroup $ruleGroup): JsonResponse public function destroy(RuleGroup $ruleGroup): JsonResponse
{ {

View File

@ -70,7 +70,6 @@ class ListController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function rules(RuleGroup $group): JsonResponse public function rules(RuleGroup $group): JsonResponse
{ {

View File

@ -70,7 +70,6 @@ class ShowController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function index(): JsonResponse public function index(): JsonResponse
{ {
@ -106,7 +105,6 @@ class ShowController extends Controller
* @param RuleGroup $ruleGroup * @param RuleGroup $ruleGroup
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function show(RuleGroup $ruleGroup): JsonResponse public function show(RuleGroup $ruleGroup): JsonResponse
{ {

View File

@ -66,7 +66,6 @@ class DestroyController extends Controller
* @param Tag $tag * @param Tag $tag
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function destroy(Tag $tag): JsonResponse public function destroy(Tag $tag): JsonResponse
{ {

View File

@ -76,7 +76,6 @@ class ListController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function attachments(Tag $tag): JsonResponse public function attachments(Tag $tag): JsonResponse
{ {
@ -112,7 +111,6 @@ class ListController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function transactions(Request $request, Tag $tag): JsonResponse public function transactions(Request $request, Tag $tag): JsonResponse
{ {

View File

@ -71,7 +71,6 @@ class ShowController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function index(): JsonResponse public function index(): JsonResponse
{ {
@ -107,7 +106,6 @@ class ShowController extends Controller
* @param Tag $tag * @param Tag $tag
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function show(Tag $tag): JsonResponse public function show(Tag $tag): JsonResponse
{ {

View File

@ -76,7 +76,6 @@ class DestroyController extends Controller
* @param TransactionGroup $transactionGroup * @param TransactionGroup $transactionGroup
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function destroy(TransactionGroup $transactionGroup): JsonResponse public function destroy(TransactionGroup $transactionGroup): JsonResponse
{ {
@ -116,7 +115,6 @@ class DestroyController extends Controller
* *
* @param TransactionJournal $transactionJournal * @param TransactionJournal $transactionJournal
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function destroyJournal(TransactionJournal $transactionJournal): JsonResponse public function destroyJournal(TransactionJournal $transactionJournal): JsonResponse

View File

@ -74,7 +74,6 @@ class ListController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function attachments(TransactionGroup $transactionGroup): JsonResponse public function attachments(TransactionGroup $transactionGroup): JsonResponse
{ {
@ -110,7 +109,6 @@ class ListController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function piggyBankEvents(TransactionGroup $transactionGroup): JsonResponse public function piggyBankEvents(TransactionGroup $transactionGroup): JsonResponse
{ {
@ -149,7 +147,6 @@ class ListController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function transactionLinks(TransactionJournal $transactionJournal): JsonResponse public function transactionLinks(TransactionJournal $transactionJournal): JsonResponse
{ {

View File

@ -55,7 +55,6 @@ class ShowController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function index(Request $request): JsonResponse public function index(Request $request): JsonResponse
{ {
@ -107,7 +106,6 @@ class ShowController extends Controller
* @param TransactionJournal $transactionJournal * @param TransactionJournal $transactionJournal
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function showJournal(TransactionJournal $transactionJournal): JsonResponse public function showJournal(TransactionJournal $transactionJournal): JsonResponse
{ {
@ -123,7 +121,6 @@ class ShowController extends Controller
* @param TransactionGroup $transactionGroup * @param TransactionGroup $transactionGroup
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function show(TransactionGroup $transactionGroup): JsonResponse public function show(TransactionGroup $transactionGroup): JsonResponse
{ {

View File

@ -39,7 +39,7 @@ use Validator;
class DestroyController extends Controller class DestroyController extends Controller
{ {
private CurrencyRepositoryInterface $repository; private CurrencyRepositoryInterface $repository;
private UserRepositoryInterface $userRepository; private UserRepositoryInterface $userRepository;
/** /**
* CurrencyRepository constructor. * CurrencyRepository constructor.
@ -51,7 +51,7 @@ class DestroyController extends Controller
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
$this->repository = app(CurrencyRepositoryInterface::class); $this->repository = app(CurrencyRepositoryInterface::class);
$this->userRepository = app(UserRepositoryInterface::class); $this->userRepository = app(UserRepositoryInterface::class);
$this->repository->setUser(auth()->user()); $this->repository->setUser(auth()->user());
@ -70,7 +70,6 @@ class DestroyController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function destroy(TransactionCurrency $currency): JsonResponse public function destroy(TransactionCurrency $currency): JsonResponse
{ {

View File

@ -41,7 +41,6 @@ use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface; use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface;
use FireflyIII\Repositories\Rule\RuleRepositoryInterface; use FireflyIII\Repositories\Rule\RuleRepositoryInterface;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\Support\Http\Api\AccountFilter; use FireflyIII\Support\Http\Api\AccountFilter;
use FireflyIII\Support\Http\Api\TransactionFilter; use FireflyIII\Support\Http\Api\TransactionFilter;
use FireflyIII\Transformers\AccountTransformer; use FireflyIII\Transformers\AccountTransformer;
@ -67,6 +66,7 @@ class ListController extends Controller
use TransactionFilter; use TransactionFilter;
private CurrencyRepositoryInterface $repository; private CurrencyRepositoryInterface $repository;
/** /**
* CurrencyRepository constructor. * CurrencyRepository constructor.
* *
@ -77,7 +77,7 @@ class ListController extends Controller
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
$this->repository = app(CurrencyRepositoryInterface::class); $this->repository = app(CurrencyRepositoryInterface::class);
$this->repository->setUser(auth()->user()); $this->repository->setUser(auth()->user());
return $next($request); return $next($request);
@ -95,7 +95,6 @@ class ListController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function accounts(Request $request, TransactionCurrency $currency): JsonResponse public function accounts(Request $request, TransactionCurrency $currency): JsonResponse
{ {
@ -149,7 +148,6 @@ class ListController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function availableBudgets(TransactionCurrency $currency): JsonResponse public function availableBudgets(TransactionCurrency $currency): JsonResponse
{ {
@ -188,7 +186,6 @@ class ListController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function bills(TransactionCurrency $currency): JsonResponse public function bills(TransactionCurrency $currency): JsonResponse
{ {
@ -232,7 +229,6 @@ class ListController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function budgetLimits(TransactionCurrency $currency): JsonResponse public function budgetLimits(TransactionCurrency $currency): JsonResponse
{ {
@ -267,7 +263,6 @@ class ListController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function recurrences(TransactionCurrency $currency): JsonResponse public function recurrences(TransactionCurrency $currency): JsonResponse
{ {
@ -320,7 +315,6 @@ class ListController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function rules(TransactionCurrency $currency): JsonResponse public function rules(TransactionCurrency $currency): JsonResponse
{ {
@ -374,7 +368,6 @@ class ListController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function transactions(Request $request, TransactionCurrency $currency): JsonResponse public function transactions(Request $request, TransactionCurrency $currency): JsonResponse
{ {

View File

@ -75,7 +75,6 @@ class ShowController extends Controller
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
* @throws JsonException * @throws JsonException
*/ */
public function index(): JsonResponse public function index(): JsonResponse
{ {
@ -111,7 +110,6 @@ class ShowController extends Controller
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
* @throws JsonException * @throws JsonException
*/ */
public function show(TransactionCurrency $currency): JsonResponse public function show(TransactionCurrency $currency): JsonResponse
{ {
@ -137,7 +135,6 @@ class ShowController extends Controller
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
* @throws JsonException * @throws JsonException
*/ */
public function showDefault(): JsonResponse public function showDefault(): JsonResponse
{ {

View File

@ -29,7 +29,6 @@ use FireflyIII\Api\V1\Requests\Models\TransactionCurrency\UpdateRequest;
use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\Support\Http\Api\AccountFilter; use FireflyIII\Support\Http\Api\AccountFilter;
use FireflyIII\Support\Http\Api\TransactionFilter; use FireflyIII\Support\Http\Api\TransactionFilter;
use FireflyIII\Transformers\CurrencyTransformer; use FireflyIII\Transformers\CurrencyTransformer;
@ -76,7 +75,6 @@ class UpdateController extends Controller
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
* @throws JsonException * @throws JsonException
*/ */
public function disable(TransactionCurrency $currency): JsonResponse public function disable(TransactionCurrency $currency): JsonResponse
{ {
@ -109,7 +107,6 @@ class UpdateController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function makeDefault(TransactionCurrency $currency): JsonResponse public function makeDefault(TransactionCurrency $currency): JsonResponse
{ {
@ -142,7 +139,6 @@ class UpdateController extends Controller
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
* @throws JsonException * @throws JsonException
*/ */
public function enable(TransactionCurrency $currency): JsonResponse public function enable(TransactionCurrency $currency): JsonResponse
{ {

View File

@ -65,7 +65,6 @@ class DestroyController extends Controller
* @param TransactionJournalLink $link * @param TransactionJournalLink $link
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function destroy(TransactionJournalLink $link): JsonResponse public function destroy(TransactionJournalLink $link): JsonResponse
{ {

View File

@ -73,7 +73,6 @@ class ShowController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function index(Request $request): JsonResponse public function index(Request $request): JsonResponse
{ {
@ -114,7 +113,6 @@ class ShowController extends Controller
* @param TransactionJournalLink $journalLink * @param TransactionJournalLink $journalLink
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function show(TransactionJournalLink $journalLink): JsonResponse public function show(TransactionJournalLink $journalLink): JsonResponse
{ {

View File

@ -29,7 +29,6 @@ use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Models\LinkType; use FireflyIII\Models\LinkType;
use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface; use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\Support\Http\Api\TransactionFilter; use FireflyIII\Support\Http\Api\TransactionFilter;
use FireflyIII\Transformers\TransactionGroupTransformer; use FireflyIII\Transformers\TransactionGroupTransformer;
use FireflyIII\User; use FireflyIII\User;
@ -58,8 +57,8 @@ class ListController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
/** @var User $user */ /** @var User $user */
$user = auth()->user(); $user = auth()->user();
$this->repository = app(LinkTypeRepositoryInterface::class); $this->repository = app(LinkTypeRepositoryInterface::class);
$this->repository->setUser($user); $this->repository->setUser($user);
return $next($request); return $next($request);
@ -76,7 +75,6 @@ class ListController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function transactions(Request $request, LinkType $linkType): JsonResponse public function transactions(Request $request, LinkType $linkType): JsonResponse
{ {

View File

@ -28,7 +28,6 @@ use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\LinkType; use FireflyIII\Models\LinkType;
use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface; use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\Support\Http\Api\TransactionFilter; use FireflyIII\Support\Http\Api\TransactionFilter;
use FireflyIII\Transformers\LinkTypeTransformer; use FireflyIII\Transformers\LinkTypeTransformer;
use FireflyIII\User; use FireflyIII\User;
@ -58,8 +57,8 @@ class ShowController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
/** @var User $user */ /** @var User $user */
$user = auth()->user(); $user = auth()->user();
$this->repository = app(LinkTypeRepositoryInterface::class); $this->repository = app(LinkTypeRepositoryInterface::class);
$this->repository->setUser($user); $this->repository->setUser($user);
return $next($request); return $next($request);
@ -74,7 +73,6 @@ class ShowController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function index(): JsonResponse public function index(): JsonResponse
{ {
@ -110,7 +108,6 @@ class ShowController extends Controller
* @param LinkType $linkType * @param LinkType $linkType
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function show(LinkType $linkType): JsonResponse public function show(LinkType $linkType): JsonResponse
{ {

View File

@ -360,7 +360,9 @@ class BasicController extends Controller
/** @var NetWorthInterface $netWorthHelper */ /** @var NetWorthInterface $netWorthHelper */
$netWorthHelper = app(NetWorthInterface::class); $netWorthHelper = app(NetWorthInterface::class);
$netWorthHelper->setUser($user); $netWorthHelper->setUser($user);
$allAccounts = $this->accountRepository->getActiveAccountsByType([AccountType::ASSET, AccountType::DEFAULT, AccountType::LOAN, AccountType::MORTGAGE, AccountType::DEBT]); $allAccounts = $this->accountRepository->getActiveAccountsByType(
[AccountType::ASSET, AccountType::DEFAULT, AccountType::LOAN, AccountType::MORTGAGE, AccountType::DEBT]
);
// filter list on preference of being included. // filter list on preference of being included.
$filtered = $allAccounts->filter( $filtered = $allAccounts->filter(

View File

@ -33,7 +33,6 @@ use League\Fractal\Resource\Item;
/** /**
* Returns basic information about this installation. * Returns basic information about this installation.
* *
* Class AboutController. * Class AboutController.
*/ */
class AboutController extends Controller class AboutController extends Controller

View File

@ -61,7 +61,9 @@ class ConfigurationController extends Controller
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/configuration/getConfiguration * https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/configuration/getConfiguration
* *
* @return JsonResponse * @return JsonResponse
* @throws ContainerExceptionInterface
* @throws FireflyException * @throws FireflyException
* @throws NotFoundExceptionInterface
*/ */
public function index(): JsonResponse public function index(): JsonResponse
{ {
@ -96,7 +98,6 @@ class ConfigurationController extends Controller
* Get all config values. * Get all config values.
* *
* @return array * @return array
* @throws FireflyException
* @throws ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
@ -136,7 +137,9 @@ class ConfigurationController extends Controller
* @param string $configKey * @param string $configKey
* *
* @return JsonResponse * @return JsonResponse
* @throws ContainerExceptionInterface
* @throws FireflyException * @throws FireflyException
* @throws NotFoundExceptionInterface
*/ */
public function show(string $configKey): JsonResponse public function show(string $configKey): JsonResponse
{ {
@ -171,7 +174,9 @@ class ConfigurationController extends Controller
* @param string $name * @param string $name
* *
* @return JsonResponse * @return JsonResponse
* @throws ContainerExceptionInterface
* @throws FireflyException * @throws FireflyException
* @throws NotFoundExceptionInterface
*/ */
public function update(UpdateRequest $request, string $name): JsonResponse public function update(UpdateRequest $request, string $name): JsonResponse
{ {

View File

@ -72,7 +72,6 @@ class UserController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function destroy(User $user): JsonResponse public function destroy(User $user): JsonResponse
{ {
@ -98,7 +97,6 @@ class UserController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function index(): JsonResponse public function index(): JsonResponse
{ {
@ -135,7 +133,6 @@ class UserController extends Controller
* @param User $user * @param User $user
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function show(User $user): JsonResponse public function show(User $user): JsonResponse
{ {
@ -191,7 +188,7 @@ class UserController extends Controller
*/ */
public function update(UserUpdateRequest $request, User $user): JsonResponse public function update(UserUpdateRequest $request, User $user): JsonResponse
{ {
$data = $request->getAll(); $data = $request->getAll();
// can only update 'blocked' when user is admin. // can only update 'blocked' when user is admin.
if (!$this->repository->hasRole(auth()->user(), 'owner')) { if (!$this->repository->hasRole(auth()->user(), 'owner')) {

View File

@ -52,7 +52,6 @@ class PreferencesController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function index(): JsonResponse public function index(): JsonResponse
{ {
@ -85,7 +84,6 @@ class PreferencesController extends Controller
* @param Preference $preference * @param Preference $preference
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function show(Preference $preference): JsonResponse public function show(Preference $preference): JsonResponse
{ {

View File

@ -45,7 +45,6 @@ class AttemptController extends Controller
private WebhookRepositoryInterface $repository; private WebhookRepositoryInterface $repository;
/** /**
*/ */
public function __construct() public function __construct()
{ {

View File

@ -40,7 +40,6 @@ class DestroyController extends Controller
private WebhookRepositoryInterface $repository; private WebhookRepositoryInterface $repository;
/** /**
*/ */
public function __construct() public function __construct()
{ {
@ -64,7 +63,6 @@ class DestroyController extends Controller
* @param Webhook $webhook * @param Webhook $webhook
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function destroy(Webhook $webhook): JsonResponse public function destroy(Webhook $webhook): JsonResponse
{ {
@ -86,7 +84,6 @@ class DestroyController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function destroyAttempt(Webhook $webhook, WebhookMessage $message, WebhookAttempt $attempt): JsonResponse public function destroyAttempt(Webhook $webhook, WebhookMessage $message, WebhookAttempt $attempt): JsonResponse
{ {
@ -114,7 +111,6 @@ class DestroyController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function destroyMessage(Webhook $webhook, WebhookMessage $message): JsonResponse public function destroyMessage(Webhook $webhook, WebhookMessage $message): JsonResponse
{ {

View File

@ -41,7 +41,6 @@ class MessageController extends Controller
private WebhookRepositoryInterface $repository; private WebhookRepositoryInterface $repository;
/** /**
*/ */
public function __construct() public function __construct()
{ {

View File

@ -24,9 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Webhook; namespace FireflyIII\Api\V1\Controllers\Webhook;
use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Enums\WebhookTrigger;
use FireflyIII\Events\RequestedSendWebhookMessages; use FireflyIII\Events\RequestedSendWebhookMessages;
use FireflyIII\Events\StoredTransactionGroup;
use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Generator\Webhook\MessageGeneratorInterface; use FireflyIII\Generator\Webhook\MessageGeneratorInterface;
use FireflyIII\Models\TransactionGroup; use FireflyIII\Models\TransactionGroup;
@ -49,7 +47,6 @@ class ShowController extends Controller
private WebhookRepositoryInterface $repository; private WebhookRepositoryInterface $repository;
/** /**
*/ */
public function __construct() public function __construct()
{ {
@ -72,7 +69,6 @@ class ShowController extends Controller
* *
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
*/ */
public function index(): JsonResponse public function index(): JsonResponse
{ {

View File

@ -39,7 +39,6 @@ class StoreController extends Controller
private WebhookRepositoryInterface $repository; private WebhookRepositoryInterface $repository;
/** /**
*/ */
public function __construct() public function __construct()
{ {

View File

@ -37,7 +37,6 @@ class SubmitController extends Controller
private WebhookRepositoryInterface $repository; private WebhookRepositoryInterface $repository;
/** /**
*/ */
public function __construct() public function __construct()
{ {
@ -59,7 +58,6 @@ class SubmitController extends Controller
* @param Webhook $webhook * @param Webhook $webhook
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function submit(Webhook $webhook): JsonResponse public function submit(Webhook $webhook): JsonResponse
{ {

View File

@ -39,7 +39,6 @@ class UpdateController extends Controller
private WebhookRepositoryInterface $repository; private WebhookRepositoryInterface $repository;
/** /**
*/ */
public function __construct() public function __construct()
{ {

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Data\Export; namespace FireflyIII\Api\V1\Requests\Data\Export;
use Carbon\Carbon;
use FireflyIII\Models\AccountType; use FireflyIII\Models\AccountType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Support\Request\ChecksLogin; use FireflyIII\Support\Request\ChecksLogin;

View File

@ -83,9 +83,9 @@ class StoreRequest extends FormRequest
$data = $this->appendLocationData($data, null); $data = $this->appendLocationData($data, null);
if ('liability' === $data['account_type_name'] || 'liabilities' === $data['account_type_name']) { if ('liability' === $data['account_type_name'] || 'liabilities' === $data['account_type_name']) {
$data['account_type_name'] = $this->convertString('liability_type'); $data['account_type_name'] = $this->convertString('liability_type');
$data['liability_direction'] = $this->convertString('liability_direction'); $data['liability_direction'] = $this->convertString('liability_direction');
$data['account_type_id'] = null; $data['account_type_id'] = null;
} }
return $data; return $data;

View File

@ -76,7 +76,7 @@ class UpdateRequest extends FormRequest
'liability_amount' => ['liability_amount', 'convertString'], 'liability_amount' => ['liability_amount', 'convertString'],
'liability_start_date' => ['liability_start_date', 'date'], 'liability_start_date' => ['liability_start_date', 'date'],
]; ];
$data = $this->getAllData($fields); $data = $this->getAllData($fields);
return $this->appendLocationData($data, null); return $this->appendLocationData($data, null);
} }

View File

@ -29,7 +29,6 @@ use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
/** /**
* Class StoreRequest * Class StoreRequest
*/ */
class StoreRequest extends FormRequest class StoreRequest extends FormRequest

View File

@ -30,7 +30,6 @@ use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
/** /**
* Class UpdateRequest * Class UpdateRequest
*/ */
class UpdateRequest extends FormRequest class UpdateRequest extends FormRequest

View File

@ -24,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\System; namespace FireflyIII\Api\V1\Requests\System;
use Carbon\Carbon;
use FireflyIII\Support\Request\ConvertsDataTypes; use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;

View File

@ -32,6 +32,8 @@ use FireflyIII\Models\AccountType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Support\Http\Api\ConvertsExchangeRates; use FireflyIII\Support\Http\Api\ConvertsExchangeRates;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/** /**
* Class AccountController * Class AccountController
@ -62,6 +64,8 @@ class AccountController extends Controller
* *
* @param DateRequest $request * @param DateRequest $request
* @return JsonResponse * @return JsonResponse
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/ */
public function dashboard(DateRequest $request): JsonResponse public function dashboard(DateRequest $request): JsonResponse
{ {

View File

@ -37,8 +37,6 @@ class ShowController extends Controller
{ {
/** /**
* TODO this endpoint is not yet reachable. * TODO this endpoint is not yet reachable.
* @param Account $account
* @return JsonResponse
*/ */
public function show(Request $request, Account $account): JsonResponse public function show(Request $request, Account $account): JsonResponse
{ {

View File

@ -57,8 +57,6 @@ class ShowController extends Controller
* This endpoint is documented at: * This endpoint is documented at:
* TODO add URL * TODO add URL
* *
* @param DateRequest $request
* @return JsonResponse
*/ */
public function budgeted(DateRequest $request, Budget $budget): JsonResponse public function budgeted(DateRequest $request, Budget $budget): JsonResponse
{ {
@ -73,8 +71,6 @@ class ShowController extends Controller
* This endpoint is documented at: * This endpoint is documented at:
* TODO add URL * TODO add URL
* *
* @param DateRequest $request
* @return JsonResponse
*/ */
public function spent(DateRequest $request, Budget $budget): JsonResponse public function spent(DateRequest $request, Budget $budget): JsonResponse
{ {

View File

@ -50,7 +50,6 @@ class ListController extends Controller
/** /**
* This endpoint is documented at: * This endpoint is documented at:
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v2)#/budgets/listBudgetLimitByBudget * https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v2)#/budgets/listBudgetLimitByBudget
* @return JsonResponse
*/ */
public function index(DateRequest $request, Budget $budget): JsonResponse public function index(DateRequest $request, Budget $budget): JsonResponse
{ {

View File

@ -26,7 +26,6 @@ namespace FireflyIII\Api\V2\Controllers;
use FireflyIII\Api\V2\Request\Generic\SingleDateRequest; use FireflyIII\Api\V2\Request\Generic\SingleDateRequest;
use FireflyIII\Helpers\Report\NetWorthInterface; use FireflyIII\Helpers\Report\NetWorthInterface;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Support\Http\Api\ConvertsExchangeRates; use FireflyIII\Support\Http\Api\ConvertsExchangeRates;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
@ -37,7 +36,7 @@ class NetWorthController extends Controller
{ {
use ConvertsExchangeRates; use ConvertsExchangeRates;
private NetWorthInterface $netWorth; private NetWorthInterface $netWorth;
/** /**
* *
@ -47,7 +46,7 @@ class NetWorthController extends Controller
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
$this->netWorth = app(NetWorthInterface::class); $this->netWorth = app(NetWorthInterface::class);
$this->netWorth->setUser(auth()->user()); $this->netWorth->setUser(auth()->user());
return $next($request); return $next($request);
} }

View File

@ -94,6 +94,8 @@ class CorrectOpeningBalanceCurrencies extends Command
* @param TransactionJournal $journal * @param TransactionJournal $journal
* *
* @return int * @return int
* @throws FireflyException
* @throws JsonException
*/ */
private function correctJournal(TransactionJournal $journal): int private function correctJournal(TransactionJournal $journal): int
{ {

View File

@ -27,7 +27,6 @@ use Exception;
use FireflyIII\Models\Transaction; use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournal;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Database\QueryException;
use Log; use Log;
use stdClass; use stdClass;

View File

@ -26,7 +26,6 @@ namespace FireflyIII\Console\Commands\Correction;
use FireflyIII\Models\Transaction; use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournal;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Database\QueryException;
/** /**
* Class DeleteZeroAmount * Class DeleteZeroAmount

View File

@ -30,6 +30,7 @@ use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType; use FireflyIII\Models\TransactionType;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use JsonException;
use Log; use Log;
/** /**
@ -166,6 +167,7 @@ class FixAccountTypes extends Command
* @param Transaction $dest * @param Transaction $dest
* *
* @throws FireflyException * @throws FireflyException
* @throws JsonException
*/ */
private function fixJournal(TransactionJournal $journal, string $type, Transaction $source, Transaction $dest): void private function fixJournal(TransactionJournal $journal, string $type, Transaction $source, Transaction $dest): void
{ {

View File

@ -147,7 +147,7 @@ class FixTransactionTypes extends Command
/** @var Transaction $transaction */ /** @var Transaction $transaction */
$transaction = $collection->first(); $transaction = $collection->first();
/** @var Account|null $account */ /** @var Account|null $account */
$account = $transaction->account; $account = $transaction->account;
if (null === $account) { if (null === $account) {
throw new FireflyException(sprintf('300003: Journal #%d, transaction #%d has no source account.', $journal->id, $transaction->id)); throw new FireflyException(sprintf('300003: Journal #%d, transaction #%d has no source account.', $journal->id, $transaction->id));
} }
@ -177,7 +177,7 @@ class FixTransactionTypes extends Command
/** @var Transaction $transaction */ /** @var Transaction $transaction */
$transaction = $collection->first(); $transaction = $collection->first();
/** @var Account|null $account */ /** @var Account|null $account */
$account = $transaction->account; $account = $transaction->account;
if (null === $account) { if (null === $account) {
throw new FireflyException(sprintf('300006: Journal #%d, transaction #%d has no destination account.', $journal->id, $transaction->id)); throw new FireflyException(sprintf('300006: Journal #%d, transaction #%d has no destination account.', $journal->id, $transaction->id));
} }

View File

@ -90,6 +90,8 @@ class DecryptDatabase extends Command
/** /**
* @param string $table * @param string $table
* @param array $fields * @param array $fields
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/ */
private function decryptTable(string $table, array $fields): void private function decryptTable(string $table, array $fields): void
{ {

View File

@ -33,6 +33,8 @@ use FireflyIII\Support\Cronjobs\RecurringCronjob;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use InvalidArgumentException; use InvalidArgumentException;
use Log; use Log;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/** /**
* Class Cron * Class Cron
@ -124,7 +126,6 @@ class Cron extends Command
/** /**
* @param bool $force * @param bool $force
* @param Carbon|null $date * @param Carbon|null $date
* @throws FireflyException
*/ */
private function exchangeRatesCronJob(bool $force, ?Carbon $date): void private function exchangeRatesCronJob(bool $force, ?Carbon $date): void
{ {
@ -152,7 +153,9 @@ class Cron extends Command
* @param bool $force * @param bool $force
* @param Carbon|null $date * @param Carbon|null $date
* *
* @throws ContainerExceptionInterface
* @throws FireflyException * @throws FireflyException
* @throws NotFoundExceptionInterface
*/ */
private function recurringCronJob(bool $force, ?Carbon $date): void private function recurringCronJob(bool $force, ?Carbon $date): void
{ {
@ -207,6 +210,8 @@ class Cron extends Command
* @param bool $force * @param bool $force
* @param Carbon|null $date * @param Carbon|null $date
* @throws FireflyException * @throws FireflyException
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/ */
private function billWarningCronJob(bool $force, ?Carbon $date): void private function billWarningCronJob(bool $force, ?Carbon $date): void
{ {

View File

@ -66,7 +66,9 @@ class AccountCurrencies extends Command
* Each (asset) account must have a reference to a preferred currency. If the account does not have one, it's forced upon the account. * Each (asset) account must have a reference to a preferred currency. If the account does not have one, it's forced upon the account.
* *
* @return int * @return int
* @throws ContainerExceptionInterface
* @throws FireflyException * @throws FireflyException
* @throws NotFoundExceptionInterface
*/ */
public function handle(): int public function handle(): int
{ {
@ -110,7 +112,6 @@ class AccountCurrencies extends Command
/** /**
* @return bool * @return bool
* @throws FireflyException
* @throws ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */

View File

@ -50,7 +50,9 @@ class AppendBudgetLimitPeriods extends Command
* Execute the console command. * Execute the console command.
* *
* @return int * @return int
* @throws ContainerExceptionInterface
* @throws FireflyException * @throws FireflyException
* @throws NotFoundExceptionInterface
*/ */
public function handle(): int public function handle(): int
{ {
@ -73,7 +75,6 @@ class AppendBudgetLimitPeriods extends Command
/** /**
* @return bool * @return bool
* @throws FireflyException
* @throws ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */

View File

@ -58,7 +58,9 @@ class BackToJournals extends Command
* Execute the console command. * Execute the console command.
* *
* @return int * @return int
* @throws ContainerExceptionInterface
* @throws FireflyException * @throws FireflyException
* @throws NotFoundExceptionInterface
*/ */
public function handle(): int public function handle(): int
{ {
@ -86,6 +88,8 @@ class BackToJournals extends Command
/** /**
* @return bool * @return bool
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/ */
private function isMigrated(): bool private function isMigrated(): bool
{ {
@ -96,7 +100,6 @@ class BackToJournals extends Command
/** /**
* @return bool * @return bool
* @throws FireflyException
* @throws ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */

View File

@ -26,7 +26,6 @@ namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\BudgetLimit; use FireflyIII\Models\BudgetLimit;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use JsonException;
use Psr\Container\ContainerExceptionInterface; use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface; use Psr\Container\NotFoundExceptionInterface;
@ -53,8 +52,9 @@ class BudgetLimitCurrency extends Command
* Execute the console command. * Execute the console command.
* *
* @return int * @return int
* @throws ContainerExceptionInterface
* @throws FireflyException * @throws FireflyException
* @throws JsonException * @throws NotFoundExceptionInterface
*/ */
public function handle(): int public function handle(): int
{ {
@ -100,7 +100,6 @@ class BudgetLimitCurrency extends Command
/** /**
* @return bool * @return bool
* @throws FireflyException
* @throws ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */

View File

@ -54,7 +54,9 @@ class CCLiabilities extends Command
* Execute the console command. * Execute the console command.
* *
* @return int * @return int
* @throws ContainerExceptionInterface
* @throws FireflyException * @throws FireflyException
* @throws NotFoundExceptionInterface
*/ */
public function handle(): int public function handle(): int
{ {
@ -97,7 +99,6 @@ class CCLiabilities extends Command
/** /**
* @return bool * @return bool
* @throws FireflyException
* @throws ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */

View File

@ -54,7 +54,9 @@ class MigrateAttachments extends Command
* Execute the console command. * Execute the console command.
* *
* @return int * @return int
* @throws ContainerExceptionInterface
* @throws FireflyException * @throws FireflyException
* @throws NotFoundExceptionInterface
*/ */
public function handle(): int public function handle(): int
{ {
@ -106,7 +108,6 @@ class MigrateAttachments extends Command
/** /**
* @return bool * @return bool
* @throws FireflyException
* @throws ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */

View File

@ -27,7 +27,6 @@ use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Note; use FireflyIII\Models\Note;
use FireflyIII\Models\TransactionJournalMeta; use FireflyIII\Models\TransactionJournalMeta;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Database\QueryException;
use Log; use Log;
use Psr\Container\ContainerExceptionInterface; use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface; use Psr\Container\NotFoundExceptionInterface;
@ -55,7 +54,9 @@ class MigrateJournalNotes extends Command
* Execute the console command. * Execute the console command.
* *
* @return int * @return int
* @throws ContainerExceptionInterface
* @throws FireflyException * @throws FireflyException
* @throws NotFoundExceptionInterface
*/ */
public function handle(): int public function handle(): int
{ {
@ -102,7 +103,6 @@ class MigrateJournalNotes extends Command
/** /**
* @return bool * @return bool
* @throws FireflyException
* @throws ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */

View File

@ -56,8 +56,10 @@ class MigrateRecurrenceMeta extends Command
* Execute the console command. * Execute the console command.
* *
* @return int * @return int
* @throws ContainerExceptionInterface
* @throws FireflyException * @throws FireflyException
* @throws JsonException * @throws JsonException
* @throws NotFoundExceptionInterface
*/ */
public function handle(): int public function handle(): int
{ {
@ -86,7 +88,6 @@ class MigrateRecurrenceMeta extends Command
/** /**
* @return bool * @return bool
* @throws FireflyException
* @throws ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */

View File

@ -55,7 +55,9 @@ class MigrateRecurrenceType extends Command
* Execute the console command. * Execute the console command.
* *
* @return int * @return int
* @throws ContainerExceptionInterface
* @throws FireflyException * @throws FireflyException
* @throws NotFoundExceptionInterface
*/ */
public function handle(): int public function handle(): int
{ {
@ -78,7 +80,6 @@ class MigrateRecurrenceType extends Command
/** /**
* @return bool * @return bool
* @throws FireflyException
* @throws ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */

View File

@ -54,7 +54,9 @@ class MigrateTagLocations extends Command
* Execute the console command. * Execute the console command.
* *
* @return int * @return int
* @throws ContainerExceptionInterface
* @throws FireflyException * @throws FireflyException
* @throws NotFoundExceptionInterface
*/ */
public function handle(): int public function handle(): int
{ {
@ -75,7 +77,6 @@ class MigrateTagLocations extends Command
/** /**
* @return bool * @return bool
* @throws FireflyException
* @throws ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */

View File

@ -72,7 +72,9 @@ class MigrateToGroups extends Command
* Execute the console command. * Execute the console command.
* *
* @return int * @return int
* @throws Exception * @throws ContainerExceptionInterface
* @throws FireflyException
* @throws NotFoundExceptionInterface
*/ */
public function handle(): int public function handle(): int
{ {
@ -130,7 +132,6 @@ class MigrateToGroups extends Command
/** /**
* @return bool * @return bool
* @throws FireflyException
* @throws ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */

View File

@ -68,7 +68,9 @@ class MigrateToRules extends Command
* Execute the console command. * Execute the console command.
* *
* @return int * @return int
* @throws ContainerExceptionInterface
* @throws FireflyException * @throws FireflyException
* @throws NotFoundExceptionInterface
*/ */
public function handle(): int public function handle(): int
{ {
@ -121,7 +123,6 @@ class MigrateToRules extends Command
/** /**
* @return bool * @return bool
* @throws FireflyException
* @throws ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */

View File

@ -67,7 +67,9 @@ class OtherCurrenciesCorrections extends Command
* Execute the console command. * Execute the console command.
* *
* @return int * @return int
* @throws ContainerExceptionInterface
* @throws FireflyException * @throws FireflyException
* @throws NotFoundExceptionInterface
*/ */
public function handle(): int public function handle(): int
{ {
@ -110,7 +112,6 @@ class OtherCurrenciesCorrections extends Command
/** /**
* @return bool * @return bool
* @throws FireflyException
* @throws ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */

View File

@ -52,7 +52,9 @@ class RenameAccountMeta extends Command
* Execute the console command. * Execute the console command.
* *
* @return int * @return int
* @throws ContainerExceptionInterface
* @throws FireflyException * @throws FireflyException
* @throws NotFoundExceptionInterface
*/ */
public function handle(): int public function handle(): int
{ {
@ -100,7 +102,6 @@ class RenameAccountMeta extends Command
/** /**
* @return bool * @return bool
* @throws FireflyException
* @throws ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */

View File

@ -27,7 +27,6 @@ use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Transaction; use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Journal\JournalCLIRepositoryInterface; use FireflyIII\Repositories\Journal\JournalCLIRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Database\QueryException; use Illuminate\Database\QueryException;
use Log; use Log;
@ -68,7 +67,9 @@ class TransactionIdentifier extends Command
* think. So each set gets a number (1,2,3) to keep them apart. * think. So each set gets a number (1,2,3) to keep them apart.
* *
* @return int * @return int
* @throws ContainerExceptionInterface
* @throws FireflyException * @throws FireflyException
* @throws NotFoundExceptionInterface
*/ */
public function handle(): int public function handle(): int
{ {
@ -115,13 +116,12 @@ class TransactionIdentifier extends Command
*/ */
private function stupidLaravel(): void private function stupidLaravel(): void
{ {
$this->cliRepository = app(JournalCLIRepositoryInterface::class); $this->cliRepository = app(JournalCLIRepositoryInterface::class);
$this->count = 0; $this->count = 0;
} }
/** /**
* @return bool * @return bool
* @throws FireflyException
* @throws ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */

View File

@ -138,7 +138,6 @@ class TransferCurrenciesCorrections extends Command
/** /**
* @return bool * @return bool
* @throws FireflyException
* @throws ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
@ -238,7 +237,6 @@ class TransferCurrenciesCorrections extends Command
* @param TransactionJournal $transfer * @param TransactionJournal $transfer
* *
* @return bool * @return bool
*/ */
private function isSplitJournal(TransactionJournal $transfer): bool private function isSplitJournal(TransactionJournal $transfer): bool
{ {
@ -263,7 +261,6 @@ class TransferCurrenciesCorrections extends Command
* @param TransactionJournal $transfer * @param TransactionJournal $transfer
* *
* @return Transaction|null * @return Transaction|null
*/ */
private function getSourceTransaction(TransactionJournal $transfer): ?Transaction private function getSourceTransaction(TransactionJournal $transfer): ?Transaction
{ {
@ -313,7 +310,6 @@ class TransferCurrenciesCorrections extends Command
* @param TransactionJournal $transfer * @param TransactionJournal $transfer
* *
* @return Transaction|null * @return Transaction|null
*/ */
private function getDestinationTransaction(TransactionJournal $transfer): ?Transaction private function getDestinationTransaction(TransactionJournal $transfer): ?Transaction
{ {
@ -324,7 +320,6 @@ class TransferCurrenciesCorrections extends Command
* Is either the source or destination transaction NULL? * Is either the source or destination transaction NULL?
* *
* @return bool * @return bool
*/ */
private function isEmptyTransactions(): bool private function isEmptyTransactions(): bool
{ {
@ -335,7 +330,6 @@ class TransferCurrenciesCorrections extends Command
/** /**
* @return bool * @return bool
*/ */
private function isNoCurrencyPresent(): bool private function isNoCurrencyPresent(): bool
{ {

View File

@ -60,7 +60,9 @@ class UpgradeLiabilities extends Command
* Execute the console command. * Execute the console command.
* *
* @return int * @return int
* @throws ContainerExceptionInterface
* @throws FireflyException * @throws FireflyException
* @throws NotFoundExceptionInterface
*/ */
public function handle(): int public function handle(): int
{ {
@ -82,7 +84,6 @@ class UpgradeLiabilities extends Command
/** /**
* @return bool * @return bool
* @throws FireflyException
* @throws ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */

View File

@ -62,7 +62,9 @@ class UpgradeLiabilitiesEight extends Command
* Execute the console command. * Execute the console command.
* *
* @return int * @return int
* @throws ContainerExceptionInterface
* @throws FireflyException * @throws FireflyException
* @throws NotFoundExceptionInterface
*/ */
public function handle(): int public function handle(): int
{ {
@ -83,7 +85,6 @@ class UpgradeLiabilitiesEight extends Command
/** /**
* @return bool * @return bool
* @throws FireflyException
* @throws ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
@ -158,6 +159,90 @@ class UpgradeLiabilitiesEight extends Command
Log::debug(sprintf('Done upgrading liability #%d ("%s")', $account->id, $account->name)); Log::debug(sprintf('Done upgrading liability #%d ("%s")', $account->id, $account->name));
} }
/**
* @param Account $account
* @return bool
*/
private function hasBadOpening(Account $account): bool
{
$openingBalanceType = TransactionType::whereType(TransactionType::OPENING_BALANCE)->first();
$liabilityType = TransactionType::whereType(TransactionType::LIABILITY_CREDIT)->first();
$openingJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->where('transactions.account_id', $account->id)
->where('transaction_journals.transaction_type_id', $openingBalanceType->id)
->first(['transaction_journals.*']);
if (null === $openingJournal) {
Log::debug('Account has no opening balance and can be skipped.');
return false;
}
$liabilityJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->where('transactions.account_id', $account->id)
->where('transaction_journals.transaction_type_id', $liabilityType->id)
->first(['transaction_journals.*']);
if (null === $liabilityJournal) {
Log::debug('Account has no liability credit and can be skipped.');
return false;
}
if (!$openingJournal->date->isSameDay($liabilityJournal->date)) {
Log::debug('Account has opening/credit not on the same day.');
return false;
}
Log::debug('Account has bad opening balance data.');
return true;
}
/**
* @param Account $account
* @return void
*/
private function deleteCreditTransaction(Account $account): void
{
Log::debug('Will delete credit transaction.');
$liabilityType = TransactionType::whereType(TransactionType::LIABILITY_CREDIT)->first();
$liabilityJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->where('transactions.account_id', $account->id)
->where('transaction_journals.transaction_type_id', $liabilityType->id)
->first(['transaction_journals.*']);
if (null !== $liabilityJournal) {
$group = $liabilityJournal->transactionGroup;
$service = new TransactionGroupDestroyService();
$service->destroy($group);
Log::debug(sprintf('Deleted liability credit group #%d', $group->id));
return;
}
Log::debug('No liability credit journal found.');
}
/**
* @param Account $account
* @return void
*/
private function reverseOpeningBalance(Account $account): void
{
$openingBalanceType = TransactionType::whereType(TransactionType::OPENING_BALANCE)->first();
/** @var TransactionJournal $openingJournal */
$openingJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->where('transactions.account_id', $account->id)
->where('transaction_journals.transaction_type_id', $openingBalanceType->id)
->first(['transaction_journals.*']);
/** @var Transaction|null $source */
$source = $openingJournal->transactions()->where('amount', '<', 0)->first();
/** @var Transaction|null $dest */
$dest = $openingJournal->transactions()->where('amount', '>', 0)->first();
if ($source && $dest) {
$sourceId = $source->account_id;
$destId = $dest->account_id;
$dest->account_id = $sourceId;
$source->account_id = $destId;
$source->save();
$dest->save();
Log::debug(sprintf('Opening balance transaction journal #%d reversed.', $openingJournal->id));
return;
}
Log::warning('Did not find opening balance.');
}
/** /**
* @param $account * @param $account
* @return int * @return int
@ -203,29 +288,6 @@ class UpgradeLiabilitiesEight extends Command
return $count; return $count;
} }
/**
* @param Account $account
* @return void
*/
private function deleteCreditTransaction(Account $account): void
{
Log::debug('Will delete credit transaction.');
$liabilityType = TransactionType::whereType(TransactionType::LIABILITY_CREDIT)->first();
$liabilityJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->where('transactions.account_id', $account->id)
->where('transaction_journals.transaction_type_id', $liabilityType->id)
->first(['transaction_journals.*']);
if (null !== $liabilityJournal) {
$group = $liabilityJournal->transactionGroup;
$service = new TransactionGroupDestroyService();
$service->destroy($group);
Log::debug(sprintf('Deleted liability credit group #%d', $group->id));
return;
}
Log::debug('No liability credit journal found.');
}
/** /**
* *
*/ */
@ -233,66 +295,4 @@ class UpgradeLiabilitiesEight extends Command
{ {
app('fireflyconfig')->set(self::CONFIG_NAME, true); app('fireflyconfig')->set(self::CONFIG_NAME, true);
} }
/**
* @param Account $account
* @return bool
*/
private function hasBadOpening(Account $account): bool
{
$openingBalanceType = TransactionType::whereType(TransactionType::OPENING_BALANCE)->first();
$liabilityType = TransactionType::whereType(TransactionType::LIABILITY_CREDIT)->first();
$openingJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->where('transactions.account_id', $account->id)
->where('transaction_journals.transaction_type_id', $openingBalanceType->id)
->first(['transaction_journals.*']);
if (null === $openingJournal) {
Log::debug('Account has no opening balance and can be skipped.');
return false;
}
$liabilityJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->where('transactions.account_id', $account->id)
->where('transaction_journals.transaction_type_id', $liabilityType->id)
->first(['transaction_journals.*']);
if (null === $liabilityJournal) {
Log::debug('Account has no liability credit and can be skipped.');
return false;
}
if (!$openingJournal->date->isSameDay($liabilityJournal->date)) {
Log::debug('Account has opening/credit not on the same day.');
return false;
}
Log::debug('Account has bad opening balance data.');
return true;
}
/**
* @param Account $account
* @return void
*/
private function reverseOpeningBalance(Account $account): void
{
$openingBalanceType = TransactionType::whereType(TransactionType::OPENING_BALANCE)->first();
/** @var TransactionJournal $openingJournal */
$openingJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->where('transactions.account_id', $account->id)
->where('transaction_journals.transaction_type_id', $openingBalanceType->id)
->first(['transaction_journals.*']);
/** @var Transaction|null $source */
$source = $openingJournal->transactions()->where('amount', '<', 0)->first();
/** @var Transaction|null $dest */
$dest = $openingJournal->transactions()->where('amount', '>', 0)->first();
if ($source && $dest) {
$sourceId = $source->account_id;
$destId = $dest->account_id;
$dest->account_id = $sourceId;
$source->account_id = $destId;
$source->save();
$dest->save();
Log::debug(sprintf('Opening balance transaction journal #%d reversed.', $openingJournal->id));
return;
}
Log::warning('Did not find opening balance.');
}
} }

View File

@ -253,6 +253,8 @@ class AccountFactory
* @param array $data * @param array $data
* *
* @return array * @return array
* @throws FireflyException
* @throws JsonException
*/ */
private function cleanMetaDataArray(Account $account, array $data): array private function cleanMetaDataArray(Account $account, array $data): array
{ {

View File

@ -30,6 +30,7 @@ use FireflyIII\Services\Internal\Support\RecurringTransactionTrait;
use FireflyIII\Services\Internal\Support\TransactionTypeTrait; use FireflyIII\Services\Internal\Support\TransactionTypeTrait;
use FireflyIII\User; use FireflyIII\User;
use Illuminate\Support\MessageBag; use Illuminate\Support\MessageBag;
use JsonException;
use Log; use Log;
/** /**
@ -58,6 +59,7 @@ class RecurrenceFactory
* *
* @return Recurrence * @return Recurrence
* @throws FireflyException * @throws FireflyException
* @throws JsonException
*/ */
public function create(array $data): Recurrence public function create(array $data): Recurrence
{ {

View File

@ -42,11 +42,11 @@ use Validator;
class TransactionFactory class TransactionFactory
{ {
private Account $account; private Account $account;
private array $accountInformation;
private TransactionCurrency $currency; private TransactionCurrency $currency;
private ?TransactionCurrency $foreignCurrency; private ?TransactionCurrency $foreignCurrency;
private TransactionJournal $journal; private TransactionJournal $journal;
private bool $reconciled; private bool $reconciled;
private array $accountInformation;
/** /**
* Constructor. * Constructor.
@ -140,6 +140,38 @@ class TransactionFactory
return $result; return $result;
} }
/**
* @return void
* @throws FireflyException
*/
private function updateAccountInformation(): void
{
if (!array_key_exists('iban', $this->accountInformation)) {
Log::debug('No IBAN information in array, will not update.');
return;
}
if ('' !== (string)$this->account->iban) {
Log::debug('Account already has IBAN information, will not update.');
return;
}
if ($this->account->iban === $this->accountInformation['iban']) {
Log::debug('Account already has this IBAN, will not update.');
return;
}
// validate info:
$validator = Validator::make(['iban' => $this->accountInformation['iban']], [
'iban' => ['required', new UniqueIban($this->account, $this->account->accountType->type)],
]);
if ($validator->fails()) {
Log::debug('Invalid or non-unique IBAN, will not update.');
return;
}
Log::debug('Will update account with IBAN information.');
$service = app(AccountUpdateService::class);
$service->update($this->account, ['iban' => $this->accountInformation['iban']]);
}
/** /**
* Create transaction with positive amount (for destination accounts). * Create transaction with positive amount (for destination accounts).
* *
@ -171,6 +203,14 @@ class TransactionFactory
$this->account = $account; $this->account = $account;
} }
/**
* @param array $accountInformation
*/
public function setAccountInformation(array $accountInformation): void
{
$this->accountInformation = $accountInformation;
}
/** /**
* @param TransactionCurrency $currency * @param TransactionCurrency $currency
* *
@ -220,45 +260,4 @@ class TransactionFactory
{ {
// empty function. // empty function.
} }
/**
* @param array $accountInformation
*/
public function setAccountInformation(array $accountInformation): void
{
$this->accountInformation = $accountInformation;
}
/**
* @return void
* @throws FireflyException
*/
private function updateAccountInformation(): void
{
if (!array_key_exists('iban', $this->accountInformation)) {
Log::debug('No IBAN information in array, will not update.');
return;
}
if ('' !== (string)$this->account->iban) {
Log::debug('Account already has IBAN information, will not update.');
return;
}
if ($this->account->iban === $this->accountInformation['iban']) {
Log::debug('Account already has this IBAN, will not update.');
return;
}
// validate info:
$validator = Validator::make(['iban' => $this->accountInformation['iban']], [
'iban' => ['required', new UniqueIban($this->account, $this->account->accountType->type)],
]);
if ($validator->fails()) {
Log::debug('Invalid or non-unique IBAN, will not update.');
return;
}
Log::debug('Will update account with IBAN information.');
$service = app(AccountUpdateService::class);
$service->update($this->account, ['iban' => $this->accountInformation['iban']]);
}
} }

View File

@ -73,7 +73,6 @@ class TransactionJournalFactory
* Constructor. * Constructor.
* *
* @throws Exception * @throws Exception
*/ */
public function __construct() public function __construct()
{ {
@ -450,6 +449,8 @@ class TransactionJournalFactory
* @param Account $destination * @param Account $destination
* *
* @return TransactionCurrency * @return TransactionCurrency
* @throws FireflyException
* @throws JsonException
*/ */
private function getCurrencyByAccount(string $type, ?TransactionCurrency $currency, Account $source, Account $destination): TransactionCurrency private function getCurrencyByAccount(string $type, ?TransactionCurrency $currency, Account $source, Account $destination): TransactionCurrency
{ {
@ -510,6 +511,8 @@ class TransactionJournalFactory
* @param Account $destination * @param Account $destination
* *
* @return TransactionCurrency|null * @return TransactionCurrency|null
* @throws FireflyException
* @throws JsonException
*/ */
private function getForeignByAccount(string $type, ?TransactionCurrency $foreignCurrency, Account $destination): ?TransactionCurrency private function getForeignByAccount(string $type, ?TransactionCurrency $foreignCurrency, Account $destination): ?TransactionCurrency
{ {

Some files were not shown because too many files have changed in this diff Show More