Functions

Add a ticket type.

add_ticket_type(\SHORT_TEXT $ticket_type, \BINARY $guest_emails_mandatory, \BINARY $search_faq) 

Parameters

$ticket_type

\SHORT_TEXT

The ticket type

$guest_emails_mandatory

\BINARY

Whether guest e-mail addresses are mandatory for new tickets

$search_faq

\BINARY

Whether the FAQ should be searched before submitting a new ticket

Remove a ticket from the database.

delete_ticket_by_topic_id(\AUTO_LINK $topic_id) 

This does not remove the associated forum topic.

Parameters

$topic_id

\AUTO_LINK

The associated topic ID

Delete a ticket type.

delete_ticket_type(integer $ticket_type) 

Parameters

$ticket_type

integer

The ticket type

Edit a ticket type, keeping the integer ID the same.

edit_ticket_type(integer $old_ticket_type, \?SHORT_TEXT $new_ticket_type, \BINARY $guest_emails_mandatory, \BINARY $search_faq) 

Parameters

$old_ticket_type

integer

The old ticket type

$new_ticket_type

\?SHORT_TEXT

The new ticket type (NULL: do not change)

$guest_emails_mandatory

\BINARY

Whether guest e-mail addresses are mandatory for new tickets

$search_faq

\BINARY

Whether the FAQ should be searched before submitting a new ticket

Get the forum ID for a given ticket type and member, taking the ticket_member_forums and ticket_type_forums options into account.

get_ticket_forum_id(\?AUTO_LINK $member, \?integer $ticket_type, boolean $create, boolean $silent_error_handling) : \?AUTO_LINK

Parameters

$member

\?AUTO_LINK

The member ID (NULL: no member)

$ticket_type

\?integer

The ticket type (NULL: all ticket types)

$create

boolean

Create the forum if it's missing

$silent_error_handling

boolean

Whether to skip showing errors, returning NULL instead

Returns

\?AUTO_LINKForum ID (NULL: not found)

Get the posts from a given ticket, and also return the IDs of the forum and topic containing it.

get_ticket_posts(string $ticket_id, \AUTO_LINK $forum, \AUTO_LINK $topic_id, integer $ticket_type, integer $start, \?integer $max) : mixed

The return value is the same as that of get_forum_topic_posts(), except in error conditions

Parameters

$ticket_id

string

The ticket ID

$forum

\AUTO_LINK

Return location for the forum ID

$topic_id

\AUTO_LINK

Return location for the topic ID

$ticket_type

integer

Return location for the ticket type

$start

integer

Start offset in pagination

$max

\?integer

Max per page in pagination (NULL: no limit)

Returns

mixedThe array of maps (Each map is: title, message, member, date) (NULL: no such ticket)

Get a map of properties for the given ticket type.

get_ticket_type(\?integer $ticket_type) : \?array

Parameters

$ticket_type

\?integer

The ticket type (NULL: fallback for old tickets)

Returns

\?arrayArray of properties (NULL: ticket type not found)

Get an array of tickets for the given member and ticket type.

get_tickets(\AUTO_LINK $member, \?AUTO_LINK $ticket_type, boolean $override_view_others_tickets, boolean $silent_error_handling) : array

If the member has permission to see others' tickets, it will be a list of all tickets in the system, restricted by ticket type as appropriate. Otherwise, it will be a list of that member's tickets, as restricted by ticket type.

Parameters

$member

\AUTO_LINK

The member ID

$ticket_type

\?AUTO_LINK

The ticket type (NULL: all ticket types)

$override_view_others_tickets

boolean

Don't view others' tickets, even if the member has permission to

$silent_error_handling

boolean

Whether to skip showing errors, returning NULL instead

Returns

arrayArray of tickets, empty on failure

Returns whether the given forum ID is for a ticket forum (subforum of the root ticket forum).

is_ticket_forum(\AUTO_LINK $forum_id) : boolean

Parameters

$forum_id

\AUTO_LINK

The forum ID

Returns

booleanWhether the given forum is a ticket forum

Is the given ticket post intended for staff only? Works only on OCF.

is_ticket_post_staff_only(array $post) : boolean

Parameters

$post

array

Array of data for the post

Returns

booleanWhether the post's staff only

Send an e-mail notification for a new post in a support ticket, either to the staff or to the ticket's owner.

send_ticket_email(string $ticket_id, \LONG_TEXT $title, \LONG_TEXT $post, mixed $ticket_url, string $email, integer $ticket_type_if_new) 

Parameters

$ticket_id

string

The ticket ID

$title

\LONG_TEXT

The ticket title

$post

\LONG_TEXT

The ticket post's content

$ticket_url

mixed

The home URL (to view the ticket) (URLPATH or Tempcode URL)

$email

string

Ticket owner's e-mail address, in the case of a new ticket

$ticket_type_if_new

integer

The new ticket type, or -1 if it is a reply to an existing ticket

Add a new post to a ticket, or create a new ticket if a ticket with the given ID doesn't exist.

ticket_add_post(\AUTO_LINK $member, string $ticket_id, integer $ticket_type, \LONG_TEXT $title, \LONG_TEXT $post, string $ticket_url, boolean $staff_only) 

It has the same return value as make_post_forum_topic().

Parameters

$member

\AUTO_LINK

The member ID

$ticket_id

string

The ticket ID (doesn't have to exist)

$ticket_type

integer

The ticket type

$title

\LONG_TEXT

The post title

$post

\LONG_TEXT

The post content in Comcode format

$ticket_url

string

The home URL

$staff_only

boolean

Whether the reply is staff only (invisible to ticket owner, only on OCF)

Update the cache of ticket type lead times (average time taken for a response to tickets of that type) in the database.

update_ticket_type_lead_times() 

This is a query-intensive function, so should only be run occasionally.