Revert "Replace various enums"

This reverts commit 089514908d.
This commit is contained in:
James Cole
2022-04-13 16:23:02 +02:00
parent 4a3c2d5d97
commit 71d53fbda4
22 changed files with 69 additions and 87 deletions

View File

@@ -26,6 +26,7 @@ namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountMeta;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
@@ -145,7 +146,7 @@ class AccountCurrencies extends Command
{
Log::debug(sprintf('Now in updateCurrenciesForUser(%s, %s)', $user->email, $systemCurrencyCode));
$this->accountRepos->setUser($user);
$accounts = $this->accountRepos->getAccountsByType([AccountTypeEnum::DEFAULT, AccountTypeEnum::ASSET]);
$accounts = $this->accountRepos->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
// get user's currency preference:
$defaultCurrencyCode = app('preferences')->getForUser($user, 'currencyPreference', $systemCurrencyCode)->data;

View File

@@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Enums\TransactionTypeEnum;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
@@ -67,8 +66,8 @@ class CCLiabilities extends Command
}
$ccType = AccountType::where('type', AccountTypeEnum::CREDITCARD)->first();
$debtType = AccountType::where('type', AccountTypeEnum::DEBT)->first();
$ccType = AccountType::where('type', AccountType::CREDITCARD)->first();
$debtType = AccountType::where('type', AccountType::DEBT)->first();
if (null === $ccType || null === $debtType) {
$this->info('No incorrectly stored credit card liabilities.');

View File

@@ -23,8 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Enums\AccountTypeEnum;
use FireflyIII\Enums\TransactionTypeEnum;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
@@ -220,23 +218,23 @@ class OtherCurrenciesCorrections extends Command
switch ($journal->transactionType->type) {
default:
break;
case TransactionTypeEnum::WITHDRAWAL:
case TransactionType::WITHDRAWAL:
$lead = $journal->transactions()->where('amount', '<', 0)->first();
break;
case TransactionTypeEnum::DEPOSIT:
case TransactionType::DEPOSIT:
$lead = $journal->transactions()->where('amount', '>', 0)->first();
break;
case TransactionTypeEnum::OPENING_BALANCE:
case TransactionType::OPENING_BALANCE:
// whichever isn't an initial balance account:
$lead = $journal->transactions()->leftJoin('accounts', 'transactions.account_id', '=', 'accounts.id')->leftJoin(
'account_types', 'accounts.account_type_id', '=', 'account_types.id'
)->where('account_types.type', '!=', AccountTypeEnum::INITIAL_BALANCE)->first(['transactions.*']);
)->where('account_types.type', '!=', AccountType::INITIAL_BALANCE)->first(['transactions.*']);
break;
case TransactionTypeEnum::RECONCILIATION:
case TransactionType::RECONCILIATION:
// whichever isn't the reconciliation account:
$lead = $journal->transactions()->leftJoin('accounts', 'transactions.account_id', '=', 'accounts.id')->leftJoin(
'account_types', 'accounts.account_type_id', '=', 'account_types.id'
)->where('account_types.type', '!=', AccountTypeEnum::RECONCILIATION)->first(['transactions.*']);
)->where('account_types.type', '!=', AccountType::RECONCILIATION)->first(['transactions.*']);
break;
}