Skip to main content
Version: Latest
Technical ManualLooking for step-by-step instructions? In the User Manual: Ask for Approval Before Work Starts

Approvals

The Ticket Approvals feature (CrestApps.OrchardCore.Tickets.Approvals) lets a ticket type ask for approval before work goes on, such as a manager's and then finance's for new equipment. On the type's Ticket part settings, Approval has up to three steps (TicketApprovalSettings): each a name, approvers chosen with the user picker, and The requester's manager (the user of the manager on the requester's staff record, with Staff on, through ITicketRequesterManagerSource); and Status while waiting, a waiting or on-hold status such as Waiting for approval (the first waiting status when none is chosen).

When a ticket of that type is created, TicketApprovalStarter resolves each step's approvers (a step left with none is skipped) and ITicketService.StartApprovalAsync keeps the approval on the ticket (TicketPart.Approval), moves it to the waiting status and tells observers (ITicketObserver.ApprovalRequestedAsync). Each approver of the step is told, with a link to the approval page, Admin/ticket/{id}/approval: what was asked (subject, requester, first message) and the steps, for the approvers of its steps even when they can't see the ticket otherwise. Agents see the same steps in the ticket's Approval panel.

One approver of the step decides it (ITicketService.DecideApprovalAsync; anyone else is refused). An approval moves to the next step and tells its approvers; after the last, the ticket goes back to the status it had (or the first open status when it can't go back, as from New). A refusal needs a reason: the ticket is solved and the requester gets the reason as a reply, which e-mails them like any reply. Every decision is on the timeline; an approver decides a step once. While the ticket waits, nothing else changes its status: the panel, bulk actions, the API, workflows and replies that set a status are refused, and a requester's reply doesn't reopen it. Someone with Cancel ticket approvals (TicketsPermissions.CancelTicketApprovals, administrators by default) can call it off with a reason (ITicketService.CancelApprovalAsync), which sends the ticket back to work. A step with no approver (a requester's manager for a guest, or a person without one) is skipped and named on the timeline; when no step has an approver the ticket isn't held and an internal note says why. Approval steps are the Tickets module's own; another module that needs approval steps extracts them first.