Replace enum

This commit is contained in:
James Cole
2025-01-03 09:05:56 +01:00
parent 44eafeeae5
commit d009ce31ca
36 changed files with 85 additions and 77 deletions

View File

@@ -246,7 +246,7 @@ class CorrectsAccountTypes extends Command
private function shouldBeTransfer(string $transactionType, string $sourceType, string $destinationType): bool
{
return TransactionType::TRANSFER === $transactionType && AccountType::ASSET === $sourceType && $this->isLiability($destinationType);
return TransactionTypeEnum::TRANSFER->value === $transactionType && AccountType::ASSET === $sourceType && $this->isLiability($destinationType);
}
private function isLiability(string $destinationType): bool
@@ -269,7 +269,7 @@ class CorrectsAccountTypes extends Command
private function shouldBeDeposit(string $transactionType, string $sourceType, string $destinationType): bool
{
return TransactionType::TRANSFER === $transactionType && $this->isLiability($sourceType) && AccountType::ASSET === $destinationType;
return TransactionTypeEnum::TRANSFER->value === $transactionType && $this->isLiability($sourceType) && AccountType::ASSET === $destinationType;
}
private function makeDeposit(TransactionJournal $journal): void

View File

@@ -84,7 +84,7 @@ class CorrectsUnevenAmount extends Command
continue;
}
// needs to be a transfer.
if (TransactionType::TRANSFER !== $journal->transactionType->type) {
if (TransactionTypeEnum::TRANSFER->value !== $journal->transactionType->type) {
Log::debug('Must be a transfer, continue.');
continue;
@@ -228,7 +228,7 @@ class CorrectsUnevenAmount extends Command
private function isForeignCurrencyTransfer(TransactionJournal $journal): bool
{
if (TransactionType::TRANSFER !== $journal->transactionType->type) {
if (TransactionTypeEnum::TRANSFER->value !== $journal->transactionType->type) {
return false;
}

View File

@@ -25,6 +25,7 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use FireflyIII\Enums\TransactionTypeEnum;
use FireflyIII\Models\Account;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionCurrency;
@@ -122,7 +123,7 @@ class UpgradesTransferCurrencies extends Command
*/
private function startUpdateRoutine(): void
{
$set = $this->cliRepos->getAllJournals([TransactionType::TRANSFER]);
$set = $this->cliRepos->getAllJournals([TransactionTypeEnum::TRANSFER->value]);
/** @var TransactionJournal $journal */
foreach ($set as $journal) {