Skip to content

Firefly III: a personal finances manager

Clean up some code.

James Colee4802ec9581e
diff --git a/app/Api/V1/Controllers/Autocomplete/ObjectGroupController.php b/app/Api/V1/Controllers/Autocomplete/ObjectGroupController.php
index 3181f350c0..00342d21a4 100644
--- a/app/Api/V1/Controllers/Autocomplete/ObjectGroupController.php
+++ b/app/Api/V1/Controllers/Autocomplete/ObjectGroupController.php
@@ -66,7 +66,7 @@ class ObjectGroupController extends Controller
$return = [];
$result = $this->repository->search($data['query'], $data['limit']);
- /** @var ObjectGroup $account */
+ /** @var ObjectGroup $objectGroup */
foreach ($result as $objectGroup) {
$return[] = [
'id' => (string)$objectGroup->id,
diff --git a/app/Api/V1/Controllers/Data/Export/ExportController.php b/app/Api/V1/Controllers/Data/Export/ExportController.php
index fa5a8583c5..a84a9efa27 100644
--- a/app/Api/V1/Controllers/Data/Export/ExportController.php
+++ b/app/Api/V1/Controllers/Data/Export/ExportController.php
@@ -25,7 +25,6 @@ namespace FireflyIII\Api\V1\Controllers\Data\Export;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Data\Export\ExportRequest;
use FireflyIII\Support\Export\ExportDataGenerator;
-use FireflyIII\User;
use Illuminate\Http\Response as LaravelResponse;
use League\Csv\CannotInsertRecord;
@@ -44,11 +43,8 @@ class ExportController extends Controller
parent::__construct();
$this->middleware(
function ($request, $next) {
- /** @var User $user */
- $user = auth()->user();
- /** @var ExportDataGenerator $exporter */
$this->exporter = app(ExportDataGenerator::class);
- $this->exporter->setUser($user);
+ $this->exporter->setUser(auth()->user());
return $next($request);
}
@@ -92,7 +88,7 @@ class ExportController extends Controller
->header('Expires', '0')
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
->header('Pragma', 'public')
- ->header('Content-Length', strlen($data[$key]));
+ ->header('Content-Length', (string)strlen($data[$key]));
return $response;
}
diff --git a/app/Api/V1/Controllers/Insight/Expense/TagController.php b/app/Api/V1/Controllers/Insight/Expense/TagController.php
index 7feb8f9d48..bdbeeb8f23 100644
--- a/app/Api/V1/Controllers/Insight/Expense/TagController.php
+++ b/app/Api/V1/Controllers/Insight/Expense/TagController.php
@@ -44,9 +44,8 @@ class TagController extends Controller
parent::__construct();
$this->middleware(
function ($request, $next) {
- $user = auth()->user();
$this->repository = app(TagRepositoryInterface::class);
- $this->repository->setUser($user);
+ $this->repository->setUser(auth()->user());
return $next($request);
}
@@ -128,7 +127,7 @@ class TagController extends Controller
$collector->setTypes([TransactionType::WITHDRAWAL])->setRange($start, $end)->setSourceAccounts($accounts);
$collector->setTags($tags);
$genericSet = $collector->getExtractedJournals();
- /** @var array $entry */
+ /** @var array $journal */
foreach ($genericSet as $journal) {
$currencyId = (int)$journal['currency_id'];
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
diff --git a/app/Api/V1/Controllers/Insight/Income/TagController.php b/app/Api/V1/Controllers/Insight/Income/TagController.php
index 5549fe8725..6b3714f7ac 100644
--- a/app/Api/V1/Controllers/Insight/Income/TagController.php
+++ b/app/Api/V1/Controllers/Insight/Income/TagController.php
@@ -130,7 +130,7 @@ class TagController extends Controller
$collector->setTypes([TransactionType::DEPOSIT])->setRange($start, $end)->setDestinationAccounts($accounts);
$collector->setTags($tags);
$genericSet = $collector->getExtractedJournals();
- /** @var array $entry */
+ /** @var array $journal */
foreach ($genericSet as $journal) {
$currencyId = (int)$journal['currency_id'];
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
diff --git a/app/Api/V1/Controllers/Insight/Transfer/TagController.php b/app/Api/V1/Controllers/Insight/Transfer/TagController.php
index cfadadd10b..6a9f765d8b 100644
--- a/app/Api/V1/Controllers/Insight/Transfer/TagController.php
+++ b/app/Api/V1/Controllers/Insight/Transfer/TagController.php
@@ -132,7 +132,7 @@ class TagController extends Controller
$collector->setTypes([TransactionType::TRANSFER])->setRange($start, $end)->setDestinationAccounts($accounts);
$collector->setTags($tags);
$genericSet = $collector->getExtractedJournals();
- /** @var array $entry */
+ /** @var array $journal */
foreach ($genericSet as $journal) {
$currencyId = (int)$journal['currency_id'];
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
diff --git a/app/Api/V1/Controllers/Models/Attachment/ShowController.php b/app/Api/V1/Controllers/Models/Attachment/ShowController.php
index 574db4add7..879b5460e2 100644
--- a/app/Api/V1/Controllers/Models/Attachment/ShowController.php
+++ b/app/Api/V1/Controllers/Models/Attachment/ShowController.php
@@ -100,7 +100,7 @@ class ShowController extends Controller
->header('Expires', '0')
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
->header('Pragma', 'public')
- ->header('Content-Length', strlen($content));
+ ->header('Content-Length', (string)strlen($content));
return $response;
}
diff --git a/app/Api/V1/Controllers/Models/Bill/DestroyController.php b/app/Api/V1/Controllers/Models/Bill/DestroyController.php
index 06d40de10f..7e5c0ac4d8 100644
--- a/app/Api/V1/Controllers/Models/Bill/DestroyController.php
+++ b/app/Api/V1/Controllers/Models/Bill/DestroyController.php
@@ -46,12 +46,8 @@ class DestroyController extends Controller
parent::__construct();
$this->middleware(
function ($request, $next) {
- /** @var User $admin */
- $admin = auth()->user();
-
- /** @var BillRepositoryInterface repository */
$this->repository = app(BillRepositoryInterface::class);
- $this->repository->setUser($admin);
+ $this->repository->setUser(auth()->user());
return $next($request);
}
diff --git a/app/Api/V1/Controllers/Models/Bill/ListController.php b/app/Api/V1/Controllers/Models/Bill/ListController.php
index ac8aa382c1..691b4bda8e 100644
--- a/app/Api/V1/Controllers/Models/Bill/ListController.php
+++ b/app/Api/V1/Controllers/Models/Bill/ListController.php
@@ -57,12 +57,8 @@ class ListController extends Controller
parent::__construct();
$this->middleware(
function ($request, $next) {
- /** @var User $admin */
- $admin = auth()->user();
-
- /** @var BillRepositoryInterface repository */
$this->repository = app(BillRepositoryInterface::class);
- $this->repository->setUser($admin);
+ $this->repository->setUser(auth()->user());
return $next($request);
}
diff --git a/app/Api/V1/Controllers/Models/Bill/ShowController.php b/app/Api/V1/Controllers/Models/Bill/ShowController.php
index 8ba46997b4..3e43b29ef2 100644
--- a/app/Api/V1/Controllers/Models/Bill/ShowController.php
+++ b/app/Api/V1/Controllers/Models/Bill/ShowController.php
@@ -51,12 +51,8 @@ class ShowController extends Controller
parent::__construct();
$this->middleware(
function ($request, $next) {
- /** @var User $admin */
- $admin = auth()->user();
-
- /** @var BillRepositoryInterface repository */
$this->repository = app(BillRepositoryInterface::class);
- $this->repository->setUser($admin);
+ $this->repository->setUser(auth()->user());
return $next($request);
}
diff --git a/app/Api/V1/Controllers/Models/Bill/StoreController.php b/app/Api/V1/Controllers/Models/Bill/StoreController.php
index bffec9a225..5ef3bc4bb5 100644
--- a/app/Api/V1/Controllers/Models/Bill/StoreController.php
+++ b/app/Api/V1/Controllers/Models/Bill/StoreController.php
@@ -52,12 +52,8 @@ class StoreController extends Controller
parent::__construct();
$this->middleware(
function ($request, $next) {
- /** @var User $admin */
- $admin = auth()->user();
-
- /** @var BillRepositoryInterface repository */
$this->repository = app(BillRepositoryInterface::class);
- $this->repository->setUser($admin);
+ $this->repository->setUser(auth()->user());
return $next($request);
}
diff --git a/app/Api/V1/Controllers/Models/Bill/UpdateController.php b/app/Api/V1/Controllers/Models/Bill/UpdateController.php
index cbdc6a69fd..2240463648 100644
--- a/app/Api/V1/Controllers/Models/Bill/UpdateController.php
+++ b/app/Api/V1/Controllers/Models/Bill/UpdateController.php
@@ -49,12 +49,8 @@ class UpdateController extends Controller
parent::__construct();
$this->middleware(
function ($request, $next) {
- /** @var User $admin */
- $admin = auth()->user();
-
- /** @var BillRepositoryInterface repository */
$this->repository = app(BillRepositoryInterface::class);
- $this->repository->setUser($admin);
+ $this->repository->setUser(auth()->user());
return $next($request);
}
diff --git a/app/Api/V1/Controllers/Models/Category/DestroyController.php b/app/Api/V1/Controllers/Models/Category/DestroyController.php
index 62e74982fd..4e609fdb5e 100644
--- a/app/Api/V1/Controllers/Models/Category/DestroyController.php
+++ b/app/Api/V1/Controllers/Models/Category/DestroyController.php
@@ -46,12 +46,8 @@ class DestroyController extends Controller
parent::__construct();
$this->middleware(
function ($request, $next) {
- /** @var User $admin */
- $admin = auth()->user();
-
- /** @var CategoryRepositoryInterface repository */
$this->repository = app(CategoryRepositoryInterface::class);
- $this->repository->setUser($admin);
+ $this->repository->setUser(auth()->user());
return $next($request);
}
diff --git a/app/Api/V1/Controllers/Models/Category/ListController.php b/app/Api/V1/Controllers/Models/Category/ListController.php
index bee9f4453e..019b9e875f 100644
--- a/app/Api/V1/Controllers/Models/Category/ListController.php
+++ b/app/Api/V1/Controllers/Models/Category/ListController.php
@@ -56,12 +56,8 @@ class ListController extends Controller
parent::__construct();
$this->middleware(
function ($request, $next) {
- /** @var User $admin */
- $admin = auth()->user();
-
- /** @var CategoryRepositoryInterface repository */
$this->repository = app(CategoryRepositoryInterface::class);
- $this->repository->setUser($admin);
+ $this->repository->setUser(auth()->user());
return $next($request);
}
diff --git a/app/Api/V1/Controllers/Models/Category/ShowController.php b/app/Api/V1/Controllers/Models/Category/ShowController.php
index e7d30a53b3..3525791328 100644
--- a/app/Api/V1/Controllers/Models/Category/ShowController.php
+++ b/app/Api/V1/Controllers/Models/Category/ShowController.php
@@ -51,12 +51,8 @@ class ShowController extends Controller
parent::__construct();
$this->middleware(
function ($request, $next) {
- /** @var User $admin */
- $admin = auth()->user();
-
- /** @var CategoryRepositoryInterface repository */
$this->repository = app(CategoryRepositoryInterface::class);
- $this->repository->setUser($admin);
+ $this->repository->setUser(auth()->user());
return $next($request);
}
diff --git a/app/Api/V1/Controllers/Models/Category/StoreController.php b/app/Api/V1/Controllers/Models/Category/StoreController.php
index d733697364..c799d9eee7 100644
--- a/app/Api/V1/Controllers/Models/Category/StoreController.php
+++ b/app/Api/V1/Controllers/Models/Category/StoreController.php
@@ -49,12 +49,8 @@ class StoreController extends Controller
parent::__construct();
$this->middleware(
function ($request, $next) {
- /** @var User $admin */
- $admin = auth()->user();
-
- /** @var CategoryRepositoryInterface repository */
$this->repository = app(CategoryRepositoryInterface::class);
- $this->repository->setUser($admin);
+ $this->repository->setUser(auth()->user());
return $next($request);
}
diff --git a/app/Api/V1/Controllers/Models/Category/UpdateController.php b/app/Api/V1/Controllers/Models/Category/UpdateController.php
index f05625dcdc..bcab8b0778 100644
--- a/app/Api/V1/Controllers/Models/Category/UpdateController.php
+++ b/app/Api/V1/Controllers/Models/Category/UpdateController.php
@@ -49,12 +49,8 @@ class UpdateController extends Controller
parent::__construct();
$this->middleware(
function ($request, $next) {
- /** @var User $admin */
- $admin = auth()->user();
-
- /** @var CategoryRepositoryInterface repository */
$this->repository = app(CategoryRepositoryInterface::class);
- $this->repository->setUser($admin);
+ $this->repository->setUser(auth()->user());
return $next($request);
}
diff --git a/app/Api/V1/Controllers/Models/Recurrence/DestroyController.php b/app/Api/V1/Controllers/Models/Recurrence/DestroyController.php
index 7e63348ec5..6c44dd1e60 100644
--- a/app/Api/V1/Controllers/Models/Recurrence/DestroyController.php
+++ b/app/Api/V1/Controllers/Models/Recurrence/DestroyController.php
@@ -46,12 +46,8 @@ class DestroyController extends Controller
parent::__construct();
$this->middleware(
function ($request, $next) {
- /** @var User $user */
- $user = auth()->user();
-
- /** @var RecurringRepositoryInterface repository */
$this->repository = app(RecurringRepositoryInterface::class);
- $this->repository->setUser($user);
+ $this->repository->setUser(auth()->user());
return $next($request);
}
diff --git a/app/Api/V1/Controllers/Models/Recurrence/ListController.php b/app/Api/V1/Controllers/Models/Recurrence/ListController.php
index a493df5377..1b989425c0 100644
--- a/app/Api/V1/Controllers/Models/Recurrence/ListController.php
+++ b/app/Api/V1/Controllers/Models/Recurrence/ListController.php
@@ -54,12 +54,8 @@ class ListController extends Controller
parent::__construct();
$this->middleware(
function ($request, $next) {
- /** @var User $user */
- $user = auth()->user();
-
- /** @var RecurringRepositoryInterface repository */
$this->repository = app(RecurringRepositoryInterface::class);
- $this->repository->setUser($user);
+ $this->repository->setUser(auth()->user());
return $next($request);
}
diff --git a/app/Api/V1/Controllers/Models/Recurrence/ShowController.php b/app/Api/V1/Controllers/Models/Recurrence/ShowController.php
index bfa6bbcd58..d8e70cbea0 100644
--- a/app/Api/V1/Controllers/Models/Recurrence/ShowController.php
+++ b/app/Api/V1/Controllers/Models/Recurrence/ShowController.php
@@ -51,12 +51,8 @@ class ShowController extends Controller
parent::__construct();
$this->middleware(
function ($request, $next) {
- /** @var User $user */
- $user = auth()->user();
-
- /** @var RecurringRepositoryInterface repository */
$this->repository = app(RecurringRepositoryInterface::class);
- $this->repository->setUser($user);
+ $this->repository->setUser(auth()->user());
return $next($request);
}
diff --git a/app/Api/V1/Controllers/Models/Recurrence/StoreController.php b/app/Api/V1/Controllers/Models/Recurrence/StoreController.php
index 8b0a7c2275..2c53478ec3 100644
--- a/app/Api/V1/Controllers/Models/Recurrence/StoreController.php
+++ b/app/Api/V1/Controllers/Models/Recurrence/StoreController.php
@@ -49,12 +49,8 @@ class StoreController extends Controller
parent::__construct();
$this->middleware(
function ($request, $next) {
- /** @var User $user */
- $user = auth()->user();
-
- /** @var RecurringRepositoryInterface repository */
$this->repository = app(RecurringRepositoryInterface::class);
- $this->repository->setUser($user);
+ $this->repository->setUser(auth()->user());
return $next($request);
}
diff --git a/app/Api/V1/Controllers/Models/Recurrence/TriggerController.php b/app/Api/V1/Controllers/Models/Recurrence/TriggerController.php
deleted file mode 100644
index 0848c80b19..0000000000
--- a/app/Api/V1/Controllers/Models/Recurrence/TriggerController.php
+++ /dev/null
@@ -1,86 +0,0 @@
-<?php
-/*
- * TriggerController.php
- * Copyright (c) 2021 [email protected]
- *
- * This file is part of Firefly III (https://github.com/firefly-iii).
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-
-declare(strict_types=1);
-
-namespace FireflyIII\Api\V1\Controllers\Models\Recurrence;
-
-use FireflyIII\Api\V1\Controllers\Controller;
-use FireflyIII\Exceptions\FireflyException;
-use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface;
-use FireflyIII\Support\Cronjobs\RecurringCronjob;
-use FireflyIII\User;
-use Illuminate\Http\JsonResponse;
-use Log;
-
-/**
- * Class TriggerController
- */
-class TriggerController extends Controller
-{
- private RecurringRepositoryInterface $repository;
-
- /**
- * RecurrenceController constructor.
- *
- * @codeCoverageIgnore
- */
- public function __construct()
- {
- parent::__construct();
- $this->middleware(
- function ($request, $next) {
- /** @var User $user */
- $user = auth()->user();
-
- /** @var RecurringRepositoryInterface repository */
- $this->repository = app(RecurringRepositoryInterface::class);
- $this->repository->setUser($user);
-
- return $next($request);
- }
- );
- }
-
- /**
- * @return JsonResponse
- * @throws FireflyException
- * @codeCoverageIgnore
- *
- * TODO currently unused + unreachable.
- */
- public function trigger(): JsonResponse
- {
- /** @var RecurringCronjob $recurring */
- $recurring = app(RecurringCronjob::class);
- try {
- $result = $recurring->fire();
- } catch (FireflyException $e) {
- Log::error($e->getMessage());
- throw new FireflyException('200022: Error in cron job.', 0, $e);
- }
- if (false === $result) {
- return response()->json([], 204);
- }
-
- return response()->json();
- }
-}
diff --git a/app/Api/V1/Controllers/Models/Recurrence/UpdateController.php b/app/Api/V1/Controllers/Models/Recurrence/UpdateController.php
index 7d4c4646bb..2f15eb071f 100644
--- a/app/Api/V1/Controllers/Models/Recurrence/UpdateController.php
+++ b/app/Api/V1/Controllers/Models/Recurrence/UpdateController.php
@@ -49,12 +49,8 @@ class UpdateController extends Controller
parent::__construct();
$this->middleware(
function ($request, $next) {
- /** @var User $user */
- $user = auth()->user();
-
- /** @var RecurringRepositoryInterface repository */
$this->repository = app(RecurringRepositoryInterface::class);
- $this->repository->setUser($user);
+ $this->repository->setUser(auth()->user());
return $next($request);
}
diff --git a/app/Api/V1/Controllers/Models/RuleGroup/TriggerController.php b/app/Api/V1/Controllers/Models/RuleGroup/TriggerController.php
index fd79c5d4ed..963c0490ef 100644
--- a/app/Api/V1/Controllers/Models/RuleGroup/TriggerController.php
+++ b/app/Api/V1/Controllers/Models/RuleGroup/TriggerController.php
@@ -37,6 +37,7 @@ use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
use League\Fractal\Resource\Collection as FractalCollection;
+use Exception;
/**
* Class TriggerController
diff --git a/app/Api/V1/Requests/Data/Bulk/MoveTransactionsRequest.php b/app/Api/V1/Requests/Data/Bulk/MoveTransactionsRequest.php
index 09be9967b5..0f034d6467 100644
--- a/app/Api/V1/Requests/Data/Bulk/MoveTransactionsRequest.php
+++ b/app/Api/V1/Requests/Data/Bulk/MoveTransactionsRequest.php
@@ -61,7 +61,7 @@ class MoveTransactionsRequest extends FormRequest
* Configure the validator instance with special rules for after the basic validation rules.
*
* @param Validator $validator
- * TODO duplicate code.
+ * TODO duplicate code.
*
* @return void
*/
diff --git a/app/Api/V1/Requests/Models/Account/StoreRequest.php b/app/Api/V1/Requests/Models/Account/StoreRequest.php
index c73a2f0b9b..288bb97080 100644
--- a/app/Api/V1/Requests/Models/Account/StoreRequest.php
+++ b/app/Api/V1/Requests/Models/Account/StoreRequest.php
@@ -80,10 +80,10 @@ class StoreRequest extends FormRequest
// append Location information.
$data = $this->appendLocationData($data, null);
- if ('liability' === $data['account_type'] || 'liabilities' === $data['account_type']) {
+ if ('liability' === $data['account_type_name'] || 'liabilities' === $data['account_type_name']) {
$data['opening_balance'] = bcmul($this->string('liability_amount'), '-1');
$data['opening_balance_date'] = $this->date('liability_start_date');
- $data['account_type'] = $this->string('liability_type');
+ $data['account_type_name'] = $this->string('liability_type');
$data['account_type_id'] = null;
}
diff --git a/app/Api/V1/Requests/Models/Account/UpdateRequest.php b/app/Api/V1/Requests/Models/Account/UpdateRequest.php
index c1c484f5f8..50218be353 100644
--- a/app/Api/V1/Requests/Models/Account/UpdateRequest.php
+++ b/app/Api/V1/Requests/Models/Account/UpdateRequest.php
@@ -51,7 +51,7 @@ class UpdateRequest extends FormRequest
'name' => ['name', 'string'],
'active' => ['active', 'boolean'],
'include_net_worth' => ['include_net_worth', 'boolean'],
- 'account_type' => ['type', 'string'],
+ 'account_type_name' => ['type', 'string'],
'virtual_balance' => ['virtual_balance', 'string'],
'iban' => ['iban', 'string'],
'BIC' => ['bic', 'string'],
@@ -72,10 +72,10 @@ class UpdateRequest extends FormRequest
$data = $this->getAllData($fields);
$data = $this->appendLocationData($data, null);
- if (array_key_exists('account_type', $data) && 'liability' === $data['account_type']) {
+ if (array_key_exists('account_type_name', $data) && 'liability' === $data['account_type_name']) {
$data['opening_balance'] = bcmul($this->nullableString('liability_amount'), '-1');
$data['opening_balance_date'] = $this->date('liability_start_date');
- $data['account_type'] = $this->nullableString('liability_type');
+ $data['account_type_name'] = $this->nullableString('liability_type');
$data['account_type_id'] = null;
}
diff --git a/app/Factory/AccountFactory.php b/app/Factory/AccountFactory.php
index f7c8aa2b55..4bf7e8cfe6 100644
--- a/app/Factory/AccountFactory.php
+++ b/app/Factory/AccountFactory.php
@@ -85,13 +85,13 @@ class AccountFactory
Log::debug('Found nothing. Will create a new one.');
$return = $this->create(
[
- 'user_id' => $this->user->id,
- 'name' => $accountName,
- 'account_type_id' => $type->id,
- 'account_type' => null,
- 'virtual_balance' => '0',
- 'iban' => null,
- 'active' => true,
+ 'user_id' => $this->user->id,
+ 'name' => $accountName,
+ 'account_type_id' => $type->id,
+ 'account_type_name' => null,
+ 'virtual_balance' => '0',
+ 'iban' => null,
+ 'active' => true,
]
);
}
diff --git a/app/Models/Preference.php b/app/Models/Preference.php
index 4dc348ea22..f473853d77 100644
--- a/app/Models/Preference.php
+++ b/app/Models/Preference.php
@@ -38,7 +38,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property \Illuminate\Support\Carbon|null $updated_at
* @property int $user_id
* @property string $name
- * @property array|null $data
+ * @property int|string|array|null $data
* @property-read User $user
* @method static Builder|Preference newModelQuery()
* @method static Builder|Preference newQuery()
diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php
index 2b17a7029e..2720e9afa1 100644
--- a/app/Repositories/Account/AccountRepository.php
+++ b/app/Repositories/Account/AccountRepository.php
@@ -504,12 +504,12 @@ class AccountRepository implements AccountRepositoryInterface
}
$data = [
- 'account_type_id' => null,
- 'account_type' => AccountType::RECONCILIATION,
- 'active' => true,
- 'name' => $name,
- 'currency_id' => $currency->id,
- 'currency_code' => $currency->code,
+ 'account_type_id' => null,
+ 'account_type_name' => AccountType::RECONCILIATION,
+ 'active' => true,
+ 'name' => $name,
+ 'currency_id' => $currency->id,
+ 'currency_code' => $currency->code,
];
/** @var AccountFactory $factory */
diff --git a/app/Repositories/ObjectGroup/ObjectGroupRepository.php b/app/Repositories/ObjectGroup/ObjectGroupRepository.php
index 75c00e1ac2..c6098a7ccc 100644
--- a/app/Repositories/ObjectGroup/ObjectGroupRepository.php
+++ b/app/Repositories/ObjectGroup/ObjectGroupRepository.php
@@ -180,6 +180,14 @@ class ObjectGroupRepository implements ObjectGroupRepositoryInterface
return $objectGroup;
}
+ /**
+ * @param User $user
+ */
+ public function setUser(User $user): void
+ {
+ $this->user = $user;
+ }
+
/**
* @inheritDoc
*/
@@ -197,12 +205,4 @@ class ObjectGroupRepository implements ObjectGroupRepositoryInterface
return $objectGroup;
}
-
- /**
- * @param User $user
- */
- public function setUser(User $user): void
- {
- $this->user = $user;
- }
}
diff --git a/app/Repositories/ObjectGroup/ObjectGroupRepositoryInterface.php b/app/Repositories/ObjectGroup/ObjectGroupRepositoryInterface.php
index fce3a6bb68..c22ff21833 100644
--- a/app/Repositories/ObjectGroup/ObjectGroupRepositoryInterface.php
+++ b/app/Repositories/ObjectGroup/ObjectGroupRepositoryInterface.php
@@ -25,6 +25,7 @@ declare(strict_types=1);
namespace FireflyIII\Repositories\ObjectGroup;
use FireflyIII\Models\ObjectGroup;
+use FireflyIII\User;
use Illuminate\Support\Collection;
/**
@@ -87,6 +88,11 @@ interface ObjectGroupRepositoryInterface
*/
public function setOrder(ObjectGroup $objectGroup, int $newOrder): ObjectGroup;
+ /**
+ * @param User $user
+ */
+ public function setUser(User $user): void;
+
/**
* @param ObjectGroup $objectGroup
* @param array $data
diff --git a/app/Services/Internal/Support/JournalServiceTrait.php b/app/Services/Internal/Support/JournalServiceTrait.php
index a5dfbe4eea..562ef03203 100644
--- a/app/Services/Internal/Support/JournalServiceTrait.php
+++ b/app/Services/Internal/Support/JournalServiceTrait.php
@@ -197,14 +197,14 @@ trait JournalServiceTrait
$account = $this->accountRepository->store(
[
- 'account_type_id' => null,
- 'account_type' => $preferredType,
- 'name' => $data['name'],
- 'virtual_balance' => null,
- 'active' => true,
- 'iban' => $data['iban'],
- 'currency_id' => $data['currency_id'] ?? null,
- 'order' => $this->accountRepository->maxOrder($preferredType),
+ 'account_type_id' => null,
+ 'account_type_name' => $preferredType,
+ 'name' => $data['name'],
+ 'virtual_balance' => null,
+ 'active' => true,
+ 'iban' => $data['iban'],
+ 'currency_id' => $data['currency_id'] ?? null,
+ 'order' => $this->accountRepository->maxOrder($preferredType),
]
);
// store BIC
diff --git a/app/Support/Http/Controllers/CreateStuff.php b/app/Support/Http/Controllers/CreateStuff.php
index 892218c9a0..cdd2a82947 100644
--- a/app/Support/Http/Controllers/CreateStuff.php
+++ b/app/Support/Http/Controllers/CreateStuff.php
@@ -32,6 +32,7 @@ use Laravel\Passport\Passport;
use Log;
use phpseclib\Crypt\RSA as LegacyRSA;
use phpseclib3\Crypt\RSA;
+
/**
* Trait CreateStuff
*
@@ -54,7 +55,7 @@ trait CreateStuff
$assetAccount = [
'name' => $request->get('bank_name'),
'iban' => null,
- 'account_type' => 'asset',
+ 'account_type_name' => 'asset',
'virtual_balance' => 0,
'account_type_id' => null,
'active' => true,
@@ -84,7 +85,7 @@ trait CreateStuff
$assetAccount = [
'name' => (string)trans('firefly.cash_wallet', [], $language),
'iban' => null,
- 'account_type' => 'asset',
+ 'account_type_name' => 'asset',
'virtual_balance' => 0,
'account_type_id' => null,
'active' => true,
@@ -151,7 +152,7 @@ trait CreateStuff
$savingsAccount = [
'name' => (string)trans('firefly.new_savings_account', ['bank_name' => $request->get('bank_name')], $language),
'iban' => null,
- 'account_type' => 'asset',
+ 'account_type_name' => 'asset',
'account_type_id' => null,
'virtual_balance' => 0,
'active' => true,
diff --git a/app/Support/Preferences.php b/app/Support/Preferences.php
index 62bdbdefd7..fb808e7c9e 100644
--- a/app/Support/Preferences.php
+++ b/app/Support/Preferences.php
@@ -143,9 +143,9 @@ class Preferences
}
/**
- * @param User $user
- * @param string $name
- * @param null|string $default
+ * @param User $user
+ * @param string $name
+ * @param null|string|int $default
*
* @return \FireflyIII\Models\Preference|null
*/
diff --git a/sonar-project.properties b/sonar-project.properties
index d1fe945b3a..753ec33d8e 100644
--- a/sonar-project.properties
+++ b/sonar-project.properties
@@ -4,3 +4,4 @@ sonar.sources=app,bootstrap,database,resources/assets,resources/views,routes,tes
sonar.login=2859ca0fb90d8419e211190a8892b3e1721244cb
sonar.sourceEncoding=UTF-8
sonar.php.coverage.reportPaths=storage/build/clover-all.xml
+sonar.host.url=http://172.16.21.6:10005