Skip to content

Commit 350548b

Browse files
committed
Fix delete cascades for inbox rules and process requests
1 parent 642b34f commit 350548b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

ProcessMaker/Http/Controllers/Api/Actions/Cases/DeleteCase.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ private function deleteProcessRequests(array $requestIds): void
115115

116116
ProcessRequest::query()
117117
->whereIn('id', $requestIds)
118+
->get()
119+
->each
118120
->delete();
119121
}
120122

@@ -176,6 +178,8 @@ private function deleteInboxRules(array $tokenIds): void
176178

177179
InboxRule::query()
178180
->whereIn('process_request_token_id', $tokenIds)
181+
->get()
182+
->each
179183
->delete();
180184
}
181185

ProcessMaker/Models/InboxRule.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ class InboxRule extends ProcessMakerModel
3535
protected static function booted()
3636
{
3737
static::deleting(function (InboxRule $inboxRule) {
38-
$inboxRule->savedSearch()->delete();
38+
if (class_exists(SavedSearch::class)) {
39+
$inboxRule->savedSearch()->delete();
40+
}
3941
});
4042
}
4143

0 commit comments

Comments
 (0)