From 34e006d87b998a496c6a957e1c41f2e416b8539e Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 3 Jul 2022 08:24:04 +0200 Subject: [PATCH] Also update orphans. --- .../Commands/Correction/DeleteOrphanedTransactions.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/Correction/DeleteOrphanedTransactions.php b/app/Console/Commands/Correction/DeleteOrphanedTransactions.php index 0f720ad819..c20178e092 100644 --- a/app/Console/Commands/Correction/DeleteOrphanedTransactions.php +++ b/app/Console/Commands/Correction/DeleteOrphanedTransactions.php @@ -152,7 +152,12 @@ class DeleteOrphanedTransactions extends Command $this->info('No orphaned journals.'); } if($count > 0) { - $this->info('Found %d orphaned journal(s).', $count); + $this->info(sprintf('Found %d orphaned journal(s).', $count)); + TransactionJournal + ::leftJoin('transaction_groups', 'transaction_journals.transaction_group_id', 'transaction_groups.id') + ->whereNotNull('transaction_groups.deleted_at') + ->whereNull('transaction_journals.deleted_at') + ->update(['transaction_journals.deleted_at', now()]); } } }