Add imports for facades

This commit is contained in:
James Cole
2025-02-23 12:47:04 +01:00
parent 0086a0ddc8
commit f7ad9c56c8
43 changed files with 132 additions and 94 deletions

View File

@@ -36,6 +36,7 @@ use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use Illuminate\Support\Facades\DB;
/**
* Class ConvertToWithdrawal
@@ -148,14 +149,14 @@ class ConvertToWithdrawal implements ActionInterface
app('log')->debug(sprintf('ConvertToWithdrawal. Action value is "%s", expense name is "%s"', $actionValue, $opposingName));
// update source transaction(s) to be the original destination account
\DB::table('transactions')
DB::table('transactions')
->where('transaction_journal_id', '=', $journal->id)
->where('amount', '<', 0)
->update(['account_id' => $destAccount->id])
;
// update destination transaction(s) to be new expense account.
\DB::table('transactions')
DB::table('transactions')
->where('transaction_journal_id', '=', $journal->id)
->where('amount', '>', 0)
->update(['account_id' => $opposingAccount->id])
@@ -163,7 +164,7 @@ class ConvertToWithdrawal implements ActionInterface
// change transaction type of journal:
$newType = TransactionType::whereType(TransactionTypeEnum::WITHDRAWAL->value)->first();
\DB::table('transaction_journals')
DB::table('transaction_journals')
->where('id', '=', $journal->id)
->update(['transaction_type_id' => $newType->id])
;
@@ -234,7 +235,7 @@ class ConvertToWithdrawal implements ActionInterface
app('log')->debug(sprintf('ConvertToWithdrawal. Action value is "%s", destination name is "%s"', $actionValue, $opposingName));
// update destination transaction(s) to be new expense account.
\DB::table('transactions')
DB::table('transactions')
->where('transaction_journal_id', '=', $journal->id)
->where('amount', '>', 0)
->update(['account_id' => $opposingAccount->id])
@@ -242,7 +243,7 @@ class ConvertToWithdrawal implements ActionInterface
// change transaction type of journal:
$newType = TransactionType::whereType(TransactionTypeEnum::WITHDRAWAL->value)->first();
\DB::table('transaction_journals')
DB::table('transaction_journals')
->where('id', '=', $journal->id)
->update(['transaction_type_id' => $newType->id])
;