SimpleDesk API
Procedural File: SimpleDesk-Assign.php
Source Location: /source/SimpleDesk-Assign.phpThis file handles ticket assignments, both the user interface for the assignment page, plus actually assigning users to tickets. There are also helper functions here for that purpose.
Tags:
- since
- 1.0
Contains the following functions:
shd_assign [line 51]
void shd_assign (
)
Sets up the assignment UI and invokes the template.
This validates that the user can see the ticket in question initially, before determining the level of assignment that can be carried out.
Users who can assign any ticket cause a query to trigger to identify users who have shd_staff permission (and thus can be the target of assignment) and the template is loaded with a dropdown to provide this choice to the user.
Users who can only assign to themselves will at this point have the ticket assigned to them if it was unassigned before, or unassigned from them if they are able to assign tickets to themselves in the first place; if it was assigned to someone else, they will not have the option.
Access through action=helpdesk;sa=assign;ticket=x;sessvar=sessid before redirecting back to the ticket, or add ;home to the URL to have it redirect back to the home page (passed through to the form for shd_assign2()'s use too)
Tags:
- see
- shd_assign2()
- see
- shd_get_possible_assignees()
- since
- 1.0
Return value
This function has no return value.shd_assign2 [line 168]
void shd_assign2 (
)
Handles the actual assignment form, validates it and carries it out.
Primarily this is just about receiving the form, making the same checks that shd_assign() does and then logging the action before passing over to shd_commit_assignment() to actually assign the ticket.
Tags:
- see
- shd_assign()
- see
- shd_commit_assignment()
- since
- 1.0
Return value
This function has no return value.shd_commit_assignment [line 278]
void shd_commit_assignment (
int $ticket, int $assignment )
Actually commits a ticket assignment to the database.
This function sets up the relevant options before handing over to shd_modify_ticket_post() which is the preferred way to modify tickets generally. No permissions check is performed here.
Relies on $context['shd_return_to'] to have been set, defaults to 'ticket' to return to ticket, otherwise return to home page on value of 'home'.
Tags:
- see
- shd_assign2()
- see
- shd_assign()
Parameters
- int $ticket
- Ticket id number, assumed to exist.
- int $assignment
- User id of the user to which this ticket will be assigned; can be 0 to unassign a ticket
Return value
This function has no return value.shd_get_possible_assignees [line 317]
array shd_get_possible_assignees (
[bool $private = false], [int $ticket_owner = 0] )
Return a list of possible users that can be assigned a ticket.
This function centralises who a ticket can be assigned to. Currently this is:
- user with shd_staff permission
- can see "any" ticket (not just their own)
- additionally, if the ticket is private, the user must also be able to see 'any' private ticket.
- additionally, check whether user is staff + ticket starter, and then whether we should block them from being assigned
- (since 1.1) additionally if we have set the option, which users are true admins, and if so, remove them from the list too
Tags:
- see
- shd_assign()
- see
- shd_assign2()
- since
- 1.0
Parameters
- bool $private
- Whether the ticket in question is private or not.
- int $ticket_owner
- User id of the ticket owner



