mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-07 14:41:20 +00:00
Replace various enums
This commit is contained in:
@@ -26,7 +26,6 @@ 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;
|
||||
@@ -146,7 +145,7 @@ class AccountCurrencies extends Command
|
||||
{
|
||||
Log::debug(sprintf('Now in updateCurrenciesForUser(%s, %s)', $user->email, $systemCurrencyCode));
|
||||
$this->accountRepos->setUser($user);
|
||||
$accounts = $this->accountRepos->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
|
||||
$accounts = $this->accountRepos->getAccountsByType([AccountTypeEnum::DEFAULT, AccountTypeEnum::ASSET]);
|
||||
|
||||
// get user's currency preference:
|
||||
$defaultCurrencyCode = app('preferences')->getForUser($user, 'currencyPreference', $systemCurrencyCode)->data;
|
||||
|
||||
@@ -23,6 +23,7 @@ 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;
|
||||
@@ -66,8 +67,8 @@ class CCLiabilities extends Command
|
||||
}
|
||||
|
||||
|
||||
$ccType = AccountType::where('type', AccountType::CREDITCARD)->first();
|
||||
$debtType = AccountType::where('type', AccountType::DEBT)->first();
|
||||
$ccType = AccountType::where('type', AccountTypeEnum::CREDITCARD)->first();
|
||||
$debtType = AccountType::where('type', AccountTypeEnum::DEBT)->first();
|
||||
if (null === $ccType || null === $debtType) {
|
||||
$this->info('No incorrectly stored credit card liabilities.');
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@ 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;
|
||||
@@ -218,23 +220,23 @@ class OtherCurrenciesCorrections extends Command
|
||||
switch ($journal->transactionType->type) {
|
||||
default:
|
||||
break;
|
||||
case TransactionType::WITHDRAWAL:
|
||||
case TransactionTypeEnum::WITHDRAWAL:
|
||||
$lead = $journal->transactions()->where('amount', '<', 0)->first();
|
||||
break;
|
||||
case TransactionType::DEPOSIT:
|
||||
case TransactionTypeEnum::DEPOSIT:
|
||||
$lead = $journal->transactions()->where('amount', '>', 0)->first();
|
||||
break;
|
||||
case TransactionType::OPENING_BALANCE:
|
||||
case TransactionTypeEnum::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', '!=', AccountType::INITIAL_BALANCE)->first(['transactions.*']);
|
||||
)->where('account_types.type', '!=', AccountTypeEnum::INITIAL_BALANCE)->first(['transactions.*']);
|
||||
break;
|
||||
case TransactionType::RECONCILIATION:
|
||||
case TransactionTypeEnum::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', '!=', AccountType::RECONCILIATION)->first(['transactions.*']);
|
||||
)->where('account_types.type', '!=', AccountTypeEnum::RECONCILIATION)->first(['transactions.*']);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user