This commit is contained in:
James Cole
2020-07-11 15:13:15 +02:00
parent 86600d4fcf
commit 54d92f5b39
20 changed files with 737 additions and 205 deletions

View File

@@ -96,6 +96,16 @@ class JournalDestroyService
$journal->piggyBankEvents()->update(['transaction_journal_id' => null]);
$journal->delete();
// delete group, if group is empty:
$group = $journal->transactionGroup;
if (null !== $group) {
$count = $group->transactionJournals->count();
if (0 === $count) {
$group->delete();
}
}
} catch (Exception $e) {
Log::error(sprintf('Could not delete bill: %s', $e->getMessage())); // @codeCoverageIgnore
}