mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-22 20:16:22 +00:00
Replace enum
This commit is contained in:
@@ -343,7 +343,7 @@ class CreditRecalculateService
|
||||
}
|
||||
|
||||
// in any other case, remove amount from left of debt.
|
||||
if (in_array($type, [TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::TRANSFER], true)) {
|
||||
if (in_array($type, [TransactionTypeEnum::WITHDRAWAL->value, TransactionType::DEPOSIT, TransactionType::TRANSFER], true)) {
|
||||
$usedAmount = app('steam')->negative($usedAmount);
|
||||
|
||||
return bcadd($leftOfDebt, $usedAmount);
|
||||
@@ -380,7 +380,7 @@ class CreditRecalculateService
|
||||
*/
|
||||
private function isWithdrawalIn(string $amount, string $transactionType): bool
|
||||
{
|
||||
return TransactionType::WITHDRAWAL === $transactionType && 1 === bccomp($amount, '0');
|
||||
return TransactionTypeEnum::WITHDRAWAL->value === $transactionType && 1 === bccomp($amount, '0');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -396,7 +396,7 @@ class CreditRecalculateService
|
||||
*/
|
||||
private function isWithdrawalOut(string $amount, string $transactionType): bool
|
||||
{
|
||||
return TransactionType::WITHDRAWAL === $transactionType && -1 === bccomp($amount, '0');
|
||||
return TransactionTypeEnum::WITHDRAWAL->value === $transactionType && -1 === bccomp($amount, '0');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Services\Internal\Support;
|
||||
|
||||
use FireflyIII\Enums\TransactionTypeEnum;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Factory\AccountMetaFactory;
|
||||
use FireflyIII\Factory\TagFactory;
|
||||
@@ -359,7 +360,7 @@ trait JournalServiceTrait
|
||||
|
||||
protected function storeBudget(TransactionJournal $journal, NullArrayObject $data): void
|
||||
{
|
||||
if (TransactionType::WITHDRAWAL !== $journal->transactionType->type) {
|
||||
if (TransactionTypeEnum::WITHDRAWAL->value !== $journal->transactionType->type) {
|
||||
$journal->budgets()->sync([]);
|
||||
|
||||
return;
|
||||
|
Reference in New Issue
Block a user