Fixed when contract is archived all active field jobs for contract are cancaled
This commit is contained in:
@@ -36,6 +36,14 @@ public function handle(DecisionEventContext $context, array $config = []): void
|
||||
$setting->reactivate = (bool) $config['reactivate'];
|
||||
}
|
||||
|
||||
// Cancel all active FieldJobs for this contract before archiving (raw update to avoid boot-event side effects)
|
||||
\DB::table('field_jobs')
|
||||
->where('contract_id', $contractId)
|
||||
->whereNull('completed_at')
|
||||
->whereNull('cancelled_at')
|
||||
->whereNull('deleted_at')
|
||||
->update(['cancelled_at' => now(), 'updated_at' => now()]);
|
||||
|
||||
$results = app(ArchiveExecutor::class)->executeSetting(
|
||||
$setting,
|
||||
['contract_id' => $contractId],
|
||||
|
||||
Reference in New Issue
Block a user