Auto commit for release 'develop' on 2024-05-13

This commit is contained in:
github-actions
2024-05-13 05:10:16 +02:00
parent 04fe5d1fc4
commit cb5d856769
48 changed files with 271 additions and 398 deletions

View File

@@ -226,16 +226,16 @@
},
{
"name": "friendsofphp/php-cs-fixer",
"version": "v3.56.0",
"version": "v3.56.1",
"source": {
"type": "git",
"url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
"reference": "4429303e62a4ce583ddfe64ff5c34c76bcf74931"
"reference": "69c6168ae8bc96dc656c7f6c7271120a68ae5903"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/4429303e62a4ce583ddfe64ff5c34c76bcf74931",
"reference": "4429303e62a4ce583ddfe64ff5c34c76bcf74931",
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/69c6168ae8bc96dc656c7f6c7271120a68ae5903",
"reference": "69c6168ae8bc96dc656c7f6c7271120a68ae5903",
"shasum": ""
},
"require": {
@@ -307,7 +307,7 @@
],
"support": {
"issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues",
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.56.0"
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.56.1"
},
"funding": [
{
@@ -315,7 +315,7 @@
"type": "github"
}
],
"time": "2024-05-07T15:50:05+00:00"
"time": "2024-05-10T11:31:15+00:00"
},
{
"name": "psr/container",

View File

@@ -24,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Api\V2\Controllers\Autocomplete;
use Carbon\Carbon;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Api\V2\Request\Autocomplete\AutocompleteRequest;
use FireflyIII\Exceptions\FireflyException;
@@ -41,14 +40,13 @@ use Illuminate\Http\JsonResponse;
*/
class AccountController extends Controller
{
// use AccountFilter;
private AdminAccountRepositoryInterface $adminRepository;
private TransactionCurrency $default;
private ExchangeRateConverter $converter;
// private array $balanceTypes;
// private AccountRepositoryInterface $repository;
// private array $balanceTypes;
// private AccountRepositoryInterface $repository;
/**
* AccountController constructor.
@@ -62,16 +60,16 @@ class AccountController extends Controller
$userGroup = $this->validateUserGroup($request);
$this->adminRepository = app(AdminAccountRepositoryInterface::class);
$this->adminRepository->setUserGroup($userGroup);
$this->default = app('amount')->getDefaultCurrency();
$this->converter = app(ExchangeRateConverter::class);
$this->default = app('amount')->getDefaultCurrency();
$this->converter = app(ExchangeRateConverter::class);
// $this->repository = app(AccountRepositoryInterface::class);
// $this->repository = app(AccountRepositoryInterface::class);
// $this->adminRepository->setUserGroup($this->validateUserGroup($request));
return $next($request);
}
);
// $this->balanceTypes = [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE];
// $this->balanceTypes = [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE];
}
/**
@@ -102,6 +100,7 @@ class AccountController extends Controller
private function parseAccount(Account $account): array
{
$currency = $this->adminRepository->getAccountCurrency($account);
return [
'id' => (string) $account->id,
'title' => $account->name,
@@ -120,21 +119,19 @@ class AccountController extends Controller
{
$return = [];
$balances = $this->adminRepository->getAccountBalances($account);
/** @var AccountBalance $balance */
foreach ($balances as $balance) {
$return[] = $this->parseAccountBalance($balance);
}
return $return;
}
/**
* @param AccountBalance $balance
*
* @return array
*/
private function parseAccountBalance(AccountBalance $balance): array
{
$currency = $balance->transactionCurrency;
return [
'title' => $balance->title,
'native_amount' => $this->converter->convert($currency, $this->default, today(), $balance->balance),
@@ -147,8 +144,6 @@ class AccountController extends Controller
'native_currency_code' => $this->default->code,
'native_currency_symbol' => $this->default->symbol,
'native_currency_decimal' => $this->default->decimal_places,
];
}
}

View File

@@ -35,29 +35,29 @@ use Illuminate\Foundation\Http\FormRequest;
use LaravelJsonApi\Core\Query\QueryParameters;
use LaravelJsonApi\Validation\Rule as JsonApiRule;
use Illuminate\Support\Facades\Log;
/**
* Class AutocompleteRequest
*/
class AutocompleteRequest extends FormRequest
{
use AccountFilter;
use ChecksLogin;
use ConvertsDataTypes;
use AccountFilter;
/**
* Loops over all possible query parameters (these are shared over ALL auto complete requests)
* and returns a validated array of parameters.
*
* The advantage is a single class. But you may also submit "account types" to an endpoint that doesn't use these.
*
* @return array
*/
public function getParameters(): array
{
$queryParameters = QueryParameters::cast($this->all());
try {
$date = Carbon::createFromFormat('Y-m-d', $queryParameters->filter()?->value('date', date('Y-m-d')), config('app.timezone'));
} catch(InvalidFormatException $e) {
} catch (InvalidFormatException $e) {
Log::debug(sprintf('Invalid date format in autocomplete request. Using today: %s', $e->getMessage()));
$date = today();
}
@@ -65,20 +65,16 @@ class AutocompleteRequest extends FormRequest
$size = (int) ($queryParameters->page()['size'] ?? 50);
$accountTypes = $this->getAccountTypeParameter($queryParameters->filter()?->value('account_types', '') ?? '');
return [
'date' => $date,
'query' => $query,
'size' => $size,
'account_types' => $accountTypes,
];
}
public function getData(): array
{
return [];
$types = $this->convertString('types');
$array = [];
@@ -101,12 +97,11 @@ class AutocompleteRequest extends FormRequest
public function rules(): array
{
return [
'fields' => JsonApiRule::notSupported(),
'filter' => ['nullable', 'array', new IsValidFilter(['query', 'date', 'account_types']),],
'filter' => ['nullable', 'array', new IsValidFilter(['query', 'date', 'account_types'])],
'include' => JsonApiRule::notSupported(),
'page' => ['nullable', 'array', new IsValidPage(['size']),],
'page' => ['nullable', 'array', new IsValidPage(['size'])],
'sort' => JsonApiRule::notSupported(),
];
}
@@ -123,6 +118,7 @@ class AutocompleteRequest extends FormRequest
foreach ($types as $type) {
$return = array_merge($return, $this->mapAccountTypes($type));
}
return array_unique($return);
}
}

View File

@@ -1,44 +1,38 @@
<?php
declare(strict_types=1);
namespace FireflyIII\Console\Commands\Correction;
use DB;
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use FireflyIII\Models\AccountBalance;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Support\Models\AccountBalanceCalculator;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
use stdClass;
/**
* Class CorrectionSkeleton
*/
class CorrectAccountBalance extends Command
{
use ShowsFriendlyMessages;
protected $description = 'Recalculate all account balance amounts';
protected $signature = 'firefly-iii:correct-account-balance';
use ShowsFriendlyMessages;
protected $signature = 'firefly-iii:correct-account-balance';
/**
* @return int
*/
public function handle(): int
{
$this->correctBalanceAmounts();
return 0;
}
private function correctBalanceAmounts(): void
{
AccountBalanceCalculator::recalculate(null, null);
foreach(TransactionJournal::all() as $journal) {
foreach (TransactionJournal::all() as $journal) {
Log::debug(sprintf('Recalculating account balances for journal #%d', $journal->id));
foreach($journal->transactions as $transaction) {
foreach ($journal->transactions as $transaction) {
AccountBalanceCalculator::recalculate($transaction->account, $journal);
}
}

View File

@@ -33,17 +33,17 @@ class AccountBalance
public static function fromArray(): self
{
$balance = new self;
$balance = new self();
$balance->id = (string) random_int(1, 1000);
$balance->name = (string) random_int(1, 1000);
$balance->name = (string) random_int(1, 1000);
$balance->amount = (string) random_int(1, 1000);
$balance->currencyId = '1';
return $balance;
}
public function getAccount():Account {
public function getAccount(): Account
{
return Account::inRandomOrder()->first();
}
}

View File

@@ -24,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Handlers\Observer;
use FireflyIII\Models\TransactionJournal;
use Illuminate\Support\Facades\Log;
/**
* Class TransactionJournalObserver
@@ -49,5 +48,4 @@ class TransactionJournalObserver
$transactionJournal->destJournalLinks()->delete();
$transactionJournal->auditLogEntries()->delete();
}
}

View File

@@ -23,11 +23,8 @@ declare(strict_types=1);
namespace FireflyIII\Handlers\Observer;
use DB;
use FireflyIII\Models\AccountBalance;
use FireflyIII\Models\Transaction;
use FireflyIII\Support\Models\AccountBalanceCalculator;
use stdClass;
/**
* Class TransactionObserver
@@ -44,15 +41,16 @@ class TransactionObserver
{
app('log')->debug('Observe "updated" of a transaction.');
AccountBalanceCalculator::recalculate($transaction->account, null);
if((float)$transaction->amount > 0) {
if ((float)$transaction->amount > 0) {
AccountBalanceCalculator::recalculateByJournal($transaction->transactionJournal);
}
}
public function created(Transaction $transaction): void
{
app('log')->debug('Observe "created" of a transaction.');
AccountBalanceCalculator::recalculate($transaction->account, null);
if((float)$transaction->amount > 0) {
if ((float)$transaction->amount > 0) {
AccountBalanceCalculator::recalculateByJournal($transaction->transactionJournal);
}
}

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Api\V3\Controllers;
use FireflyIII\Http\Controllers\Controller;
@@ -13,17 +15,16 @@ use LaravelJsonApi\Laravel\Http\Requests\AnonymousQuery;
class AccountController extends Controller
{
use Actions\AttachRelationship;
use Actions\Destroy;
use Actions\DetachRelationship;
use Actions\FetchMany;
use Actions\FetchOne;
use Actions\Store;
use Actions\Update;
use Actions\Destroy;
use Actions\FetchRelated;
use Actions\FetchRelationship;
use Actions\Store;
use Actions\Update;
use Actions\UpdateRelationship;
use Actions\AttachRelationship;
use Actions\DetachRelationship;
public function readAccountBalances(AnonymousQuery $query, AccountBalanceSchema $schema, Account $account): Responsable
{
@@ -34,7 +35,8 @@ class AccountController extends Controller
->queryAll()
->withRequest($query)
->withAccount($account)
->get();
->get()
;
return DataResponse::make($models);
}

View File

@@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\JsonApi\Rules;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;
class IsValidFilter implements ValidationRule
@@ -35,10 +34,8 @@ class IsValidFilter implements ValidationRule
$this->allowed = $keys;
}
/**
* @inheritDoc
*/
#[\Override] public function validate(string $attribute, mixed $value, Closure $fail): void
#[\Override]
public function validate(string $attribute, mixed $value, \Closure $fail): void
{
if ('filter' !== $attribute) {
$fail('validation.bad_api_filter')->translate();

View File

@@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\JsonApi\Rules;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;
class IsValidPage implements ValidationRule
@@ -35,10 +34,8 @@ class IsValidPage implements ValidationRule
$this->allowed = $keys;
}
/**
* @inheritDoc
*/
#[\Override] public function validate(string $attribute, mixed $value, Closure $fail): void
#[\Override]
public function validate(string $attribute, mixed $value, \Closure $fail): void
{
if ('page' !== $attribute) {
$fail('validation.bad_api_filter')->translate();

View File

@@ -29,23 +29,17 @@ use LaravelJsonApi\NonEloquent\AbstractRepository;
class AccountBalanceRepository extends AbstractRepository implements QueriesAll
{
/**
* @inheritDoc
*/
#[\Override] public function find(string $resourceId): ?object
#[\Override]
public function find(string $resourceId): ?object
{
return AccountBalance::fromArray();
}
/**
* @inheritDoc
*/
public function queryAll(): Capabilities\AccountBalanceQuery
{
return Capabilities\AccountBalanceQuery::make()
->withServer($this->server)
->withSchema($this->schema);
->withServer($this->server)
->withSchema($this->schema)
;
}
}

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace FireflyIII\JsonApi\V3\AccountBalances;
use Illuminate\Http\Request;
@@ -9,8 +11,6 @@ class AccountBalanceResource extends JsonApiResource
{
/**
* Get the resource id.
*
* @return string
*/
public function id(): string
{
@@ -20,9 +20,7 @@ class AccountBalanceResource extends JsonApiResource
/**
* Get the resource's attributes.
*
* @param Request|null $request
*
* @return iterable
* @param null|Request $request
*/
public function attributes($request): iterable
{
@@ -35,9 +33,7 @@ class AccountBalanceResource extends JsonApiResource
/**
* Get the resource's relationships.
*
* @param Request|null $request
*
* @return iterable
* @param null|Request $request
*/
public function relationships($request): iterable
{
@@ -45,5 +41,4 @@ class AccountBalanceResource extends JsonApiResource
$this->relation('account')->withData($this->resource->getAccount()),
];
}
}

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace FireflyIII\JsonApi\V3\AccountBalances;
use FireflyIII\Entities\AccountBalance;
@@ -10,18 +12,13 @@ use LaravelJsonApi\NonEloquent\Fields\ID;
class AccountBalanceSchema extends Schema
{
/**
* The model the schema corresponds to.
*
* @var string
*/
public static string $model = AccountBalance::class;
/**
* Get the resource fields.
*
* @return array
*/
public function fields(): array
{
@@ -35,8 +32,6 @@ class AccountBalanceSchema extends Schema
/**
* Get the resource filters.
*
* @return array
*/
public function filters(): array
{
@@ -48,7 +43,8 @@ class AccountBalanceSchema extends Schema
public function repository(): AccountBalanceRepository
{
return AccountBalanceRepository::make()
->withServer($this->server)
->withSchema($this);
->withServer($this->server)
->withSchema($this)
;
}
}

View File

@@ -39,9 +39,6 @@ class AccountBalanceQuery extends QueryAll
parent::__construct();
}
/**
* @inheritDoc
*/
public function get(): iterable
{
return [
@@ -55,7 +52,7 @@ class AccountBalanceQuery extends QueryAll
public function withAccount(Account $account): self
{
$this->account = $account;
return $this;
}
}

View File

@@ -27,8 +27,6 @@ use FireflyIII\Models\Account;
use FireflyIII\Support\JsonApi\Concerns\UsergroupAware;
use LaravelJsonApi\Contracts\Store\QueriesAll;
use LaravelJsonApi\NonEloquent\AbstractRepository;
use LaravelJsonApi\NonEloquent\Concerns\HasCrudCapability;
class AccountRepository extends AbstractRepository implements QueriesAll
{
@@ -36,25 +34,20 @@ class AccountRepository extends AbstractRepository implements QueriesAll
/**
* SiteRepository constructor.
*
*/
public function __construct() {}
/**
* @inheritDoc
*/
public function find(string $resourceId): ?object
{
return Account::find((int) $resourceId);
}
public function queryAll(): Capabilities\AccountQuery
{
return Capabilities\AccountQuery::make()
->withUserGroup($this->userGroup)
->withServer($this->server)
->withSchema($this->schema);
->withUserGroup($this->userGroup)
->withServer($this->server)
->withSchema($this->schema)
;
}
}

View File

@@ -1,10 +1,11 @@
<?php
declare(strict_types=1);
namespace FireflyIII\JsonApi\V3\Accounts;
use FireflyIII\Models\Account;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use LaravelJsonApi\Core\Resources\JsonApiResource;
/**
@@ -12,13 +13,10 @@ use LaravelJsonApi\Core\Resources\JsonApiResource;
*/
class AccountResource extends JsonApiResource
{
/**
* Get the resource's attributes.
*
* @param Request|null $request
*
* @return iterable
* @param null|Request $request
*/
public function attributes($request): iterable
{
@@ -32,25 +30,19 @@ class AccountResource extends JsonApiResource
'type' => $this->resource->type,
'account_role' => $this->resource->account_role,
// 'virtual_balance' => $this->resource->virtual_balance,
// 'native_balance' => $this->resource->native_balance,
//'user' => $this->resource->user_array,
// 'balances' => []
//
// 'user' => $this->resource->user_array,
// 'balances' => []
//
// currency
// 'currency_id' => $this->resource->currency_id,
// 'currency_code' => $this->resource->currency_code,
// 'currency_symbol' => $this->resource->currency_symbol,
// 'currency_decimal_places' => $this->resource->currency_decimal_places,
// 'currency_id' => $this->resource->currency_id,
// 'currency_code' => $this->resource->currency_code,
// 'currency_symbol' => $this->resource->currency_symbol,
// 'currency_decimal_places' => $this->resource->currency_decimal_places,
// balance (in currency, on date)
// 'current_balance' => $this->resource->current_balance,
// 'current_balance' => $this->resource->current_balance,
// 'current_balance' => app('steam')->bcround(app('steam')->balance($account, $date), $decimalPlaces),
// 'current_balance_date' => $date->toAtomString(),
@@ -125,9 +117,7 @@ class AccountResource extends JsonApiResource
/**
* Get the resource's relationships.
*
* @param Request|null $request
*
* @return iterable
* @param null|Request $request
*/
public function relationships($request): iterable
{
@@ -136,5 +126,4 @@ class AccountResource extends JsonApiResource
$this->relation('account_balances')->withData($this->resource->balances),
];
}
}

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace FireflyIII\JsonApi\V3\Accounts;
use FireflyIII\Models\Account;
@@ -17,18 +19,13 @@ use LaravelJsonApi\Eloquent\Schema;
class AccountSchema extends Schema
{
/**
* The model the schema corresponds to.
*
* @var string
*/
public static string $model = Account::class;
/**
* Get the resource fields.
*
* @return array
*/
public function fields(): array
{
@@ -49,8 +46,6 @@ class AccountSchema extends Schema
/**
* Get the resource filters.
*
* @return array
*/
public function filters(): array
{
@@ -61,12 +56,9 @@ class AccountSchema extends Schema
/**
* Get the resource paginator.
*
* @return Paginator|null
*/
public function pagination(): ?Paginator
{
return PagePagination::make();
}
}

View File

@@ -35,19 +35,16 @@ use LaravelJsonApi\NonEloquent\Concerns\PaginatesEnumerables;
class AccountQuery extends QueryAll implements HasPagination
{
use PaginatesEnumerables;
use FiltersPagination;
use ValidateSortParameters;
use UsergroupAware;
use ExpandsQuery;
use FiltersPagination;
use PaginatesEnumerables;
use SortsCollection;
use UsergroupAware;
use ValidateSortParameters;
/**
* @inheritDoc
*/
#[\Override] public function get(): iterable
#[\Override]
public function get(): iterable
{
$filters = $this->queryParameters->filter();
$sort = $this->queryParameters->sortFields();
$pagination = $this->filtersPagination($this->queryParameters->page());
@@ -57,8 +54,8 @@ class AccountQuery extends QueryAll implements HasPagination
if (!$needsAll) {
$query = $this->addPagination($query, $pagination);
}
$query = $this->addSortParams($query, $sort);
$query = $this->addFilterParams('account', $query, $filters);
$query = $this->addSortParams($query, $sort);
$query = $this->addFilterParams('account', $query, $filters);
$collection = $query->get(['accounts.*']);
@@ -66,16 +63,11 @@ class AccountQuery extends QueryAll implements HasPagination
$enrichment = new AccountEnrichment();
$collection = $enrichment->enrich($collection);
// add filters after the query
// add sort after the query
$collection = $this->sortCollection($collection, $sort);
return $collection;
// var_dump($filters->value('name'));
// exit;
return $this->sortCollection($collection, $sort);
// var_dump($filters->value('name'));
// exit;
}
}

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace FireflyIII\JsonApi\V3;
use FireflyIII\JsonApi\V3\Accounts\AccountSchema;
@@ -9,18 +11,13 @@ use LaravelJsonApi\Core\Server\Server as BaseServer;
class Server extends BaseServer
{
/**
* The base URI namespace for this server.
*
* @var string
*/
protected string $baseUri = '/api/v3';
/**
* Bootstrap the server when it is handling an HTTP request.
*
* @return void
*/
public function serving(): void
{
@@ -29,8 +26,6 @@ class Server extends BaseServer
/**
* Get the server's list of schemas.
*
* @return array
*/
protected function allSchemas(): array
{
@@ -40,5 +35,4 @@ class Server extends BaseServer
AccountBalanceSchema::class,
];
}
}

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace FireflyIII\JsonApi\V3\Users;
use FireflyIII\Models\User;
@@ -11,12 +13,10 @@ use LaravelJsonApi\Core\Resources\JsonApiResource;
*/
class UserResource extends JsonApiResource
{
/**
* Get the resource's attributes.
*
* @param Request|null $request
* @return iterable
* @param null|Request $request
*/
public function attributes($request): iterable
{
@@ -30,8 +30,7 @@ class UserResource extends JsonApiResource
/**
* Get the resource's relationships.
*
* @param Request|null $request
* @return iterable
* @param null|Request $request
*/
public function relationships($request): iterable
{
@@ -39,5 +38,4 @@ class UserResource extends JsonApiResource
// @TODO
];
}
}

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace FireflyIII\JsonApi\V3\Users;
use FireflyIII\User;
@@ -14,18 +16,13 @@ use LaravelJsonApi\Eloquent\Schema;
class UserSchema extends Schema
{
/**
* The model the schema corresponds to.
*
* @var string
*/
public static string $model = User::class;
/**
* Get the resource fields.
*
* @return array
*/
public function fields(): array
{
@@ -40,8 +37,6 @@ class UserSchema extends Schema
/**
* Get the resource filters.
*
* @return array
*/
public function filters(): array
{
@@ -52,8 +47,6 @@ class UserSchema extends Schema
/**
* Get the resource paginator.
*
* @return Paginator|null
*/
public function pagination(): ?Paginator
{

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace FireflyIII\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
@@ -8,9 +10,8 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
class AccountBalance extends Model
{
protected $fillable = ['account_id', 'title', 'transaction_currency_id', 'balance'];
use HasFactory;
protected $fillable = ['account_id', 'title', 'transaction_currency_id', 'balance'];
public function account(): BelongsTo
{

View File

@@ -24,27 +24,18 @@ declare(strict_types=1);
namespace FireflyIII\Policies;
use FireflyIII\Entities\AccountBalance;
use FireflyIII\Models\Account;
use FireflyIII\User;
class AccountBalancePolicy
{
/**
* TODO needs better authentication.
*
* @param User $user
* @param Account $account
*
* @return bool
*/
public function view(User $user, AccountBalance $accountBalance): bool
{
return true;
}
/**
* Everybody can do this, but selection should limit to user.
*
@@ -54,6 +45,4 @@ class AccountBalancePolicy
{
return true;
}
}

View File

@@ -28,23 +28,16 @@ use FireflyIII\User;
class AccountPolicy
{
/**
* TODO needs better authentication.
*
* @param User $user
* @param Account $account
*
* @return bool
*/
public function view(User $user, Account $account): bool
{
return true;
return auth()->check() && $user->id === $account->user_id;
}
/**
* Everybody can do this, but selection should limit to user.
*
@@ -53,6 +46,7 @@ class AccountPolicy
public function viewAny(): bool
{
return true;
return auth()->check();
}

View File

@@ -30,11 +30,6 @@ class BalancePolicy
{
/**
* TODO needs better authentication.
*
* @param User $user
* @param Account $account
*
* @return bool
*/
public function view(User $user, Account $account): bool
{

View File

@@ -23,22 +23,17 @@ declare(strict_types=1);
namespace FireflyIII\Policies;
use FireflyIII\Models\Account;
use FireflyIII\User;
class UserPolicy
{
/**
* TODO needs better authentication.
*
* @param User $user
* @param Account $account
*
* @return bool
*/
public function view(User $user, User $user1): bool
{
return true;
return auth()->check() && $user->id === $account->user_id;
}
@@ -50,11 +45,14 @@ class UserPolicy
public function viewAny(): bool
{
return true;
return auth()->check();
}
public function viewAccounts(User $user): bool
{
return true;
return auth()->check();
}
}

View File

@@ -386,7 +386,8 @@ class AccountRepository implements AccountRepositoryInterface
return $return;
}
#[\Override] public function getAccountBalances(Account $account): Collection
#[\Override]
public function getAccountBalances(Account $account): Collection
{
return $account->accountBalances;
}

View File

@@ -27,7 +27,6 @@ use FireflyIII\Models\UserGroup;
trait UsergroupAware
{
protected UserGroup $userGroup;
public function getUserGroup(): UserGroup
@@ -40,9 +39,10 @@ trait UsergroupAware
$this->userGroup = $userGroup;
}
public function withUserGroup(UserGroup $userGroup): self {
public function withUserGroup(UserGroup $userGroup): self
{
$this->userGroup = $userGroup;
return $this;
}
}

View File

@@ -34,28 +34,28 @@ use Illuminate\Support\Facades\Log;
class AccountEnrichment implements EnrichmentInterface
{
private Collection $collection;
private array $currencies;
#[\Override] public function enrich(Collection $collection): Collection
#[\Override]
public function enrich(Collection $collection): Collection
{
$this->collection = $collection;
$this->currencies = [];
// do everything here:
$this->getLastActivity();
//$this->getMetaBalances();
// $this->getMetaBalances();
$this->collectAccountTypes();
$this->collectMetaData();
$this->collection->transform(function (Account $account) {
$account->user_array = ['id' => 1,'bla bla' => 'bla'];
$account->balances = collect([
['balance_id' => 1,'balance' => 5],
['balance_id' => 2,'balance' => 5],
['balance_id' => 3,'balance' => 5],
]);
$account->user_array = ['id' => 1, 'bla bla' => 'bla'];
$account->balances = collect([
['balance_id' => 1, 'balance' => 5],
['balance_id' => 2, 'balance' => 5],
['balance_id' => 3, 'balance' => 5],
]);
return $account;
});
@@ -64,8 +64,6 @@ class AccountEnrichment implements EnrichmentInterface
/**
* TODO this method refers to a single-use method inside Steam that could be moved here.
*
* @return void
*/
private function getLastActivity(): void
{
@@ -74,14 +72,11 @@ class AccountEnrichment implements EnrichmentInterface
$lastActivity = $accountRepository->getLastActivity($this->collection);
foreach ($lastActivity as $row) {
$this->collection->where('id', $row['account_id'])->first()->last_activity = Carbon::parse($row['date_max'], config('app.timezone'));
}
}
/**
* TODO this method refers to a single-use method inside Steam that could be moved here.
*
* @return void
*/
private function getMetaBalances(): void
{
@@ -89,6 +84,7 @@ class AccountEnrichment implements EnrichmentInterface
$array = app('steam')->balancesByAccountsConverted($this->collection, today());
} catch (FireflyException $e) {
Log::error(sprintf('Could not load balances: %s', $e->getMessage()));
return;
}
foreach ($array as $accountId => $row) {
@@ -99,8 +95,6 @@ class AccountEnrichment implements EnrichmentInterface
/**
* TODO this method refers to a single-use method inside Steam that could be moved here.
*
* @return void
*/
private function collectAccountTypes(): void
{
@@ -115,6 +109,7 @@ class AccountEnrichment implements EnrichmentInterface
}
$this->collection->transform(function (Account $account) use ($types) {
$account->type = $types[$account->id];
return $account;
});
}
@@ -123,19 +118,19 @@ class AccountEnrichment implements EnrichmentInterface
{
/** @var AccountRepositoryInterface $accountRepository */
$accountRepository = app(AccountRepositoryInterface::class);
/** @var CurrencyRepositoryInterface $repository */
$repository = app(CurrencyRepositoryInterface::class);
$repository = app(CurrencyRepositoryInterface::class);
$metaFields = $accountRepository->getMetaValues($this->collection, ['currency_id', 'account_role', 'account_number', 'liability_direction', 'interest', 'interest_period', 'current_debt']);
$currencyIds = $metaFields->where('name', 'currency_id')->pluck('data')->toArray();
$metaFields = $accountRepository->getMetaValues($this->collection, ['currency_id', 'account_role', 'account_number', 'liability_direction', 'interest', 'interest_period', 'current_debt']);
$currencyIds = $metaFields->where('name', 'currency_id')->pluck('data')->toArray();
$currencies = [];
$currencies = [];
foreach ($repository->getByIds($currencyIds) as $currency) {
$id = $currency->id;
$currencies[$id] = $currency;
}
$this->collection->transform(function (Account $account) use ($metaFields, $currencies) {
$set = $metaFields->where('account_id', $account->id);
foreach ($set as $entry) {
@@ -147,6 +142,7 @@ class AccountEnrichment implements EnrichmentInterface
$account->currency_decimal_places = $currencies[$id]?->decimal_places;
}
}
return $account;
});
}

View File

@@ -28,5 +28,4 @@ use Illuminate\Support\Collection;
interface EnrichmentInterface
{
public function enrich(Collection $collection): Collection;
}

View File

@@ -35,6 +35,7 @@ trait ExpandsQuery
final protected function addPagination(Builder $query, array $pagination): Builder
{
$skip = ($pagination['number'] - 1) * $pagination['size'];
return $query->skip($skip)->take($pagination['size']);
}
@@ -46,6 +47,7 @@ trait ExpandsQuery
foreach ($sort->all() as $sortField) {
$query->orderBy($sortField->name(), $sortField->isAscending() ? 'ASC' : 'DESC');
}
return $query;
}
@@ -54,11 +56,11 @@ trait ExpandsQuery
if (null === $filters) {
return $query;
}
$config = config(sprintf('firefly.valid_query_filters.%s', $class)) ?? [];
if (count($filters->all()) === 0) {
$config = config(sprintf('firefly.valid_query_filters.%s', $class)) ?? [];
if (0 === count($filters->all())) {
return $query;
}
$query->where(function (Builder $q) use ($config, $filters) {
$query->where(function (Builder $q) use ($config, $filters): void {
foreach ($filters->all() as $filter) {
if (in_array($filter->key(), $config, true)) {
foreach ($filter->value() as $value) {
@@ -80,5 +82,4 @@ trait ExpandsQuery
return $query;
}
}

View File

@@ -25,7 +25,6 @@ namespace FireflyIII\Support\JsonApi;
trait FiltersPagination
{
protected function filtersPagination(?array $pagination): array
{
if (null === $pagination) {
@@ -39,8 +38,8 @@ trait FiltersPagination
$pagination['number'] = min(65536, max($pagination['number'], 1));
// clean up page size
$pagination['size'] = (int) ($pagination['size'] ?? $this->getPageSize());
$pagination['size'] = min(1337, max($pagination['size'], 1));
$pagination['size'] = (int) ($pagination['size'] ?? $this->getPageSize());
$pagination['size'] = min(1337, max($pagination['size'], 1));
return $pagination;
}
@@ -50,6 +49,7 @@ trait FiltersPagination
if (auth()->check()) {
return (int) app('preferences')->get('listPageSize', 50)->data;
}
return 50;
}
}

View File

@@ -28,16 +28,15 @@ use LaravelJsonApi\Core\Query\SortFields;
trait SortsCollection
{
protected function sortCollection(Collection $collection, ?SortFields $sortFields): Collection {
if(null === $sortFields) {
protected function sortCollection(Collection $collection, ?SortFields $sortFields): Collection
{
if (null === $sortFields) {
return $collection;
}
foreach($sortFields->all() as $sortField) {
$collection = $sortField->isAscending() ? $collection->sortBy($sortField->name()) : $collection->sortByDesc($sortField->name());
foreach ($sortFields->all() as $sortField) {
$collection = $sortField->isAscending() ? $collection->sortBy($sortField->name()) : $collection->sortByDesc($sortField->name());
}
return $collection;
}
}

View File

@@ -27,21 +27,20 @@ use LaravelJsonApi\Core\Query\SortFields;
trait ValidateSortParameters
{
function validateParams(string $class, ?SortFields $params): bool
public function validateParams(string $class, ?SortFields $params): bool
{
if(null === $params) {
if (null === $params) {
return false;
}
$config = config(sprintf('firefly.full_data_set.%s', $class)) ?? [];
foreach ($params->all() as $field) {
if (in_array($field->name(), $config, true)) {
return true;
}
}
return false;
}
}

View File

@@ -23,13 +23,11 @@ declare(strict_types=1);
namespace FireflyIII\Support\Models;
use DB;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountBalance;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use Illuminate\Support\Facades\Log;
use stdClass;
class AccountBalanceCalculator
{
@@ -38,8 +36,8 @@ class AccountBalanceCalculator
// first collect normal amounts (in whatever currency), and set them.
// select account_id, transaction_currency_id, foreign_currency_id, sum(amount), sum(foreign_amount) from transactions group by account_id, transaction_currency_id, foreign_currency_id
$query = Transaction::groupBy(['transactions.account_id', 'transactions.transaction_currency_id', 'transactions.foreign_currency_id']);
$title = 'balance';
$query = Transaction::groupBy(['transactions.account_id', 'transactions.transaction_currency_id', 'transactions.foreign_currency_id']);
$title = 'balance';
if (null !== $account) {
$query->where('transactions.account_id', $account->id);
}
@@ -49,18 +47,18 @@ class AccountBalanceCalculator
$title = 'balance_after_journal';
}
$result = $query->get(['transactions.account_id', 'transactions.transaction_currency_id', 'transactions.foreign_currency_id', DB::raw('SUM(transactions.amount) as sum_amount'), DB::raw('SUM(transactions.foreign_amount) as sum_foreign_amount')]);
$result = $query->get(['transactions.account_id', 'transactions.transaction_currency_id', 'transactions.foreign_currency_id', \DB::raw('SUM(transactions.amount) as sum_amount'), \DB::raw('SUM(transactions.foreign_amount) as sum_foreign_amount')]);
// reset account balances:
self::resetAccountBalances($title, $account, $transactionJournal);
/** @var stdClass $row */
/** @var \stdClass $row */
foreach ($result as $row) {
$account = (int) $row->account_id;
$transactionCurrency = (int) $row->transaction_currency_id;
$foreignCurrency = (int) $row->foreign_currency_id;
$sumAmount = $row->sum_amount;
$sumForeignAmount = $row->sum_foreign_amount;
$account = (int) $row->account_id;
$transactionCurrency = (int) $row->transaction_currency_id;
$foreignCurrency = (int) $row->foreign_currency_id;
$sumAmount = $row->sum_amount;
$sumForeignAmount = $row->sum_foreign_amount;
// first create for normal currency:
$entry = self::getBalance($title, $account, $transactionCurrency, $transactionJournal?->id);
@@ -78,23 +76,23 @@ class AccountBalanceCalculator
Log::debug(sprintf('Set balance entry "%s" #%d to amount %s', $title, $entry->id, $entry->balance));
}
}
return;
}
private static function getBalance(string $title, int $account, int $currency, ?int $journal): AccountBalance
{
$query = AccountBalance::where('title', $title)->where('account_id', $account)->where('transaction_currency_id', $currency);
$query = AccountBalance::where('title', $title)->where('account_id', $account)->where('transaction_currency_id', $currency);
if (null !== $journal) {
$query->where('transaction_journal_id', $journal);
}
$entry = $query->first();
$entry = $query->first();
if (null !== $entry) {
Log::debug(sprintf('Found account balance "%s" for account #%d and currency #%d: %s', $title, $account, $currency, $entry->balance));
return $entry;
}
$entry = new AccountBalance;
$entry = new AccountBalance();
$entry->title = $title;
$entry->account_id = $account;
$entry->transaction_currency_id = $currency;
@@ -102,6 +100,7 @@ class AccountBalanceCalculator
$entry->balance = '0';
$entry->save();
Log::debug(sprintf('Created new account balance for account #%d and currency #%d: %s', $account, $currency, $entry->balance));
return $entry;
}
@@ -110,20 +109,20 @@ class AccountBalanceCalculator
if (null === $account && null === $transactionJournal) {
AccountBalance::whereNotNull('updated_at')->where('title', $title)->update(['balance' => '0']);
Log::debug('Set ALL balances to zero.');
return;
}
if(null !== $account && null === $transactionJournal) {
if (null !== $account && null === $transactionJournal) {
AccountBalance::where('account_id', $account->id)->where('title', $title)->update(['balance' => '0']);
Log::debug(sprintf('Set balances of account #%d to zero.', $account->id));
return;
}
AccountBalance::where('account_id', $account->id)->where('transaction_journal_id', $transactionJournal->id)->where('title', $title)->update(['balance' => '0']);
Log::debug(sprintf('Set balances of account #%d + journal #%d to zero.', $account->id, $transactionJournal->id));
}
public static function recalculateByJournal(TransactionJournal $transactionJournal)
public static function recalculateByJournal(TransactionJournal $transactionJournal): void
{
Log::debug(sprintf('Recalculate balance after journal #%d', $transactionJournal->id));
// update both account balances, but limit to this transaction or earlier.
@@ -131,6 +130,4 @@ class AccountBalanceCalculator
self::recalculate($transaction->account, $transactionJournal);
}
}
}

16
composer.lock generated
View File

@@ -5296,20 +5296,20 @@
},
{
"name": "psr/http-factory",
"version": "1.0.2",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-factory.git",
"reference": "e616d01114759c4c489f93b099585439f795fe35"
"reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35",
"reference": "e616d01114759c4c489f93b099585439f795fe35",
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a",
"reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a",
"shasum": ""
},
"require": {
"php": ">=7.0.0",
"php": ">=7.1",
"psr/http-message": "^1.0 || ^2.0"
},
"type": "library",
@@ -5333,7 +5333,7 @@
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interfaces for PSR-7 HTTP message factories",
"description": "PSR-17: Common interfaces for PSR-7 HTTP message factories",
"keywords": [
"factory",
"http",
@@ -5345,9 +5345,9 @@
"response"
],
"support": {
"source": "https://github.com/php-fig/http-factory/tree/1.0.2"
"source": "https://github.com/php-fig/http-factory"
},
"time": "2023-04-10T20:10:41+00:00"
"time": "2024-04-15T12:06:14+00:00"
},
{
"name": "psr/http-message",

View File

@@ -117,7 +117,7 @@ return [
'expression_engine' => false,
// see cer.php for exchange rates feature flag.
],
'version' => 'develop/2024-05-09',
'version' => 'develop/2024-05-13',
'api_version' => '2.0.14',
'db_version' => 24,
@@ -436,7 +436,7 @@ return [
'transfers' => 'fa-exchange',
],
'bindables' => [
'bindables' => [
// models
'account' => Account::class,
'attachment' => Attachment::class,
@@ -494,7 +494,7 @@ return [
'userGroupBill' => UserGroupBill::class,
'userGroup' => UserGroup::class,
],
'rule-actions' => [
'rule-actions' => [
'set_category' => SetCategory::class,
'clear_category' => ClearCategory::class,
'set_budget' => SetBudget::class,
@@ -528,7 +528,7 @@ return [
// 'set_foreign_amount' => SetForeignAmount::class,
// 'set_foreign_currency' => SetForeignCurrency::class,
],
'context-rule-actions' => [
'context-rule-actions' => [
'set_category',
'set_budget',
'add_tag',
@@ -547,13 +547,13 @@ return [
'convert_transfer',
],
'test-triggers' => [
'test-triggers' => [
'limit' => 10,
'range' => 200,
],
// expected source types for each transaction type, in order of preference.
'expected_source_types' => [
'expected_source_types' => [
'source' => [
TransactionTypeModel::WITHDRAWAL => [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE],
TransactionTypeEnum::DEPOSIT->value => [AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE, AccountType::REVENUE, AccountType::CASH],
@@ -598,7 +598,7 @@ return [
TransactionTypeModel::LIABILITY_CREDIT => [AccountType::LIABILITY_CREDIT, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE],
],
],
'allowed_opposing_types' => [
'allowed_opposing_types' => [
'source' => [
AccountType::ASSET => [
AccountType::ASSET,
@@ -688,7 +688,7 @@ return [
],
],
// depending on the account type, return the allowed transaction types:
'allowed_transaction_types' => [
'allowed_transaction_types' => [
'source' => [
AccountType::ASSET => [
TransactionTypeModel::WITHDRAWAL,
@@ -757,7 +757,7 @@ return [
],
// having the source + dest will tell you the transaction type.
'account_to_transaction' => [
'account_to_transaction' => [
AccountType::ASSET => [
AccountType::ASSET => TransactionTypeModel::TRANSFER,
AccountType::CASH => TransactionTypeModel::WITHDRAWAL,
@@ -822,7 +822,7 @@ return [
],
// allowed source -> destination accounts.
'source_dests' => [
'source_dests' => [
TransactionTypeModel::WITHDRAWAL => [
AccountType::ASSET => [AccountType::EXPENSE, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE, AccountType::CASH],
AccountType::LOAN => [AccountType::EXPENSE, AccountType::CASH],
@@ -861,7 +861,7 @@ return [
],
],
// if you add fields to this array, don't forget to update the export routine (ExportDataGenerator).
'journal_meta_fields' => [
'journal_meta_fields' => [
// sepa
'sepa_cc',
'sepa_ct_op',
@@ -895,33 +895,33 @@ return [
'recurrence_count',
'recurrence_date',
],
'webhooks' => [
'webhooks' => [
'max_attempts' => env('WEBHOOK_MAX_ATTEMPTS', 3),
],
'can_have_virtual_amounts' => [AccountType::ASSET],
'can_have_opening_balance' => [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE],
'dynamic_creation_allowed' => [
'can_have_virtual_amounts' => [AccountType::ASSET],
'can_have_opening_balance' => [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE],
'dynamic_creation_allowed' => [
AccountType::EXPENSE,
AccountType::REVENUE,
AccountType::INITIAL_BALANCE,
AccountType::RECONCILIATION,
AccountType::LIABILITY_CREDIT,
],
'valid_asset_fields' => ['account_role', 'account_number', 'currency_id', 'BIC', 'include_net_worth'],
'valid_cc_fields' => ['account_role', 'cc_monthly_payment_date', 'cc_type', 'account_number', 'currency_id', 'BIC', 'include_net_worth'],
'valid_account_fields' => ['account_number', 'currency_id', 'BIC', 'interest', 'interest_period', 'include_net_worth', 'liability_direction'],
'valid_asset_fields' => ['account_role', 'account_number', 'currency_id', 'BIC', 'include_net_worth'],
'valid_cc_fields' => ['account_role', 'cc_monthly_payment_date', 'cc_type', 'account_number', 'currency_id', 'BIC', 'include_net_worth'],
'valid_account_fields' => ['account_number', 'currency_id', 'BIC', 'interest', 'interest_period', 'include_net_worth', 'liability_direction'],
// dynamic date ranges are as follows:
'dynamic_date_ranges' => ['last7', 'last30', 'last90', 'last365', 'MTD', 'QTD', 'YTD'],
'dynamic_date_ranges' => ['last7', 'last30', 'last90', 'last365', 'MTD', 'QTD', 'YTD'],
// only used in v1
'allowed_sort_parameters' => ['order', 'name', 'iban'],
'allowed_sort_parameters' => ['order', 'name', 'iban'],
// preselected account lists possibilities:
'preselected_accounts' => ['all', 'assets', 'liabilities'],
'preselected_accounts' => ['all', 'assets', 'liabilities'],
// allowed filters (search) for APIs
'filters' => [
'filters' => [
'allowed' => [
'accounts' => [
'name' => 'string',
@@ -935,16 +935,16 @@ return [
],
// allowed sort columns for APIs
'sorting' => [
'sorting' => [
'allowed' => [
'transactions' => ['description', 'amount'],
'accounts' => ['name', 'active', 'iban', 'balance', 'last_activity', 'balance_difference', 'current_debt'],
],
],
'full_data_set' => [
'full_data_set' => [
'account' => ['last_activity', 'balance_difference', 'current_balance', 'current_debt'],
],
'valid_query_filters' => [
'valid_query_filters' => [
'account' => ['name', 'iban', 'active'],
],
];

View File

@@ -1,9 +1,10 @@
<?php
declare(strict_types=1);
use FireflyIII\JsonApi\V3\Server;
return [
/*
|--------------------------------------------------------------------------
| Root Namespace

View File

@@ -1,17 +1,19 @@
<?php
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
return new class () extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
if (!Schema::hasTable('account_balances')) {
Schema::create('account_balances', function (Blueprint $table) {
Schema::create('account_balances', function (Blueprint $table): void {
$table->id();
$table->timestamps();
$table->string('title', 100)->nullable();
@@ -24,8 +26,7 @@ return new class extends Migration {
$table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade');
$table->foreign('transaction_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade');
$table->unique(['account_id', 'transaction_currency_id', 'transaction_journal_id','date', 'title'], 'unique_account_currency');
$table->unique(['account_id', 'transaction_currency_id', 'transaction_journal_id', 'date', 'title'], 'unique_account_currency');
});
}
}

30
package-lock.json generated
View File

@@ -4163,9 +4163,9 @@
}
},
"node_modules/cli-table3": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.4.tgz",
"integrity": "sha512-Lm3L0p+/npIQWNIiyF/nAn7T5dnOwR3xNTHXYEBFBFVPXzCVNZ5lqEC/1eo/EVfpDsQ1I+TX4ORPQgp+UI0CRw==",
"version": "0.6.5",
"resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.5.tgz",
"integrity": "sha512-+W/5efTR7y5HRD7gACw9yQjqMVvEMLBHmboM/kPWam+H+Hmyrgjh6YncVKK122YZkXrLudzTuAukUw9FnMf7IQ==",
"dev": true,
"dependencies": {
"string-width": "^4.2.0"
@@ -5095,9 +5095,9 @@
"dev": true
},
"node_modules/electron-to-chromium": {
"version": "1.4.760",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.760.tgz",
"integrity": "sha512-xF6AWMVM/QGQseTPgXjUewfNjCW2fgUcV/z5cSG0r+SiYcgtvcmRAL3oH/MSZwHBBD+fyKTXdQ4qGENJMSedEQ==",
"version": "1.4.763",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.763.tgz",
"integrity": "sha512-k4J8NrtJ9QrvHLRo8Q18OncqBCB7tIUyqxRcJnlonQ0ioHKYB988GcDFF3ZePmnb8eHEopDs/wPHR/iGAFgoUQ==",
"dev": true
},
"node_modules/elliptic": {
@@ -6275,9 +6275,9 @@
}
},
"node_modules/i18next": {
"version": "23.11.3",
"resolved": "https://registry.npmjs.org/i18next/-/i18next-23.11.3.tgz",
"integrity": "sha512-Pq/aSKowir7JM0rj+Wa23Kb6KKDUGno/HjG+wRQu0PxoTbpQ4N89MAT0rFGvXmLkRLNMb1BbBOKGozl01dabzg==",
"version": "23.11.4",
"resolved": "https://registry.npmjs.org/i18next/-/i18next-23.11.4.tgz",
"integrity": "sha512-CCUjtd5TfaCl+mLUzAA0uPSN+AVn4fP/kWCYt/hocPUwusTpMVczdrRyOBUwk6N05iH40qiKx6q1DoNJtBIwdg==",
"funding": [
{
"type": "individual",
@@ -9074,9 +9074,9 @@
"dev": true
},
"node_modules/sass": {
"version": "1.77.0",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.77.0.tgz",
"integrity": "sha512-eGj4HNfXqBWtSnvItNkn7B6icqH14i3CiCGbzMKs3BAPTq62pp9NBYsBgyN4cA+qssqo9r26lW4JSvlaUUWbgw==",
"version": "1.77.1",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.77.1.tgz",
"integrity": "sha512-OMEyfirt9XEfyvocduUIOlUSkWOXS/LAt6oblR/ISXCTukyavjex+zQNm51pPCOiFKY1QpWvEH1EeCkgyV3I6w==",
"dev": true,
"dependencies": {
"chokidar": ">=3.0.0 <4.0.0",
@@ -9128,9 +9128,9 @@
}
},
"node_modules/semver": {
"version": "7.6.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.1.tgz",
"integrity": "sha512-f/vbBsu+fOiYt+lmwZV0rVwJScl46HppnOA1ZvIuBWKOTlllpyJ3bfVax76/OrhCH38dyxoDIA8K7uB963IYgA==",
"version": "7.6.2",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz",
"integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==",
"dev": true,
"bin": {
"semver": "bin/semver.js"

View File

@@ -10,16 +10,16 @@
"title": "T\u00edtulo"
},
"list": {
"drag_and_drop": "Drag and drop",
"drag_and_drop": "Arrastar e soltar",
"active": "Esta ativo?",
"name": "Nome",
"type": "Tipo",
"number": "Account number",
"number": "N\u00famero de conta",
"liability_type": "Tipo de responsabilidade",
"current_balance": "Current balance",
"last_activity": "Last activity",
"amount_due": "Amount due",
"balance_difference": "Balance difference",
"current_balance": "Saldo atual",
"last_activity": "\u00daltima atividade",
"amount_due": "Valor a pagar",
"balance_difference": "Diferen\u00e7a de saldo",
"menu": "Menu"
},
"validation": {

View File

@@ -10,16 +10,16 @@
"title": "T\u00edtulo"
},
"list": {
"drag_and_drop": "Drag and drop",
"drag_and_drop": "Arrastar e soltar",
"active": "Esta ativo?",
"name": "Nome",
"type": "Tipo",
"number": "Account number",
"number": "N\u00famero de conta",
"liability_type": "Tipo de responsabilidade",
"current_balance": "Current balance",
"last_activity": "Last activity",
"amount_due": "Amount due",
"balance_difference": "Balance difference",
"current_balance": "Saldo atual",
"last_activity": "\u00daltima atividade",
"amount_due": "Valor a pagar",
"balance_difference": "Diferen\u00e7a de saldo",
"menu": "Menu"
},
"validation": {

View File

@@ -138,7 +138,8 @@ return [
'error_ip' => 'O endereço de IP associado a este erro é: :ip',
'error_url' => 'O URL é: :url',
'error_user_agent' => 'Agente de utilizador: :userAgent',
'error_stacktrace' => 'The full stacktrace is below. If you think this is a bug in Firefly III, you can forward this message to <a href="mailto:james@firefly-iii.org?subject=I%20found%20a%20bug!">james@firefly-iii.org</a>. This can help fix the bug you just encountered.',
'error_stacktrace' => 'O stacktrace completo encontra-se abaixo. Se julga ser um erro no Firefly III, pode reencaminhar este email para <a href="mailto:james@firefly-iii.org?subject=I%20found%20a%20bug!">james@firefly-iii.org</a>.
Isto pode ajudar a corrigir o erro que acabou de encontrar.',
'error_github_html' => 'Se preferir, pode também abrir uma nova questão no <a href="https://github.com/firefly-iii/firefly-iii/issues">GitHub</a>.',
'error_github_text' => 'Se preferir, pode também abrir uma nova questão em https://github.com/firefly-iii/firefly-iii/issues.',
'error_stacktrace_below' => 'O rastreamento da pilha completo é:',

View File

@@ -42,7 +42,7 @@ return [
'fatal_error' => 'Aconteceu um erro fatal. Por favor, verifique os ficheiros de log em "storage/logs" ou use "docker logs -f [container]" para verificar o que se passa.',
'maintenance_mode' => 'O Firefly III está em modo de manutenção.',
'be_right_back' => 'Volto já!',
'check_back' => 'Firefly III is down for some necessary maintenance. Please check back in a second. If you happen to see this message on the demo site, just wait a few minutes. The database is reset every few hours.',
'check_back' => 'Firefly III encontra-se desligado para alguma manutenção necessária. Volte a tentar daqui a uns segundos. Se acontecer de ver esta mensagem no site de demonstração, espere alguns minutos. A base de dados é reiniciada a cada algumas horas.',
'error_occurred' => 'Oops! Ocorreu um erro.',
'db_error_occurred' => 'Oops! Ocorreu um erro na base de dados.',
'error_not_recoverable' => 'Infelizmente, este erro não era recuperável :(. Firefly III avariou. O erro é:',

View File

@@ -37,7 +37,7 @@ return [
// new user:
'bank_name' => 'Nome do banco',
'bank_balance' => 'Saldo',
'current_balance' => 'Current balance',
'current_balance' => 'Saldo atual',
'savings_balance' => 'Saldo nas poupanças',
'credit_card_limit' => 'Limite do cartão de crédito',
'automatch' => 'Corresponder automaticamente',

View File

@@ -67,12 +67,12 @@ return [
'source' => 'Origem',
'next_expected_match' => 'Próxima correspondência esperada',
'automatch' => 'Auto correspondência?',
'drag_and_drop' => 'Drag and drop',
'number' => 'Account number',
'current_balance' => 'Current balance',
'last_activity' => 'Last activity',
'amount_due' => 'Amount due',
'balance_difference' => 'Balance difference',
'drag_and_drop' => 'Arrastar e soltar',
'number' => 'Número de conta',
'current_balance' => 'Saldo atual',
'last_activity' => 'Última atividade',
'amount_due' => 'Valor a pagar',
'balance_difference' => 'Diferença de saldo',
'menu' => 'Menu',
/*

View File

@@ -27,7 +27,7 @@ return [
'find_or_create_tag_failed' => 'Não foi possível encontrar ou criar a etiqueta ":tag"',
'tag_already_added' => 'A etiqueta ":tag" já está vinculada a esta transação',
'inspect_transaction' => 'Inspecionar transação ":title" @ Firefly III',
'inspect_rule' => 'Inspect rule ":title" @ Firefly III',
'inspect_rule' => 'Inspecionar regra ":title" @ Firefly III',
'journal_other_user' => 'Esta transação não pertence ao utilizador',
'no_such_journal' => 'Esta transação não existe',
'journal_already_no_budget' => 'Esta transação não tem orçamento, então não pode ser removido',
@@ -47,28 +47,28 @@ return [
'unsupported_transaction_type_transfer' => 'Firefly III não pode converter um ":type" para uma transferência',
'already_has_source_asset' => 'Esta transação já tem ":name" como a conta do ativo de origem',
'already_has_destination_asset' => 'Esta transação já tem ":name" como a conta de ativo de destino',
'already_has_destination' => 'This transaction already has ":name" as the destination account',
'already_has_source' => 'This transaction already has ":name" as the source account',
'already_linked_to_subscription' => 'The transaction is already linked to subscription ":name"',
'already_linked_to_category' => 'The transaction is already linked to category ":name"',
'already_linked_to_budget' => 'The transaction is already linked to budget ":name"',
'cannot_find_subscription' => 'Firefly III can\'t find subscription ":name"',
'no_notes_to_move' => 'The transaction has no notes to move to the description field',
'no_tags_to_remove' => 'The transaction has no tags to remove',
'not_withdrawal' => 'The transaction is not a withdrawal',
'not_deposit' => 'The transaction is not a deposit',
'cannot_find_tag' => 'Firefly III can\'t find tag ":tag"',
'cannot_find_asset' => 'Firefly III can\'t find asset account ":name"',
'cannot_find_accounts' => 'Firefly III can\'t find the source or destination account',
'cannot_find_source_transaction' => 'Firefly III can\'t find the source transaction',
'cannot_find_destination_transaction' => 'Firefly III can\'t find the destination transaction',
'cannot_find_source_transaction_account' => 'Firefly III can\'t find the source transaction account',
'cannot_find_destination_transaction_account' => 'Firefly III can\'t find the destination transaction account',
'cannot_find_piggy' => 'Firefly III can\'t find a piggy bank named ":name"',
'no_link_piggy' => 'This transaction\'s accounts are not linked to the piggy bank, so no action will be taken',
'cannot_unlink_tag' => 'Tag ":tag" isn\'t linked to this transaction',
'cannot_find_budget' => 'Firefly III can\'t find budget ":name"',
'cannot_find_category' => 'Firefly III can\'t find category ":name"',
'cannot_set_budget' => 'Firefly III can\'t set budget ":name" to a transaction of type ":type"',
'journal_invalid_amount' => 'Firefly III can\'t set amount ":amount" because it is not a valid number.',
'already_has_destination' => 'Esta transação já tem ":name" como conta de destino',
'already_has_source' => 'Esta transação já tem ":name" como a conta de origem',
'already_linked_to_subscription' => 'A transação já está vinculada à subscrição ":name"',
'already_linked_to_category' => 'A transação já está vinculada à categoria ":name"',
'already_linked_to_budget' => 'A transação já está vinculada ao orçamento ":name"',
'cannot_find_subscription' => 'Firefly III não consegue encontrar a subscrição ":name"',
'no_notes_to_move' => 'A transação não tem notas para mover para o campo de descrição',
'no_tags_to_remove' => 'A transação não tem etiquetas para remover',
'not_withdrawal' => 'A transação não é um levantamento',
'not_deposit' => 'A transação não é um depósito',
'cannot_find_tag' => 'Firefly III não consegue encontrar a etiqueta ":tag"',
'cannot_find_asset' => 'Firefly III não consegue encontrar a conta de ativos ":name"',
'cannot_find_accounts' => 'Firefly III não conseguiu encontrar a conta de origem ou de destino',
'cannot_find_source_transaction' => 'Firefly III não conseguiu encontrar a transação de origem',
'cannot_find_destination_transaction' => 'Firefly III não conseguiu encontrar a transação de destino',
'cannot_find_source_transaction_account' => 'Firefly III não conseguiu encontrar a conta de origem da transação',
'cannot_find_destination_transaction_account' => 'Firefly III não conseguiu encontrar a conta de destino da transação',
'cannot_find_piggy' => 'Firefly III não conseguiu encontrar nenhum mealheiro chamado ":name"',
'no_link_piggy' => 'As contas desta transação não estão ligadas ao mealheiro, logo nenhuma ação será tomada',
'cannot_unlink_tag' => 'Etiqueta ":tag" não está vinculada a esta transação',
'cannot_find_budget' => 'Firefly III não consegue encontrar o orçamento ":name"',
'cannot_find_category' => 'Firefly III não consegue encontrar a categoria ":name"',
'cannot_set_budget' => 'Firefly III não pode definir o orçamento ":name" para uma transação do tipo ":type"',
'journal_invalid_amount' => 'Firefly III não pode definir a quantidade ":amount" porque não é um número válido.',
];

View File

@@ -29,9 +29,7 @@ use LaravelJsonApi\Laravel\Routing\ActionRegistrar;
use LaravelJsonApi\Laravel\Routing\Relationships;
use LaravelJsonApi\Laravel\Routing\ResourceRegistrar;
/**
* V2 auto complete controller(s)
*/
// V2 auto complete controller(s)
Route::group(
[
'namespace' => 'FireflyIII\Api\V2\Controllers\Autocomplete',
@@ -47,11 +45,7 @@ Route::group(
}
);
//JsonApiRoute::server('v3')
// JsonApiRoute::server('v3')
// ->prefix('v3')
// ->resources(function (ResourceRegistrar $server) {
// $server->resource('accounts', AccountController::class)->readOnly()->relationships(function (Relationships $relations) {
@@ -67,8 +61,6 @@ Route::group(
// $server->resource('account-balances', JsonApiController::class);
// });
// V2 API route for Summary boxes
// BASIC
Route::group(
@@ -102,7 +94,6 @@ Route::group(
// V2 API routes for auto complete
// V2 API route for net worth endpoint(s);
Route::group(
[