AAuditPro Suite· Jobs manual
Jobs manual Status lifecycle

The state machine

not_started Default in_progress Active completed Report issued archived 7-year vault cancelled (rare; reason required) cancelled

Valid transitions

FromToAllowed?Trigger
not_startedin_progressManual or first task tick (cascade)
in_progresscompletedManager: all phases complete + completion gate green
completedarchivedAuto on archive build, or manual
anycancelled✓ with reasonReason > 50 chars; super_admin/partner only
completedin_progress✗ (rejected)Use unlock-with-reason instead
archivedanyRead-only forever
not_startedcompleted✗ (skip rejected)Must walk in_progress first

Rejection at the service layer means the UI dropdown will simply not show the disallowed option. Direct API calls return 422 with explicit reason.

Post-commit hooks

When a transition succeeds, a chain of side-effects fires after the DB commit (so they can't roll back the transition):

1job.status.changed event
Always fires

Notification to partner + manager + assigned employees per user_notification_preferences.

2in_progress entry hook
First entry only

Stamps actual_start_date if blank. Drives WIP reports.

3completed entry hook
If m11.auto_invoice_on_completion

Auto-drafts a tax invoice using template fee + client T&Cs. Sends notification with deep-link.

4job.completed event
Email template

Internal notification to partner. If client has portal access, email goes out via M17 (template compliance.expiry_reminder or custom).

5archived entry hook
Lock + archive

Triggers VaultBackupService::buildArchive for the engagement; SHA-256 ZIP placed in storage/archives/.

6cancelled hook
Reason captured

All open invoices flagged for review. Audit-log records who, when, why.

Completion gate (the green flag)

Manager cannot transition to completed unless these all pass (audit jobs only — non-audit templates skip):

Failed gates show as red blockers on the Audit Completion screen; transition button is disabled until cleared.

Try this

On a fresh audit job, try transitioning not_started → completed directly via the dropdown. The system rejects with "Invalid transition: must pass through in_progress." Walk through the proper sequence and watch each hook fire in Activity tab.

Watch out

Don't cancel a job to "save" effort. Cancellation is a meaningful event — it triggers invoice review, notifies the partner, and leaves a permanent forensic trail. If the work is just paused, use blocked on the affected tasks instead. cancelled is for "we're not doing this engagement at all" — onboarding fell through, client withdrew, conflict discovered post-acceptance.

Tip — billing policy toggles

Three firm-wide settings control auto-invoicing: m11.auto_invoice_on_completion (default ON), m11.require_job_completion_for_invoice (default OFF — flip ON to block manual invoicing on incomplete jobs), m11.notify_on_completion (default ON). Per-engagement overrides live on the job record.