mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-21 16:38:36 -06:00
Fix and undo some enums
This commit is contained in:
parent
8c5f114339
commit
ed842c2b42
@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
/*
|
/*
|
||||||
* AddTimezonesToDates.php
|
* AddTimezonesToDates.php
|
||||||
* Copyright (c) 2024 james@firefly-iii.org.
|
* Copyright (c) 2024 james@firefly-iii.org.
|
||||||
@ -48,7 +50,7 @@ class AddTimezonesToDates extends Command
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $signature = 'firefly-iii:add-timezones-to-dates';
|
protected $signature = 'firefly-iii:add-timezones-to-dates';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The console command description.
|
* The console command description.
|
||||||
@ -60,7 +62,7 @@ class AddTimezonesToDates extends Command
|
|||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Execute the console command.
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$models = [
|
$models = [
|
||||||
AccountBalance::class => ['date'], // done
|
AccountBalance::class => ['date'], // done
|
||||||
@ -90,17 +92,19 @@ class AddTimezonesToDates extends Command
|
|||||||
|
|
||||||
private function addTimezoneToModelField(string $model, string $field): void
|
private function addTimezoneToModelField(string $model, string $field): void
|
||||||
{
|
{
|
||||||
$shortModel = str_replace('FireflyIII\\Models\\','', $model);
|
$shortModel = str_replace('FireflyIII\Models\\', '', $model);
|
||||||
$timezoneField = sprintf('%s_tz', $field);
|
$timezoneField = sprintf('%s_tz', $field);
|
||||||
$items = new Collection();
|
$items = new Collection();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$items = $model::whereNull($timezoneField)->get();
|
$items = $model::whereNull($timezoneField)->get();
|
||||||
} catch (QueryException $e) {
|
} catch (QueryException $e) {
|
||||||
$this->friendlyError(sprintf('Cannot add timezone to field "%s" of model "%s". Field does not exist.', $field, $shortModel));
|
$this->friendlyError(sprintf('Cannot add timezone to field "%s" of model "%s". Field does not exist.', $field, $shortModel));
|
||||||
Log::error($e->getMessage());
|
Log::error($e->getMessage());
|
||||||
}
|
}
|
||||||
if(0 === $items->count()) {
|
if (0 === $items->count()) {
|
||||||
$this->friendlyPositive(sprintf('Timezone is present in field "%s" of model "%s".', $field, $shortModel));
|
$this->friendlyPositive(sprintf('Timezone is present in field "%s" of model "%s".', $field, $shortModel));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->friendlyInfo(sprintf('Adding timezone to field "%s" of model "%s".', $field, $shortModel));
|
$this->friendlyInfo(sprintf('Adding timezone to field "%s" of model "%s".', $field, $shortModel));
|
||||||
|
@ -35,19 +35,33 @@ class AccountType extends Model
|
|||||||
{
|
{
|
||||||
use ReturnsIntegerIdTrait;
|
use ReturnsIntegerIdTrait;
|
||||||
|
|
||||||
|
/** @deprecated */
|
||||||
public const string ASSET = 'Asset account';
|
public const string ASSET = 'Asset account';
|
||||||
|
/** @deprecated */
|
||||||
public const string BENEFICIARY = 'Beneficiary account';
|
public const string BENEFICIARY = 'Beneficiary account';
|
||||||
|
/** @deprecated */
|
||||||
public const string CASH = 'Cash account';
|
public const string CASH = 'Cash account';
|
||||||
|
/** @deprecated */
|
||||||
public const string CREDITCARD = 'Credit card';
|
public const string CREDITCARD = 'Credit card';
|
||||||
|
/** @deprecated */
|
||||||
public const string DEBT = 'Debt';
|
public const string DEBT = 'Debt';
|
||||||
|
/** @deprecated */
|
||||||
public const string DEFAULT = 'Default account';
|
public const string DEFAULT = 'Default account';
|
||||||
|
/** @deprecated */
|
||||||
public const string EXPENSE = 'Expense account';
|
public const string EXPENSE = 'Expense account';
|
||||||
|
/** @deprecated */
|
||||||
public const string IMPORT = 'Import account';
|
public const string IMPORT = 'Import account';
|
||||||
|
/** @deprecated */
|
||||||
public const string INITIAL_BALANCE = 'Initial balance account';
|
public const string INITIAL_BALANCE = 'Initial balance account';
|
||||||
|
/** @deprecated */
|
||||||
public const string LIABILITY_CREDIT = 'Liability credit account';
|
public const string LIABILITY_CREDIT = 'Liability credit account';
|
||||||
|
/** @deprecated */
|
||||||
public const string LOAN = 'Loan';
|
public const string LOAN = 'Loan';
|
||||||
|
/** @deprecated */
|
||||||
public const string MORTGAGE = 'Mortgage';
|
public const string MORTGAGE = 'Mortgage';
|
||||||
|
/** @deprecated */
|
||||||
public const string RECONCILIATION = 'Reconciliation account';
|
public const string RECONCILIATION = 'Reconciliation account';
|
||||||
|
/** @deprecated */
|
||||||
public const string REVENUE = 'Revenue account';
|
public const string REVENUE = 'Revenue account';
|
||||||
|
|
||||||
protected $casts
|
protected $casts
|
||||||
|
@ -24,7 +24,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
use FireflyIII\Enums\AccountTypeEnum;
|
|
||||||
use FireflyIII\Enums\AutoBudgetType;
|
use FireflyIII\Enums\AutoBudgetType;
|
||||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
|
@ -23,7 +23,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
use FireflyIII\Enums\AccountTypeEnum;
|
|
||||||
use FireflyIII\Enums\RecurrenceRepetitionWeekend;
|
use FireflyIII\Enums\RecurrenceRepetitionWeekend;
|
||||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
|
@ -54,7 +54,6 @@ class TransactionType extends Model
|
|||||||
];
|
];
|
||||||
protected $fillable = ['type'];
|
protected $fillable = ['type'];
|
||||||
|
|
||||||
|
|
||||||
protected function casts(): array
|
protected function casts(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -62,7 +61,6 @@ class TransactionType extends Model
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
* Route binder. Converts the key in the URL to the specified object (or throw 404).
|
||||||
*
|
*
|
||||||
|
@ -142,10 +142,10 @@ class Webhook extends Model
|
|||||||
$webhookId = (int) $value;
|
$webhookId = (int) $value;
|
||||||
|
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
|
|
||||||
/** @var null|Webhook $webhook */
|
/** @var null|Webhook $webhook */
|
||||||
$webhook = $user->webhooks()->find($webhookId);
|
$webhook = $user->webhooks()->find($webhookId);
|
||||||
if (null !== $webhook) {
|
if (null !== $webhook) {
|
||||||
return $webhook;
|
return $webhook;
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ class JournalUpdateService
|
|||||||
'external_url',
|
'external_url',
|
||||||
];
|
];
|
||||||
$this->metaDate = ['interest_date', 'book_date', 'process_date', 'due_date', 'payment_date',
|
$this->metaDate = ['interest_date', 'book_date', 'process_date', 'due_date', 'payment_date',
|
||||||
'invoice_date',];
|
'invoice_date', ];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setData(array $data): void
|
public function setData(array $data): void
|
||||||
@ -111,7 +111,7 @@ class JournalUpdateService
|
|||||||
|
|
||||||
public function setTransactionGroup(TransactionGroup $transactionGroup): void
|
public function setTransactionGroup(TransactionGroup $transactionGroup): void
|
||||||
{
|
{
|
||||||
$this->transactionGroup = $transactionGroup;
|
$this->transactionGroup = $transactionGroup;
|
||||||
$this->billRepository->setUser($transactionGroup->user);
|
$this->billRepository->setUser($transactionGroup->user);
|
||||||
$this->categoryRepository->setUser($transactionGroup->user);
|
$this->categoryRepository->setUser($transactionGroup->user);
|
||||||
$this->budgetRepository->setUser($transactionGroup->user);
|
$this->budgetRepository->setUser($transactionGroup->user);
|
||||||
@ -179,8 +179,8 @@ class JournalUpdateService
|
|||||||
private function hasValidSourceAccount(): bool
|
private function hasValidSourceAccount(): bool
|
||||||
{
|
{
|
||||||
app('log')->debug('Now in hasValidSourceAccount().');
|
app('log')->debug('Now in hasValidSourceAccount().');
|
||||||
$sourceId = $this->data['source_id'] ?? null;
|
$sourceId = $this->data['source_id'] ?? null;
|
||||||
$sourceName = $this->data['source_name'] ?? null;
|
$sourceName = $this->data['source_name'] ?? null;
|
||||||
|
|
||||||
if (!$this->hasFields(['source_id', 'source_name'])) {
|
if (!$this->hasFields(['source_id', 'source_name'])) {
|
||||||
$origSourceAccount = $this->getOriginalSourceAccount();
|
$origSourceAccount = $this->getOriginalSourceAccount();
|
||||||
@ -194,11 +194,11 @@ class JournalUpdateService
|
|||||||
|
|
||||||
// make a new validator.
|
// make a new validator.
|
||||||
/** @var AccountValidator $validator */
|
/** @var AccountValidator $validator */
|
||||||
$validator = app(AccountValidator::class);
|
$validator = app(AccountValidator::class);
|
||||||
$validator->setTransactionType($expectedType);
|
$validator->setTransactionType($expectedType);
|
||||||
$validator->setUser($this->transactionJournal->user);
|
$validator->setUser($this->transactionJournal->user);
|
||||||
|
|
||||||
$result = $validator->validateSource(['id' => $sourceId]);
|
$result = $validator->validateSource(['id' => $sourceId]);
|
||||||
app('log')->debug(
|
app('log')->debug(
|
||||||
sprintf('hasValidSourceAccount(%d, "%s") will return %s', $sourceId, $sourceName, var_export($result, true))
|
sprintf('hasValidSourceAccount(%d, "%s") will return %s', $sourceId, $sourceName, var_export($result, true))
|
||||||
);
|
);
|
||||||
@ -264,8 +264,8 @@ class JournalUpdateService
|
|||||||
private function hasValidDestinationAccount(): bool
|
private function hasValidDestinationAccount(): bool
|
||||||
{
|
{
|
||||||
app('log')->debug('Now in hasValidDestinationAccount().');
|
app('log')->debug('Now in hasValidDestinationAccount().');
|
||||||
$destId = $this->data['destination_id'] ?? null;
|
$destId = $this->data['destination_id'] ?? null;
|
||||||
$destName = $this->data['destination_name'] ?? null;
|
$destName = $this->data['destination_name'] ?? null;
|
||||||
|
|
||||||
if (!$this->hasFields(['destination_id', 'destination_name'])) {
|
if (!$this->hasFields(['destination_id', 'destination_name'])) {
|
||||||
app('log')->debug('No destination info submitted, grab the original data.');
|
app('log')->debug('No destination info submitted, grab the original data.');
|
||||||
@ -275,12 +275,12 @@ class JournalUpdateService
|
|||||||
}
|
}
|
||||||
|
|
||||||
// make new account validator.
|
// make new account validator.
|
||||||
$expectedType = $this->getExpectedType();
|
$expectedType = $this->getExpectedType();
|
||||||
app('log')->debug(sprintf('(b) Expected type (new or unchanged) is %s', $expectedType));
|
app('log')->debug(sprintf('(b) Expected type (new or unchanged) is %s', $expectedType));
|
||||||
|
|
||||||
// make a new validator.
|
// make a new validator.
|
||||||
/** @var AccountValidator $validator */
|
/** @var AccountValidator $validator */
|
||||||
$validator = app(AccountValidator::class);
|
$validator = app(AccountValidator::class);
|
||||||
$validator->setTransactionType($expectedType);
|
$validator->setTransactionType($expectedType);
|
||||||
$validator->setUser($this->transactionJournal->user);
|
$validator->setUser($this->transactionJournal->user);
|
||||||
$validator->source = $this->getValidSourceAccount();
|
$validator->source = $this->getValidSourceAccount();
|
||||||
@ -333,7 +333,7 @@ class JournalUpdateService
|
|||||||
return $this->getOriginalSourceAccount();
|
return $this->getOriginalSourceAccount();
|
||||||
}
|
}
|
||||||
|
|
||||||
$sourceInfo = [
|
$sourceInfo = [
|
||||||
'id' => (int) ($this->data['source_id'] ?? null),
|
'id' => (int) ($this->data['source_id'] ?? null),
|
||||||
'name' => $this->data['source_name'] ?? null,
|
'name' => $this->data['source_name'] ?? null,
|
||||||
'iban' => $this->data['source_iban'] ?? null,
|
'iban' => $this->data['source_iban'] ?? null,
|
||||||
@ -361,8 +361,8 @@ class JournalUpdateService
|
|||||||
*/
|
*/
|
||||||
private function updateAccounts(): void
|
private function updateAccounts(): void
|
||||||
{
|
{
|
||||||
$source = $this->getValidSourceAccount();
|
$source = $this->getValidSourceAccount();
|
||||||
$destination = $this->getValidDestinationAccount();
|
$destination = $this->getValidDestinationAccount();
|
||||||
|
|
||||||
// cowardly refuse to update if both accounts are the same.
|
// cowardly refuse to update if both accounts are the same.
|
||||||
if ($source->id === $destination->id) {
|
if ($source->id === $destination->id) {
|
||||||
@ -375,7 +375,7 @@ class JournalUpdateService
|
|||||||
$origSourceTransaction->account()->associate($source);
|
$origSourceTransaction->account()->associate($source);
|
||||||
$origSourceTransaction->save();
|
$origSourceTransaction->save();
|
||||||
|
|
||||||
$destTransaction = $this->getDestinationTransaction();
|
$destTransaction = $this->getDestinationTransaction();
|
||||||
$destTransaction->account()->associate($destination);
|
$destTransaction->account()->associate($destination);
|
||||||
$destTransaction->save();
|
$destTransaction->save();
|
||||||
|
|
||||||
@ -397,7 +397,7 @@ class JournalUpdateService
|
|||||||
return $this->getOriginalDestinationAccount();
|
return $this->getOriginalDestinationAccount();
|
||||||
}
|
}
|
||||||
|
|
||||||
$destInfo = [
|
$destInfo = [
|
||||||
'id' => (int) ($this->data['destination_id'] ?? null),
|
'id' => (int) ($this->data['destination_id'] ?? null),
|
||||||
'name' => $this->data['destination_name'] ?? null,
|
'name' => $this->data['destination_name'] ?? null,
|
||||||
'iban' => $this->data['destination_iban'] ?? null,
|
'iban' => $this->data['destination_iban'] ?? null,
|
||||||
@ -426,7 +426,7 @@ class JournalUpdateService
|
|||||||
{
|
{
|
||||||
app('log')->debug('Now in updateType()');
|
app('log')->debug('Now in updateType()');
|
||||||
if ($this->hasFields(['type'])) {
|
if ($this->hasFields(['type'])) {
|
||||||
$type = 'opening-balance' === $this->data['type'] ? 'opening balance' : $this->data['type'];
|
$type = 'opening-balance' === $this->data['type'] ? 'opening balance' : $this->data['type'];
|
||||||
app('log')->debug(
|
app('log')->debug(
|
||||||
sprintf(
|
sprintf(
|
||||||
'Trying to change journal #%d from a %s to a %s.',
|
'Trying to change journal #%d from a %s to a %s.',
|
||||||
@ -459,9 +459,9 @@ class JournalUpdateService
|
|||||||
{
|
{
|
||||||
$type = $this->transactionJournal->transactionType->type;
|
$type = $this->transactionJournal->transactionType->type;
|
||||||
if ((
|
if ((
|
||||||
array_key_exists('bill_id', $this->data)
|
array_key_exists('bill_id', $this->data)
|
||||||
|| array_key_exists('bill_name', $this->data)
|
|| array_key_exists('bill_name', $this->data)
|
||||||
)
|
)
|
||||||
&& TransactionType::WITHDRAWAL === $type
|
&& TransactionType::WITHDRAWAL === $type
|
||||||
) {
|
) {
|
||||||
$billId = (int) ($this->data['bill_id'] ?? 0);
|
$billId = (int) ($this->data['bill_id'] ?? 0);
|
||||||
@ -478,7 +478,7 @@ class JournalUpdateService
|
|||||||
private function updateField(string $fieldName): void
|
private function updateField(string $fieldName): void
|
||||||
{
|
{
|
||||||
if (array_key_exists($fieldName, $this->data) && '' !== (string) $this->data[$fieldName]) {
|
if (array_key_exists($fieldName, $this->data) && '' !== (string) $this->data[$fieldName]) {
|
||||||
$value = $this->data[$fieldName];
|
$value = $this->data[$fieldName];
|
||||||
|
|
||||||
if ('date' === $fieldName) {
|
if ('date' === $fieldName) {
|
||||||
if ($value instanceof Carbon) {
|
if ($value instanceof Carbon) {
|
||||||
@ -580,7 +580,7 @@ class JournalUpdateService
|
|||||||
if ($this->hasFields([$field])) {
|
if ($this->hasFields([$field])) {
|
||||||
$value = '' === $this->data[$field] ? null : $this->data[$field];
|
$value = '' === $this->data[$field] ? null : $this->data[$field];
|
||||||
app('log')->debug(sprintf('Field "%s" is present ("%s"), try to update it.', $field, $value));
|
app('log')->debug(sprintf('Field "%s" is present ("%s"), try to update it.', $field, $value));
|
||||||
$set = [
|
$set = [
|
||||||
'journal' => $this->transactionJournal,
|
'journal' => $this->transactionJournal,
|
||||||
'name' => $field,
|
'name' => $field,
|
||||||
'data' => $value,
|
'data' => $value,
|
||||||
@ -599,7 +599,7 @@ class JournalUpdateService
|
|||||||
if ($this->hasFields([$field])) {
|
if ($this->hasFields([$field])) {
|
||||||
try {
|
try {
|
||||||
$value = '' === (string) $this->data[$field] ? null : new Carbon($this->data[$field]);
|
$value = '' === (string) $this->data[$field] ? null : new Carbon($this->data[$field]);
|
||||||
} catch (InvalidDateException | InvalidFormatException $e) { // @phpstan-ignore-line
|
} catch (InvalidDateException|InvalidFormatException $e) { // @phpstan-ignore-line
|
||||||
app('log')->debug(sprintf('%s is not a valid date value: %s', $this->data[$field], $e->getMessage()));
|
app('log')->debug(sprintf('%s is not a valid date value: %s', $this->data[$field], $e->getMessage()));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -628,19 +628,19 @@ class JournalUpdateService
|
|||||||
if (!$this->hasFields(['currency_id', 'currency_code'])) {
|
if (!$this->hasFields(['currency_id', 'currency_code'])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$currencyId = $this->data['currency_id'] ?? null;
|
$currencyId = $this->data['currency_id'] ?? null;
|
||||||
$currencyCode = $this->data['currency_code'] ?? null;
|
$currencyCode = $this->data['currency_code'] ?? null;
|
||||||
$currency = $this->currencyRepository->findCurrency($currencyId, $currencyCode);
|
$currency = $this->currencyRepository->findCurrency($currencyId, $currencyCode);
|
||||||
// update currency everywhere.
|
// update currency everywhere.
|
||||||
$this->transactionJournal->transaction_currency_id = $currency->id;
|
$this->transactionJournal->transaction_currency_id = $currency->id;
|
||||||
$this->transactionJournal->save();
|
$this->transactionJournal->save();
|
||||||
|
|
||||||
$source = $this->getSourceTransaction();
|
$source = $this->getSourceTransaction();
|
||||||
$source->transaction_currency_id = $currency->id;
|
$source->transaction_currency_id = $currency->id;
|
||||||
$source->save();
|
$source->save();
|
||||||
|
|
||||||
$dest = $this->getDestinationTransaction();
|
$dest = $this->getDestinationTransaction();
|
||||||
$dest->transaction_currency_id = $currency->id;
|
$dest->transaction_currency_id = $currency->id;
|
||||||
$dest->save();
|
$dest->save();
|
||||||
|
|
||||||
// refresh transactions.
|
// refresh transactions.
|
||||||
@ -656,7 +656,7 @@ class JournalUpdateService
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$value = $this->data['amount'] ?? '';
|
$value = $this->data['amount'] ?? '';
|
||||||
app('log')->debug(sprintf('Amount is now "%s"', $value));
|
app('log')->debug(sprintf('Amount is now "%s"', $value));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -671,9 +671,9 @@ class JournalUpdateService
|
|||||||
$origSourceTransaction->amount = app('steam')->negative($amount);
|
$origSourceTransaction->amount = app('steam')->negative($amount);
|
||||||
$origSourceTransaction->balance_dirty = true;
|
$origSourceTransaction->balance_dirty = true;
|
||||||
$origSourceTransaction->save();
|
$origSourceTransaction->save();
|
||||||
$destTransaction = $this->getDestinationTransaction();
|
$destTransaction = $this->getDestinationTransaction();
|
||||||
$destTransaction->amount = app('steam')->positive($amount);
|
$destTransaction->amount = app('steam')->positive($amount);
|
||||||
$destTransaction->balance_dirty = true;
|
$destTransaction->balance_dirty = true;
|
||||||
$destTransaction->save();
|
$destTransaction->save();
|
||||||
// refresh transactions.
|
// refresh transactions.
|
||||||
$this->sourceTransaction->refresh();
|
$this->sourceTransaction->refresh();
|
||||||
@ -749,8 +749,8 @@ class JournalUpdateService
|
|||||||
$source->foreign_amount = null;
|
$source->foreign_amount = null;
|
||||||
$source->save();
|
$source->save();
|
||||||
|
|
||||||
$dest->foreign_currency_id = null;
|
$dest->foreign_currency_id = null;
|
||||||
$dest->foreign_amount = null;
|
$dest->foreign_amount = null;
|
||||||
$dest->save();
|
$dest->save();
|
||||||
app('log')->debug(sprintf('Foreign amount is "%s" so remove foreign amount info.', $amount));
|
app('log')->debug(sprintf('Foreign amount is "%s" so remove foreign amount info.', $amount));
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Support\Http\Api;
|
namespace FireflyIII\Support\Http\Api;
|
||||||
|
|
||||||
|
use FireflyIII\Enums\AccountTypeEnum;
|
||||||
use FireflyIII\Models\AccountType;
|
use FireflyIII\Models\AccountType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -32,7 +33,7 @@ trait AccountFilter
|
|||||||
{
|
{
|
||||||
protected array $types = [
|
protected array $types = [
|
||||||
'all' => [
|
'all' => [
|
||||||
AccountType::DEFAULT,
|
AccountTypeEnum::DEFAULT->value,
|
||||||
AccountType::CASH,
|
AccountType::CASH,
|
||||||
AccountType::ASSET,
|
AccountType::ASSET,
|
||||||
AccountType::EXPENSE,
|
AccountType::EXPENSE,
|
||||||
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Support\Http\Controllers;
|
namespace FireflyIII\Support\Http\Controllers;
|
||||||
|
|
||||||
|
use FireflyIII\Enums\AccountTypeEnum;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Models\AccountType;
|
use FireflyIII\Models\AccountType;
|
||||||
use FireflyIII\Models\Bill;
|
use FireflyIII\Models\Bill;
|
||||||
@ -84,9 +85,9 @@ trait ModelInformation
|
|||||||
/** @var AccountType $mortgage */
|
/** @var AccountType $mortgage */
|
||||||
$mortgage = $repository->getAccountTypeByType(AccountType::MORTGAGE);
|
$mortgage = $repository->getAccountTypeByType(AccountType::MORTGAGE);
|
||||||
$liabilityTypes = [
|
$liabilityTypes = [
|
||||||
$debt->id => (string)trans(sprintf('firefly.account_type_%s', AccountType::DEBT)),
|
$debt->id => (string)trans(sprintf('firefly.account_type_%s', AccountTypeEnum::DEBT->value)),
|
||||||
$loan->id => (string)trans(sprintf('firefly.account_type_%s', AccountType::LOAN)),
|
$loan->id => (string)trans(sprintf('firefly.account_type_%s', AccountTypeEnum::LOAN->value)),
|
||||||
$mortgage->id => (string)trans(sprintf('firefly.account_type_%s', AccountType::MORTGAGE)),
|
$mortgage->id => (string)trans(sprintf('firefly.account_type_%s', AccountTypeEnum::MORTGAGE->value)),
|
||||||
];
|
];
|
||||||
asort($liabilityTypes);
|
asort($liabilityTypes);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user