mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Clean up some code.
This commit is contained in:
parent
6d855e119d
commit
e4802ec958
@ -66,7 +66,7 @@ class ObjectGroupController extends Controller
|
|||||||
$return = [];
|
$return = [];
|
||||||
$result = $this->repository->search($data['query'], $data['limit']);
|
$result = $this->repository->search($data['query'], $data['limit']);
|
||||||
|
|
||||||
/** @var ObjectGroup $account */
|
/** @var ObjectGroup $objectGroup */
|
||||||
foreach ($result as $objectGroup) {
|
foreach ($result as $objectGroup) {
|
||||||
$return[] = [
|
$return[] = [
|
||||||
'id' => (string)$objectGroup->id,
|
'id' => (string)$objectGroup->id,
|
||||||
|
@ -25,7 +25,6 @@ namespace FireflyIII\Api\V1\Controllers\Data\Export;
|
|||||||
use FireflyIII\Api\V1\Controllers\Controller;
|
use FireflyIII\Api\V1\Controllers\Controller;
|
||||||
use FireflyIII\Api\V1\Requests\Data\Export\ExportRequest;
|
use FireflyIII\Api\V1\Requests\Data\Export\ExportRequest;
|
||||||
use FireflyIII\Support\Export\ExportDataGenerator;
|
use FireflyIII\Support\Export\ExportDataGenerator;
|
||||||
use FireflyIII\User;
|
|
||||||
use Illuminate\Http\Response as LaravelResponse;
|
use Illuminate\Http\Response as LaravelResponse;
|
||||||
use League\Csv\CannotInsertRecord;
|
use League\Csv\CannotInsertRecord;
|
||||||
|
|
||||||
@ -44,11 +43,8 @@ class ExportController extends Controller
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->middleware(
|
$this->middleware(
|
||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
/** @var User $user */
|
|
||||||
$user = auth()->user();
|
|
||||||
/** @var ExportDataGenerator $exporter */
|
|
||||||
$this->exporter = app(ExportDataGenerator::class);
|
$this->exporter = app(ExportDataGenerator::class);
|
||||||
$this->exporter->setUser($user);
|
$this->exporter->setUser(auth()->user());
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
@ -92,7 +88,7 @@ class ExportController extends Controller
|
|||||||
->header('Expires', '0')
|
->header('Expires', '0')
|
||||||
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
|
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
|
||||||
->header('Pragma', 'public')
|
->header('Pragma', 'public')
|
||||||
->header('Content-Length', strlen($data[$key]));
|
->header('Content-Length', (string)strlen($data[$key]));
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
@ -44,9 +44,8 @@ class TagController extends Controller
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->middleware(
|
$this->middleware(
|
||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
$user = auth()->user();
|
|
||||||
$this->repository = app(TagRepositoryInterface::class);
|
$this->repository = app(TagRepositoryInterface::class);
|
||||||
$this->repository->setUser($user);
|
$this->repository->setUser(auth()->user());
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
@ -128,7 +127,7 @@ class TagController extends Controller
|
|||||||
$collector->setTypes([TransactionType::WITHDRAWAL])->setRange($start, $end)->setSourceAccounts($accounts);
|
$collector->setTypes([TransactionType::WITHDRAWAL])->setRange($start, $end)->setSourceAccounts($accounts);
|
||||||
$collector->setTags($tags);
|
$collector->setTags($tags);
|
||||||
$genericSet = $collector->getExtractedJournals();
|
$genericSet = $collector->getExtractedJournals();
|
||||||
/** @var array $entry */
|
/** @var array $journal */
|
||||||
foreach ($genericSet as $journal) {
|
foreach ($genericSet as $journal) {
|
||||||
$currencyId = (int)$journal['currency_id'];
|
$currencyId = (int)$journal['currency_id'];
|
||||||
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||||
|
@ -130,7 +130,7 @@ class TagController extends Controller
|
|||||||
$collector->setTypes([TransactionType::DEPOSIT])->setRange($start, $end)->setDestinationAccounts($accounts);
|
$collector->setTypes([TransactionType::DEPOSIT])->setRange($start, $end)->setDestinationAccounts($accounts);
|
||||||
$collector->setTags($tags);
|
$collector->setTags($tags);
|
||||||
$genericSet = $collector->getExtractedJournals();
|
$genericSet = $collector->getExtractedJournals();
|
||||||
/** @var array $entry */
|
/** @var array $journal */
|
||||||
foreach ($genericSet as $journal) {
|
foreach ($genericSet as $journal) {
|
||||||
$currencyId = (int)$journal['currency_id'];
|
$currencyId = (int)$journal['currency_id'];
|
||||||
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||||
|
@ -132,7 +132,7 @@ class TagController extends Controller
|
|||||||
$collector->setTypes([TransactionType::TRANSFER])->setRange($start, $end)->setDestinationAccounts($accounts);
|
$collector->setTypes([TransactionType::TRANSFER])->setRange($start, $end)->setDestinationAccounts($accounts);
|
||||||
$collector->setTags($tags);
|
$collector->setTags($tags);
|
||||||
$genericSet = $collector->getExtractedJournals();
|
$genericSet = $collector->getExtractedJournals();
|
||||||
/** @var array $entry */
|
/** @var array $journal */
|
||||||
foreach ($genericSet as $journal) {
|
foreach ($genericSet as $journal) {
|
||||||
$currencyId = (int)$journal['currency_id'];
|
$currencyId = (int)$journal['currency_id'];
|
||||||
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||||
|
@ -100,7 +100,7 @@ class ShowController extends Controller
|
|||||||
->header('Expires', '0')
|
->header('Expires', '0')
|
||||||
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
|
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
|
||||||
->header('Pragma', 'public')
|
->header('Pragma', 'public')
|
||||||
->header('Content-Length', strlen($content));
|
->header('Content-Length', (string)strlen($content));
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
@ -46,12 +46,8 @@ class DestroyController extends Controller
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->middleware(
|
$this->middleware(
|
||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
/** @var User $admin */
|
|
||||||
$admin = auth()->user();
|
|
||||||
|
|
||||||
/** @var BillRepositoryInterface repository */
|
|
||||||
$this->repository = app(BillRepositoryInterface::class);
|
$this->repository = app(BillRepositoryInterface::class);
|
||||||
$this->repository->setUser($admin);
|
$this->repository->setUser(auth()->user());
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
@ -57,12 +57,8 @@ class ListController extends Controller
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->middleware(
|
$this->middleware(
|
||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
/** @var User $admin */
|
|
||||||
$admin = auth()->user();
|
|
||||||
|
|
||||||
/** @var BillRepositoryInterface repository */
|
|
||||||
$this->repository = app(BillRepositoryInterface::class);
|
$this->repository = app(BillRepositoryInterface::class);
|
||||||
$this->repository->setUser($admin);
|
$this->repository->setUser(auth()->user());
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
@ -51,12 +51,8 @@ class ShowController extends Controller
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->middleware(
|
$this->middleware(
|
||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
/** @var User $admin */
|
|
||||||
$admin = auth()->user();
|
|
||||||
|
|
||||||
/** @var BillRepositoryInterface repository */
|
|
||||||
$this->repository = app(BillRepositoryInterface::class);
|
$this->repository = app(BillRepositoryInterface::class);
|
||||||
$this->repository->setUser($admin);
|
$this->repository->setUser(auth()->user());
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
@ -52,12 +52,8 @@ class StoreController extends Controller
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->middleware(
|
$this->middleware(
|
||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
/** @var User $admin */
|
|
||||||
$admin = auth()->user();
|
|
||||||
|
|
||||||
/** @var BillRepositoryInterface repository */
|
|
||||||
$this->repository = app(BillRepositoryInterface::class);
|
$this->repository = app(BillRepositoryInterface::class);
|
||||||
$this->repository->setUser($admin);
|
$this->repository->setUser(auth()->user());
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
@ -49,12 +49,8 @@ class UpdateController extends Controller
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->middleware(
|
$this->middleware(
|
||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
/** @var User $admin */
|
|
||||||
$admin = auth()->user();
|
|
||||||
|
|
||||||
/** @var BillRepositoryInterface repository */
|
|
||||||
$this->repository = app(BillRepositoryInterface::class);
|
$this->repository = app(BillRepositoryInterface::class);
|
||||||
$this->repository->setUser($admin);
|
$this->repository->setUser(auth()->user());
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
@ -46,12 +46,8 @@ class DestroyController extends Controller
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->middleware(
|
$this->middleware(
|
||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
/** @var User $admin */
|
|
||||||
$admin = auth()->user();
|
|
||||||
|
|
||||||
/** @var CategoryRepositoryInterface repository */
|
|
||||||
$this->repository = app(CategoryRepositoryInterface::class);
|
$this->repository = app(CategoryRepositoryInterface::class);
|
||||||
$this->repository->setUser($admin);
|
$this->repository->setUser(auth()->user());
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
@ -56,12 +56,8 @@ class ListController extends Controller
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->middleware(
|
$this->middleware(
|
||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
/** @var User $admin */
|
|
||||||
$admin = auth()->user();
|
|
||||||
|
|
||||||
/** @var CategoryRepositoryInterface repository */
|
|
||||||
$this->repository = app(CategoryRepositoryInterface::class);
|
$this->repository = app(CategoryRepositoryInterface::class);
|
||||||
$this->repository->setUser($admin);
|
$this->repository->setUser(auth()->user());
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
@ -51,12 +51,8 @@ class ShowController extends Controller
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->middleware(
|
$this->middleware(
|
||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
/** @var User $admin */
|
|
||||||
$admin = auth()->user();
|
|
||||||
|
|
||||||
/** @var CategoryRepositoryInterface repository */
|
|
||||||
$this->repository = app(CategoryRepositoryInterface::class);
|
$this->repository = app(CategoryRepositoryInterface::class);
|
||||||
$this->repository->setUser($admin);
|
$this->repository->setUser(auth()->user());
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
@ -49,12 +49,8 @@ class StoreController extends Controller
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->middleware(
|
$this->middleware(
|
||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
/** @var User $admin */
|
|
||||||
$admin = auth()->user();
|
|
||||||
|
|
||||||
/** @var CategoryRepositoryInterface repository */
|
|
||||||
$this->repository = app(CategoryRepositoryInterface::class);
|
$this->repository = app(CategoryRepositoryInterface::class);
|
||||||
$this->repository->setUser($admin);
|
$this->repository->setUser(auth()->user());
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
@ -49,12 +49,8 @@ class UpdateController extends Controller
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->middleware(
|
$this->middleware(
|
||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
/** @var User $admin */
|
|
||||||
$admin = auth()->user();
|
|
||||||
|
|
||||||
/** @var CategoryRepositoryInterface repository */
|
|
||||||
$this->repository = app(CategoryRepositoryInterface::class);
|
$this->repository = app(CategoryRepositoryInterface::class);
|
||||||
$this->repository->setUser($admin);
|
$this->repository->setUser(auth()->user());
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
@ -46,12 +46,8 @@ class DestroyController extends Controller
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->middleware(
|
$this->middleware(
|
||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
/** @var User $user */
|
|
||||||
$user = auth()->user();
|
|
||||||
|
|
||||||
/** @var RecurringRepositoryInterface repository */
|
|
||||||
$this->repository = app(RecurringRepositoryInterface::class);
|
$this->repository = app(RecurringRepositoryInterface::class);
|
||||||
$this->repository->setUser($user);
|
$this->repository->setUser(auth()->user());
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
@ -54,12 +54,8 @@ class ListController extends Controller
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->middleware(
|
$this->middleware(
|
||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
/** @var User $user */
|
|
||||||
$user = auth()->user();
|
|
||||||
|
|
||||||
/** @var RecurringRepositoryInterface repository */
|
|
||||||
$this->repository = app(RecurringRepositoryInterface::class);
|
$this->repository = app(RecurringRepositoryInterface::class);
|
||||||
$this->repository->setUser($user);
|
$this->repository->setUser(auth()->user());
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
@ -51,12 +51,8 @@ class ShowController extends Controller
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->middleware(
|
$this->middleware(
|
||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
/** @var User $user */
|
|
||||||
$user = auth()->user();
|
|
||||||
|
|
||||||
/** @var RecurringRepositoryInterface repository */
|
|
||||||
$this->repository = app(RecurringRepositoryInterface::class);
|
$this->repository = app(RecurringRepositoryInterface::class);
|
||||||
$this->repository->setUser($user);
|
$this->repository->setUser(auth()->user());
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
@ -49,12 +49,8 @@ class StoreController extends Controller
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->middleware(
|
$this->middleware(
|
||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
/** @var User $user */
|
|
||||||
$user = auth()->user();
|
|
||||||
|
|
||||||
/** @var RecurringRepositoryInterface repository */
|
|
||||||
$this->repository = app(RecurringRepositoryInterface::class);
|
$this->repository = app(RecurringRepositoryInterface::class);
|
||||||
$this->repository->setUser($user);
|
$this->repository->setUser(auth()->user());
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
@ -1,86 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* TriggerController.php
|
|
||||||
* Copyright (c) 2021 james@firefly-iii.org
|
|
||||||
*
|
|
||||||
* 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();
|
|
||||||
}
|
|
||||||
}
|
|
@ -49,12 +49,8 @@ class UpdateController extends Controller
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->middleware(
|
$this->middleware(
|
||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
/** @var User $user */
|
|
||||||
$user = auth()->user();
|
|
||||||
|
|
||||||
/** @var RecurringRepositoryInterface repository */
|
|
||||||
$this->repository = app(RecurringRepositoryInterface::class);
|
$this->repository = app(RecurringRepositoryInterface::class);
|
||||||
$this->repository->setUser($user);
|
$this->repository->setUser(auth()->user());
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@ use Illuminate\Pagination\LengthAwarePaginator;
|
|||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
||||||
use League\Fractal\Resource\Collection as FractalCollection;
|
use League\Fractal\Resource\Collection as FractalCollection;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class TriggerController
|
* Class TriggerController
|
||||||
|
@ -61,7 +61,7 @@ class MoveTransactionsRequest extends FormRequest
|
|||||||
* Configure the validator instance with special rules for after the basic validation rules.
|
* Configure the validator instance with special rules for after the basic validation rules.
|
||||||
*
|
*
|
||||||
* @param Validator $validator
|
* @param Validator $validator
|
||||||
* TODO duplicate code.
|
* TODO duplicate code.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -80,10 +80,10 @@ class StoreRequest extends FormRequest
|
|||||||
// append Location information.
|
// append Location information.
|
||||||
$data = $this->appendLocationData($data, null);
|
$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'] = bcmul($this->string('liability_amount'), '-1');
|
||||||
$data['opening_balance_date'] = $this->date('liability_start_date');
|
$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;
|
$data['account_type_id'] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ class UpdateRequest extends FormRequest
|
|||||||
'name' => ['name', 'string'],
|
'name' => ['name', 'string'],
|
||||||
'active' => ['active', 'boolean'],
|
'active' => ['active', 'boolean'],
|
||||||
'include_net_worth' => ['include_net_worth', 'boolean'],
|
'include_net_worth' => ['include_net_worth', 'boolean'],
|
||||||
'account_type' => ['type', 'string'],
|
'account_type_name' => ['type', 'string'],
|
||||||
'virtual_balance' => ['virtual_balance', 'string'],
|
'virtual_balance' => ['virtual_balance', 'string'],
|
||||||
'iban' => ['iban', 'string'],
|
'iban' => ['iban', 'string'],
|
||||||
'BIC' => ['bic', 'string'],
|
'BIC' => ['bic', 'string'],
|
||||||
@ -72,10 +72,10 @@ class UpdateRequest extends FormRequest
|
|||||||
$data = $this->getAllData($fields);
|
$data = $this->getAllData($fields);
|
||||||
$data = $this->appendLocationData($data, null);
|
$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'] = bcmul($this->nullableString('liability_amount'), '-1');
|
||||||
$data['opening_balance_date'] = $this->date('liability_start_date');
|
$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;
|
$data['account_type_id'] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,13 +85,13 @@ class AccountFactory
|
|||||||
Log::debug('Found nothing. Will create a new one.');
|
Log::debug('Found nothing. Will create a new one.');
|
||||||
$return = $this->create(
|
$return = $this->create(
|
||||||
[
|
[
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
'name' => $accountName,
|
'name' => $accountName,
|
||||||
'account_type_id' => $type->id,
|
'account_type_id' => $type->id,
|
||||||
'account_type' => null,
|
'account_type_name' => null,
|
||||||
'virtual_balance' => '0',
|
'virtual_balance' => '0',
|
||||||
'iban' => null,
|
'iban' => null,
|
||||||
'active' => true,
|
'active' => true,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
* @property int $user_id
|
* @property int $user_id
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property array|null $data
|
* @property int|string|array|null $data
|
||||||
* @property-read User $user
|
* @property-read User $user
|
||||||
* @method static Builder|Preference newModelQuery()
|
* @method static Builder|Preference newModelQuery()
|
||||||
* @method static Builder|Preference newQuery()
|
* @method static Builder|Preference newQuery()
|
||||||
|
@ -504,12 +504,12 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'account_type_id' => null,
|
'account_type_id' => null,
|
||||||
'account_type' => AccountType::RECONCILIATION,
|
'account_type_name' => AccountType::RECONCILIATION,
|
||||||
'active' => true,
|
'active' => true,
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'currency_id' => $currency->id,
|
'currency_id' => $currency->id,
|
||||||
'currency_code' => $currency->code,
|
'currency_code' => $currency->code,
|
||||||
];
|
];
|
||||||
|
|
||||||
/** @var AccountFactory $factory */
|
/** @var AccountFactory $factory */
|
||||||
|
@ -180,6 +180,14 @@ class ObjectGroupRepository implements ObjectGroupRepositoryInterface
|
|||||||
return $objectGroup;
|
return $objectGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param User $user
|
||||||
|
*/
|
||||||
|
public function setUser(User $user): void
|
||||||
|
{
|
||||||
|
$this->user = $user;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
@ -197,12 +205,4 @@ class ObjectGroupRepository implements ObjectGroupRepositoryInterface
|
|||||||
|
|
||||||
return $objectGroup;
|
return $objectGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param User $user
|
|
||||||
*/
|
|
||||||
public function setUser(User $user): void
|
|
||||||
{
|
|
||||||
$this->user = $user;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Repositories\ObjectGroup;
|
namespace FireflyIII\Repositories\ObjectGroup;
|
||||||
|
|
||||||
use FireflyIII\Models\ObjectGroup;
|
use FireflyIII\Models\ObjectGroup;
|
||||||
|
use FireflyIII\User;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -87,6 +88,11 @@ interface ObjectGroupRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function setOrder(ObjectGroup $objectGroup, int $newOrder): ObjectGroup;
|
public function setOrder(ObjectGroup $objectGroup, int $newOrder): ObjectGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param User $user
|
||||||
|
*/
|
||||||
|
public function setUser(User $user): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ObjectGroup $objectGroup
|
* @param ObjectGroup $objectGroup
|
||||||
* @param array $data
|
* @param array $data
|
||||||
|
@ -197,14 +197,14 @@ trait JournalServiceTrait
|
|||||||
|
|
||||||
$account = $this->accountRepository->store(
|
$account = $this->accountRepository->store(
|
||||||
[
|
[
|
||||||
'account_type_id' => null,
|
'account_type_id' => null,
|
||||||
'account_type' => $preferredType,
|
'account_type_name' => $preferredType,
|
||||||
'name' => $data['name'],
|
'name' => $data['name'],
|
||||||
'virtual_balance' => null,
|
'virtual_balance' => null,
|
||||||
'active' => true,
|
'active' => true,
|
||||||
'iban' => $data['iban'],
|
'iban' => $data['iban'],
|
||||||
'currency_id' => $data['currency_id'] ?? null,
|
'currency_id' => $data['currency_id'] ?? null,
|
||||||
'order' => $this->accountRepository->maxOrder($preferredType),
|
'order' => $this->accountRepository->maxOrder($preferredType),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
// store BIC
|
// store BIC
|
||||||
|
@ -32,6 +32,7 @@ use Laravel\Passport\Passport;
|
|||||||
use Log;
|
use Log;
|
||||||
use phpseclib\Crypt\RSA as LegacyRSA;
|
use phpseclib\Crypt\RSA as LegacyRSA;
|
||||||
use phpseclib3\Crypt\RSA;
|
use phpseclib3\Crypt\RSA;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trait CreateStuff
|
* Trait CreateStuff
|
||||||
*
|
*
|
||||||
@ -54,7 +55,7 @@ trait CreateStuff
|
|||||||
$assetAccount = [
|
$assetAccount = [
|
||||||
'name' => $request->get('bank_name'),
|
'name' => $request->get('bank_name'),
|
||||||
'iban' => null,
|
'iban' => null,
|
||||||
'account_type' => 'asset',
|
'account_type_name' => 'asset',
|
||||||
'virtual_balance' => 0,
|
'virtual_balance' => 0,
|
||||||
'account_type_id' => null,
|
'account_type_id' => null,
|
||||||
'active' => true,
|
'active' => true,
|
||||||
@ -84,7 +85,7 @@ trait CreateStuff
|
|||||||
$assetAccount = [
|
$assetAccount = [
|
||||||
'name' => (string)trans('firefly.cash_wallet', [], $language),
|
'name' => (string)trans('firefly.cash_wallet', [], $language),
|
||||||
'iban' => null,
|
'iban' => null,
|
||||||
'account_type' => 'asset',
|
'account_type_name' => 'asset',
|
||||||
'virtual_balance' => 0,
|
'virtual_balance' => 0,
|
||||||
'account_type_id' => null,
|
'account_type_id' => null,
|
||||||
'active' => true,
|
'active' => true,
|
||||||
@ -151,7 +152,7 @@ trait CreateStuff
|
|||||||
$savingsAccount = [
|
$savingsAccount = [
|
||||||
'name' => (string)trans('firefly.new_savings_account', ['bank_name' => $request->get('bank_name')], $language),
|
'name' => (string)trans('firefly.new_savings_account', ['bank_name' => $request->get('bank_name')], $language),
|
||||||
'iban' => null,
|
'iban' => null,
|
||||||
'account_type' => 'asset',
|
'account_type_name' => 'asset',
|
||||||
'account_type_id' => null,
|
'account_type_id' => null,
|
||||||
'virtual_balance' => 0,
|
'virtual_balance' => 0,
|
||||||
'active' => true,
|
'active' => true,
|
||||||
|
@ -143,9 +143,9 @@ class Preferences
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param User $user
|
* @param User $user
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param null|string $default
|
* @param null|string|int $default
|
||||||
*
|
*
|
||||||
* @return \FireflyIII\Models\Preference|null
|
* @return \FireflyIII\Models\Preference|null
|
||||||
*/
|
*/
|
||||||
|
@ -4,3 +4,4 @@ sonar.sources=app,bootstrap,database,resources/assets,resources/views,routes,tes
|
|||||||
sonar.login=2859ca0fb90d8419e211190a8892b3e1721244cb
|
sonar.login=2859ca0fb90d8419e211190a8892b3e1721244cb
|
||||||
sonar.sourceEncoding=UTF-8
|
sonar.sourceEncoding=UTF-8
|
||||||
sonar.php.coverage.reportPaths=storage/build/clover-all.xml
|
sonar.php.coverage.reportPaths=storage/build/clover-all.xml
|
||||||
|
sonar.host.url=http://172.16.21.6:10005
|
||||||
|
Loading…
Reference in New Issue
Block a user