mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-05-05 13:43:36 +00:00
Replace enum
This commit is contained in:
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Services\Internal\Support;
|
||||
|
||||
use FireflyIII\Enums\AccountTypeEnum;
|
||||
use FireflyIII\Enums\TransactionTypeEnum;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Factory\AccountMetaFactory;
|
||||
@@ -258,7 +259,7 @@ trait JournalServiceTrait
|
||||
}
|
||||
if (null === $account) {
|
||||
// final attempt, create it.
|
||||
if (AccountType::ASSET === $preferredType) {
|
||||
if (AccountTypeEnum::ASSET->value === $preferredType) {
|
||||
throw new FireflyException(sprintf('TransactionFactory: Cannot create asset account with these values: %s', json_encode($data)));
|
||||
}
|
||||
// fix name of account if only IBAN is given:
|
||||
@@ -312,7 +313,7 @@ trait JournalServiceTrait
|
||||
{
|
||||
// return cash account.
|
||||
if (null === $account && '' === (string) $data['name']
|
||||
&& in_array(AccountType::CASH, $types, true)) {
|
||||
&& in_array(AccountTypeEnum::CASH->value, $types, true)) {
|
||||
$account = $this->accountRepository->getCashAccount();
|
||||
}
|
||||
app('log')->debug('Cannot return cash account, return input instead.');
|
||||
|
||||
Reference in New Issue
Block a user