mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Replace enum
This commit is contained in:
@@ -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\TransactionJournal;
|
||||
@@ -118,8 +119,8 @@ class UpgradesLiabilitiesEight extends Command
|
||||
|
||||
private function hasBadOpening(Account $account): bool
|
||||
{
|
||||
$openingBalanceType = TransactionType::whereType(TransactionType::OPENING_BALANCE)->first();
|
||||
$liabilityType = TransactionType::whereType(TransactionType::LIABILITY_CREDIT)->first();
|
||||
$openingBalanceType = TransactionType::whereType(TransactionTypeEnum::OPENING_BALANCE->value)->first();
|
||||
$liabilityType = TransactionType::whereType(TransactionTypeEnum::LIABILITY_CREDIT->value)->first();
|
||||
$openingJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->where('transactions.account_id', $account->id)
|
||||
->where('transaction_journals.transaction_type_id', $openingBalanceType->id)
|
||||
@@ -145,7 +146,7 @@ class UpgradesLiabilitiesEight extends Command
|
||||
|
||||
private function deleteCreditTransaction(Account $account): void
|
||||
{
|
||||
$liabilityType = TransactionType::whereType(TransactionType::LIABILITY_CREDIT)->first();
|
||||
$liabilityType = TransactionType::whereType(TransactionTypeEnum::LIABILITY_CREDIT->value)->first();
|
||||
$liabilityJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->where('transactions.account_id', $account->id)
|
||||
->where('transaction_journals.transaction_type_id', $liabilityType->id)
|
||||
@@ -162,7 +163,7 @@ class UpgradesLiabilitiesEight extends Command
|
||||
|
||||
private function reverseOpeningBalance(Account $account): void
|
||||
{
|
||||
$openingBalanceType = TransactionType::whereType(TransactionType::OPENING_BALANCE)->first();
|
||||
$openingBalanceType = TransactionType::whereType(TransactionTypeEnum::OPENING_BALANCE->value)->first();
|
||||
|
||||
/** @var TransactionJournal $openingJournal */
|
||||
$openingJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
|
@@ -104,7 +104,7 @@ class UpgradesVariousCurrencyInformation extends Command
|
||||
private function updateOtherJournalsCurrencies(): void
|
||||
{
|
||||
$set = $this->cliRepos->getAllJournals(
|
||||
[TransactionTypeEnum::WITHDRAWAL->value, TransactionTypeEnum::DEPOSIT->value, TransactionType::OPENING_BALANCE, TransactionType::RECONCILIATION]
|
||||
[TransactionTypeEnum::WITHDRAWAL->value, TransactionTypeEnum::DEPOSIT->value, TransactionTypeEnum::OPENING_BALANCE->value, TransactionTypeEnum::RECONCILIATION->value]
|
||||
);
|
||||
|
||||
/** @var TransactionJournal $journal */
|
||||
@@ -191,7 +191,7 @@ class UpgradesVariousCurrencyInformation extends Command
|
||||
|
||||
break;
|
||||
|
||||
case TransactionType::OPENING_BALANCE:
|
||||
case TransactionTypeEnum::OPENING_BALANCE->value:
|
||||
// whichever isn't an initial balance account:
|
||||
$lead = $journal->transactions()->leftJoin('accounts', 'transactions.account_id', '=', 'accounts.id')->leftJoin(
|
||||
'account_types',
|
||||
@@ -202,7 +202,7 @@ class UpgradesVariousCurrencyInformation extends Command
|
||||
|
||||
break;
|
||||
|
||||
case TransactionType::RECONCILIATION:
|
||||
case TransactionTypeEnum::RECONCILIATION->value:
|
||||
// whichever isn't the reconciliation account:
|
||||
$lead = $journal->transactions()->leftJoin('accounts', 'transactions.account_id', '=', 'accounts.id')->leftJoin(
|
||||
'account_types',
|
||||
|
Reference in New Issue
Block a user