mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-12 01:42:32 +00:00
Various code cleanup.
This commit is contained in:
@@ -81,7 +81,7 @@ class AccountDestroyService
|
||||
->where('transaction_types.type', TransactionType::OPENING_BALANCE)
|
||||
->get(['transactions.transaction_journal_id']);
|
||||
if ($set->count() > 0) {
|
||||
$journalId = (int)$set->first()->transaction_journal_id;
|
||||
$journalId = $set->first()->transaction_journal_id;
|
||||
app('log')->debug(sprintf('Found opening balance journal with ID #%d', $journalId));
|
||||
|
||||
// get transactions with this journal (should be just one):
|
||||
@@ -129,7 +129,7 @@ class AccountDestroyService
|
||||
/** @var stdClass $row */
|
||||
foreach ($collection as $row) {
|
||||
if ((int)$row->the_count > 1) {
|
||||
$journalId = (int)$row->transaction_journal_id;
|
||||
$journalId = $row->transaction_journal_id;
|
||||
$journal = $user->transactionJournals()->find($journalId);
|
||||
if (null !== $journal) {
|
||||
app('log')->debug(sprintf('Deleted journal #%d because it has the same source as destination.', $journal->id));
|
||||
|
||||
@@ -46,10 +46,10 @@ class BudgetDestroyService
|
||||
}
|
||||
|
||||
// also delete all relations between categories and transaction journals:
|
||||
DB::table('budget_transaction_journal')->where('budget_id', (int)$budget->id)->delete();
|
||||
DB::table('budget_transaction_journal')->where('budget_id', $budget->id)->delete();
|
||||
|
||||
// also delete all relations between categories and transactions:
|
||||
DB::table('budget_transaction')->where('budget_id', (int)$budget->id)->delete();
|
||||
DB::table('budget_transaction')->where('budget_id', $budget->id)->delete();
|
||||
|
||||
// also delete all budget limits
|
||||
foreach ($budget->budgetlimits()->get() as $limit) {
|
||||
|
||||
@@ -41,10 +41,10 @@ class CategoryDestroyService
|
||||
$category->delete();
|
||||
|
||||
// also delete all relations between categories and transaction journals:
|
||||
DB::table('category_transaction_journal')->where('category_id', (int)$category->id)->delete();
|
||||
DB::table('category_transaction_journal')->where('category_id', $category->id)->delete();
|
||||
|
||||
// also delete all relations between categories and transactions:
|
||||
DB::table('category_transaction')->where('category_id', (int)$category->id)->delete();
|
||||
DB::table('category_transaction')->where('category_id', $category->id)->delete();
|
||||
|
||||
// delete references to category from recurring transactions.
|
||||
DB::table('rt_meta')->where('name', 'category_id')->where('value', $category->id)->delete();
|
||||
|
||||
Reference in New Issue
Block a user