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
*
* @return JsonResponse
*/
public function transactionTypes(AutocompleteRequest $request): JsonResponse
{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -29,7 +29,6 @@ use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Models\LinkType;
use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\Support\Http\Api\TransactionFilter;
use FireflyIII\Transformers\TransactionGroupTransformer;
use FireflyIII\User;
@ -58,8 +57,8 @@ class ListController extends Controller
$this->middleware(
function ($request, $next) {
/** @var User $user */
$user = auth()->user();
$this->repository = app(LinkTypeRepositoryInterface::class);
$user = auth()->user();
$this->repository = app(LinkTypeRepositoryInterface::class);
$this->repository->setUser($user);
return $next($request);
@ -76,7 +75,6 @@ class ListController extends Controller
*
* @return JsonResponse
* @throws FireflyException
*/
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\Models\LinkType;
use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\Support\Http\Api\TransactionFilter;
use FireflyIII\Transformers\LinkTypeTransformer;
use FireflyIII\User;
@ -58,8 +57,8 @@ class ShowController extends Controller
$this->middleware(
function ($request, $next) {
/** @var User $user */
$user = auth()->user();
$this->repository = app(LinkTypeRepositoryInterface::class);
$user = auth()->user();
$this->repository = app(LinkTypeRepositoryInterface::class);
$this->repository->setUser($user);
return $next($request);
@ -74,7 +73,6 @@ class ShowController extends Controller
*
* @return JsonResponse
* @throws FireflyException
*/
public function index(): JsonResponse
{
@ -110,7 +108,6 @@ class ShowController extends Controller
* @param LinkType $linkType
*
* @return JsonResponse
*/
public function show(LinkType $linkType): JsonResponse
{

View File

@ -360,7 +360,9 @@ class BasicController extends Controller
/** @var NetWorthInterface $netWorthHelper */
$netWorthHelper = app(NetWorthInterface::class);
$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.
$filtered = $allAccounts->filter(

View File

@ -33,7 +33,6 @@ use League\Fractal\Resource\Item;
/**
* Returns basic information about this installation.
*
* Class AboutController.
*/
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
*
* @return JsonResponse
* @throws ContainerExceptionInterface
* @throws FireflyException
* @throws NotFoundExceptionInterface
*/
public function index(): JsonResponse
{
@ -96,7 +98,6 @@ class ConfigurationController extends Controller
* Get all config values.
*
* @return array
* @throws FireflyException
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
@ -136,7 +137,9 @@ class ConfigurationController extends Controller
* @param string $configKey
*
* @return JsonResponse
* @throws ContainerExceptionInterface
* @throws FireflyException
* @throws NotFoundExceptionInterface
*/
public function show(string $configKey): JsonResponse
{
@ -171,7 +174,9 @@ class ConfigurationController extends Controller
* @param string $name
*
* @return JsonResponse
* @throws ContainerExceptionInterface
* @throws FireflyException
* @throws NotFoundExceptionInterface
*/
public function update(UpdateRequest $request, string $name): JsonResponse
{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -50,7 +50,6 @@ class ListController extends Controller
/**
* This endpoint is documented at:
* 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
{

View File

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

View File

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

View File

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

View File

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

View File

@ -30,6 +30,7 @@ use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType;
use Illuminate\Console\Command;
use JsonException;
use Log;
/**
@ -166,6 +167,7 @@ class FixAccountTypes extends Command
* @param Transaction $dest
*
* @throws FireflyException
* @throws JsonException
*/
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 */
$transaction = $collection->first();
/** @var Account|null $account */
$account = $transaction->account;
$account = $transaction->account;
if (null === $account) {
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 */
$transaction = $collection->first();
/** @var Account|null $account */
$account = $transaction->account;
$account = $transaction->account;
if (null === $account) {
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 array $fields
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
private function decryptTable(string $table, array $fields): void
{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -62,7 +62,9 @@ class UpgradeLiabilitiesEight extends Command
* Execute the console command.
*
* @return int
* @throws ContainerExceptionInterface
* @throws FireflyException
* @throws NotFoundExceptionInterface
*/
public function handle(): int
{
@ -83,7 +85,6 @@ class UpgradeLiabilitiesEight extends Command
/**
* @return bool
* @throws FireflyException
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
@ -158,6 +159,90 @@ class UpgradeLiabilitiesEight extends Command
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
* @return int
@ -203,29 +288,6 @@ class UpgradeLiabilitiesEight extends Command
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);
}
/**
* @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
*
* @return array
* @throws FireflyException
* @throws JsonException
*/
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\User;
use Illuminate\Support\MessageBag;
use JsonException;
use Log;
/**
@ -58,6 +59,7 @@ class RecurrenceFactory
*
* @return Recurrence
* @throws FireflyException
* @throws JsonException
*/
public function create(array $data): Recurrence
{

View File

@ -42,11 +42,11 @@ use Validator;
class TransactionFactory
{
private Account $account;
private array $accountInformation;
private TransactionCurrency $currency;
private ?TransactionCurrency $foreignCurrency;
private TransactionJournal $journal;
private bool $reconciled;
private array $accountInformation;
/**
* Constructor.
@ -140,6 +140,38 @@ class TransactionFactory
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).
*
@ -171,6 +203,14 @@ class TransactionFactory
$this->account = $account;
}
/**
* @param array $accountInformation
*/
public function setAccountInformation(array $accountInformation): void
{
$this->accountInformation = $accountInformation;
}
/**
* @param TransactionCurrency $currency
*
@ -220,45 +260,4 @@ class TransactionFactory
{
// 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.
*
* @throws Exception
*/
public function __construct()
{
@ -450,6 +449,8 @@ class TransactionJournalFactory
* @param Account $destination
*
* @return TransactionCurrency
* @throws FireflyException
* @throws JsonException
*/
private function getCurrencyByAccount(string $type, ?TransactionCurrency $currency, Account $source, Account $destination): TransactionCurrency
{
@ -510,6 +511,8 @@ class TransactionJournalFactory
* @param Account $destination
*
* @return TransactionCurrency|null
* @throws FireflyException
* @throws JsonException
*/
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