\Whups_Driver_Sql

Whups backend driver for the Horde_Db abstraction layer.

Copyright 2001-2002 Robert E. Coyle robertecoyle@hotmail.com Copyright 2001-2017 Horde LLC (http://www.horde.org/)

See the enclosed file LICENSE for license information (BSD). If you did not receive this file, see http://www.horde.org/licenses/bsdl.php.

Summary

Methods
Properties
Constants
__construct()
setAttributes()
getHistory()
getQueue()
getQueues()
getVersionInfo()
getVersions()
getVersion()
getCategories()
getAttributesForType()
getAllTicketAttributesWithNames()
deleteQueue()
deleteReply()
filterTicketsByState()
mail()
formatComments()
setStorage()
addQueue()
addType()
addState()
addPriority()
addVersion()
addReply()
addTicket()
addComment()
updateTicket()
addTicketOwner()
deleteTicketOwner()
deleteTicket()
executeQuery()
clauseFromQuery()
getTicketsByProperties()
getTicketDetails()
getTicketState()
getGuestEmail()
deleteHistory()
getQueueSummary()
getQueueInternal()
getQueueBySlugInternal()
getQueuesInternal()
getSlugs()
updateQueue()
getDefaultType()
updateTypesQueues()
getQueueUsers()
addQueueUser()
removeQueueUser()
getType()
getTypes()
getTypeIds()
getAllTypes()
getAllTypeInfo()
getTypeName()
updateType()
deleteType()
getStates()
getState()
getAllStateInfo()
updateState()
getDefaultState()
setDefaultState()
deleteState()
getQuery()
saveQuery()
deleteQuery()
isCategory()
getAllPriorityInfo()
getPriorities()
getPriority()
updatePriority()
getDefaultPriority()
setDefaultPriority()
deletePriority()
getVersionInfoInternal()
getVersionInternal()
updateVersion()
deleteVersion()
getReplies()
getReply()
updateReply()
addListener()
addUniqueListener()
deleteListener()
getListeners()
addAttributeDesc()
updateAttributeDesc()
deleteAttributeDesc()
getAllAttributes()
getAttributeDesc()
getAttributeName()
getAttributeNamesForType()
getAttributeInfoForType()
getTicketAttributes()
getTicketAttributesWithNames()
getOwners()
updateLog()
newTransaction()
No public properties found
No constants found
_serializeAttribute()
_json_decode()
_concatClauses()
_notClause()
_criterionClause()
_getHistory()
_getAttributesForType()
_setAttributeValue()
_getAllTicketAttributesWithNames()
_generateWhere()
_mapFields()
_addWhere()
_addDateWhere()
_prefixTableToColumns()
_toBackend()
_fromBackend()
$_params
$_db
$_map
$_guestEmailCache
$_internalQueueCache
$_queues
$_slugs
N/A
No private methods found
No private properties found
N/A

Properties

$_params

$_params : array

Type

array

$_db

$_db : \Horde_Db_Adapter_Base

The database connection object.

Type

\Horde_Db_Adapter_Base

$_map

$_map : array

A mapping of attributes from generic Whups names to DB backend fields.

Type

array

$_guestEmailCache

$_guestEmailCache : array

Local cache for guest email addresses.

Type

array

$_internalQueueCache

$_internalQueueCache : array

Local cache of internal queue hashes

Type

array

$_queues

$_queues : array

Local queues internal cache

Type

array

$_slugs

$_slugs : array

Local slug cache

Type

array

Methods

__construct()

__construct(array  $params) : \Whups_Driver_Base

Constructor

Parameters

array $params

Parameter array.

Returns

\Whups_Driver_Base

setAttributes()

setAttributes(array  $info, \Whups_Ticket  $ticket) 

Set ticket attributes

Parameters

array $info

Attributes to set

\Whups_Ticket $ticket

The ticket which attributes to set.

getHistory()

getHistory(integer  $ticket_id, \Horde_Form  $form = null) : array

Fetch ticket history

Parameters

integer $ticket_id

The ticket to fetch history for.

\Horde_Form $form

Returns

array

getQueue()

getQueue(  $queueId) 

Parameters

$queueId

getQueues()

getQueues() 

getVersionInfo()

getVersionInfo(  $queue) 

Parameters

$queue

getVersions()

getVersions(  $queue,   $all = false) 

Returns a hash of versions suitable for select lists.

Parameters

$queue
$all

getVersion()

getVersion(  $version) 

Parameters

$version

getCategories()

getCategories() 

getAttributesForType()

getAttributesForType(  $type = null) : array

Returns the attributes for a ticket type.

Parameters

$type

Returns

array —

A list of attributes.

getAllTicketAttributesWithNames()

getAllTicketAttributesWithNames(  $ticket_id) : array

Returns the attributes for a specific ticket.

This method will check if external attributes need to be fetched from hooks or whether to use the standard ones defined within Whups.

Parameters

$ticket_id

Returns

array —

List of attributes.

deleteQueue()

deleteQueue(integer  $queueId) 

Deletes an entire queue, and all references to it.

Should be called by driver subclasses after successful removal from the backend. Takes only care of cleaning up queue permissions.

Parameters

integer $queueId

A queue ID.

Throws

\Whups_Exception

deleteReply()

deleteReply(integer  $reply) 

Deletes a form reply.

Should be called by driver subclasses after successful removal from the backend. Takes only care of cleaning up reply permissions.

Parameters

integer $reply

A reply ID.

Throws

\Whups_Exception

filterTicketsByState()

filterTicketsByState(  $tickets,   $state_category = array()) 

Parameters

$tickets
$state_category

mail()

mail(array  $opts) 

Sends email notifications to a list of recipients.

We do some ugly work in here to make sure that no one gets comments mailed to them that they shouldn't see (because of group permissions).

Parameters

array $opts

Option hash with notification information. Possible values:

  • ticket: (Whups_Ticket) A ticket. If not set, this is assumed to be a reminder message.
  • recipients: (array|string) The list of recipients, with user names as keys and user roles as values.
  • subject: (string) The email subject.
  • view: (Horde_View) The view object for the message text.
  • template: (string) The template file for the message text.
  • from: (string) The email sender.
  • new: (boolean, optional) Whether the passed ticket was just created.

formatComments()

formatComments(array  $comments, integer  $ticket) : string

Converts a changeset array to a plain text comment snippet.

Parameters

array $comments

A changeset list.

integer $ticket

A ticket ID.

Returns

string —

The formatted comment text, if any.

setStorage()

setStorage(  $storage) 

Parameters

$storage

addQueue()

addQueue(  $name,   $description,   $slug = '',   $email = '') : integer

Adds a new queue.

Parameters

$name
$description
$slug
$email

Throws

\Whups_Exception

Returns

integer —

The new queue ID.

addType()

addType(string  $name, string  $description) : integer

Adds a new ticket type.

Parameters

string $name

A type name.

string $description

A type description.

Throws

\Whups_Exception

Returns

integer —

The new type ID.

addState()

addState(integer  $typeId, string  $name, string  $description, string  $category) : integer

Adds a new state to a ticket type.

Parameters

integer $typeId

A ticket type ID.

string $name

A state name

string $description

A state description.

string $category

A state category.

Throws

\Whups_Exception

Returns

integer —

The new state ID.

addPriority()

addPriority(integer  $typeId, string  $name, string  $description) : integer

Adds a new priority to a ticket type.

Parameters

integer $typeId

A ticket type ID.

string $name

A priority name.

string $description

A priority description.

Throws

\Whups_Exception

Returns

integer —

The new priority ID.

addVersion()

addVersion(integer  $queueId, string  $name, string  $description, boolean  $active) : integer

Adds a new version to a queue.

Parameters

integer $queueId

A queue ID.

string $name

A version name.

string $description

A version description.

boolean $active

Whether the version is active.

Throws

\Whups_Exception

Returns

integer —

The new version ID.

addReply()

addReply(integer  $type, string  $name, string  $text) : integer

Adds a form reply.

Parameters

integer $type

A ticket type ID.

string $name

A reply name.

string $text

A reply text.

Throws

\Whups_Exception

Returns

integer —

The new form reply ID.

addTicket()

addTicket(array  $info, string  $requester) : integer

Adds a ticket.

Parameters

array $info

A ticket info hash. Will get a 'last-transaction' value added.

string $requester

A ticket requester.

Throws

\Whups_Exception

Returns

integer —

The new ticket ID.

addComment()

addComment(integer  $ticket_id, string  $comment, string  $creator, string  $creator_email = null) : integer

Adds a new ticket comment.

Parameters

integer $ticket_id

A ticket ID.

string $comment

A comment text.

string $creator

The creator of the comment.

string $creator_email

The creator's email address.

Throws

\Whups_Exception

Returns

integer —

The new comment ID.

updateTicket()

updateTicket(integer  $ticketId, array  $attributes) 

Updates a ticket.

Does not update the ticket log (so that it can be used for things low-level enough to not show up there. In general, you should always update the log; Whups_Ticket::commit() will take care of this in most cases).

Parameters

integer $ticketId

A ticket ID.

array $attributes

An attribute hash.

Throws

\Whups_Exception

addTicketOwner()

addTicketOwner(integer  $ticketId, string  $owner) 

Adds a ticket owner.

Parameters

integer $ticketId

A ticket ID.

string $owner

An owner ID.

Throws

\Whups_Exception

deleteTicketOwner()

deleteTicketOwner(integer  $ticketId, string  $owner) 

Removes a ticket owner.

Parameters

integer $ticketId

A ticket ID.

string $owner

An owner ID.

Throws

\Whups_Exception

deleteTicket()

deleteTicket(integer  $id) 

Removes a ticket.

Parameters

integer $id

A ticket ID.

Throws

\Whups_Exception

executeQuery()

executeQuery(\Whups_Query  $query, \Horde_Variables  $vars, boolean  $get_details = true, boolean  $munge = true) : array

Executes a query.

Parameters

\Whups_Query $query

A query object.

\Horde_Variables $vars

Request variables.

boolean $get_details

Whether to return all ticket details.

boolean $munge

@TODO (?)

Throws

\Whups_Exception

Returns

array —

List of ticket IDs or ticket details that match the query criteria.

clauseFromQuery()

clauseFromQuery(  $args,   $type,   $criterion,   $cvalue,   $operator,   $value) 

Parameters

$args
$type
$criterion
$cvalue
$operator
$value

getTicketsByProperties()

getTicketsByProperties(array  $info, boolean  $munge = true, boolean  $perowner = false, boolean  $format_name = true) : array

Returns tickets by searching for its properties.

Parameters

array $info

An array of properties to search for.

boolean $munge

Munge the query (?)

boolean $perowner

Group the results per owner?

boolean $format_name

If false, do not format the username. @since 3.1.0

Throws

\Whups_Exception

Returns

array —

An array of ticket information hashes.

getTicketDetails()

getTicketDetails(integer  $ticket, boolean  $checkPerms = true) : array

Returns ticket details.

Parameters

integer $ticket

A ticket ID.

boolean $checkPerms

Enforce permissions?

Throws

\Horde_Exception_NotFound
\Horde_Exception_PermissionDenied

Returns

array —

A ticket information hash.

getTicketState()

getTicketState(integer  $ticket_id) : integer

Returns a ticket state.

Parameters

integer $ticket_id

A ticket ID.

Throws

\Whups_Exception

Returns

integer —

A state ID.

getGuestEmail()

getGuestEmail(string  $guest_id) : string

Returns a guest's email address.

Parameters

string $guest_id

A guest ID.

Throws

\Whups_Exception

Returns

string —

The guest's email address.

deleteHistory()

deleteHistory(integer  $transaction) 

Deletes all changes of a transaction.

Parameters

integer $transaction

A transaction ID.

Throws

\Whups_Exception

getQueueSummary()

getQueueSummary(  $queue_ids) : array

Return a list of queues and the number of open tickets in each.

Parameters

$queue_ids

Throws

\Whups_Exception

Returns

array —

A list of queue hashes.

getQueueInternal()

getQueueInternal(integer  $queueId) : array

Returns a queue information hash.

Parameters

integer $queueId

A queue ID.

Throws

\Whups_Exception

Returns

array —

A queue hash.

getQueueBySlugInternal()

getQueueBySlugInternal(string  $slug) : array

Returns a queue information hash.

Parameters

string $slug

A queue slug.

Throws

\Whups_Exception

Returns

array —

A queue hash.

getQueuesInternal()

getQueuesInternal() : array

Returns a list of available queues.

Throws

\Whups_Exception

Returns

array —

An hash of queue ID => queue name.

getSlugs()

getSlugs() : array

Returns a list of all available slugs.

Throws

\Whups_Exception

Returns

array —

A hash of queue ID => queue slug.

updateQueue()

updateQueue(integer  $queueId, string  $name, string  $description, array  $types = array(), integer  $versioned, string  $slug = '', string  $email = '', integer  $default = null) 

Updates a queue.

Parameters

integer $queueId

A queue ID.

string $name

A queue name.

string $description

A queue description.

array $types

A list of type IDs for this queue.

integer $versioned

Is this queue versioned? (1 = true, 0 = false)

string $slug

A queue slug.

string $email

A queue email address.

integer $default

The default ticket type.

Throws

\Whups_Exception

getDefaultType()

getDefaultType(integer  $queue) : integer

Returns a queue's default ticket type.

Parameters

integer $queue

A queue ID.

Returns

integer —

A ticket type ID.

updateTypesQueues()

updateTypesQueues(array  $tmPairs) 

Update type-queue-associations.

Parameters

array $tmPairs

Throws

\Whups_Exception

getQueueUsers()

getQueueUsers(integer  $queueId) : array

Returns a list of responsible users.

Parameters

integer $queueId

A queue ID.

Throws

\Whups_Execption

Returns

array —

An array of users responsible for the queue.

addQueueUser()

addQueueUser(integer  $queueId, string  $userId) 

Adds a responsible user.

Parameters

integer $queueId

A queue ID.

string $userId

A user ID.

Throws

\Whups_Exception

removeQueueUser()

removeQueueUser(integer  $queueId, string  $userId) 

Removes a responsible user.

Parameters

integer $queueId

A queue ID.

string $userId

A user ID.

Throws

\Whups_Exception

getType()

getType(integer  $typeId) : array

Returns a ticket type.

Parameters

integer $typeId

A ticket type ID.

Throws

\Whups_Exception

Returns

array —

The ticket type information.

getTypes()

getTypes(integer  $queueId) : array

Returns a list of ticket types associated with a queue.

Parameters

integer $queueId

A queue ID.

Throws

\Whups_Exception

Returns

array —

A hash of type ID => type name.

getTypeIds()

getTypeIds(integer  $queueId) : array

Returns a list of ticket type IDs associated with a queue.

Parameters

integer $queueId

A queue ID.

Throws

\Whups_Exception

Returns

array —

A list of type IDs.

getAllTypes()

getAllTypes() : array

Returns a list of all available ticket types.

Throws

\Whups_Exception

Returns

array —

A hash of type ID => type name.

getAllTypeInfo()

getAllTypeInfo() : array

Returns a list of all available ticket types.

Throws

\Whups_Exception

Returns

array —

A list of ticket type information hashes.

getTypeName()

getTypeName(integer  $type) : string

Returns a ticket type name.

Parameters

integer $type

A type ID.

Throws

\Whups_Exception

Returns

string —

The ticket type's name.

updateType()

updateType(integer  $typeId, string  $name, string  $description) 

Updates a ticket type.

Parameters

integer $typeId

A ticket type ID.

string $name

A ticket type name.

string $description

A ticket type description.

Throws

\Whups_Exception

deleteType()

deleteType(integer  $typeId) 

Deletes a ticket type.

Parameters

integer $typeId

A type ID.

Throws

\Whups_Exception

getStates()

getStates(integer  $type = null, string|array  $category = '', string|array  $notcategory = '') : array

Returns available states for a ticket type and state category.

Parameters

integer $type

A ticket type ID.

string|array $category

State categories to include.

string|array $notcategory

State categories to not include.

Throws

\Whups_Exception

Returns

array —

A hash of state ID => state name.

getState()

getState(integer  $stateId) : array

Returns a state information hash.

Parameters

integer $stateId

A state ID.

Returns

array —

A state definition hash.

getAllStateInfo()

getAllStateInfo(integer  $type) : array

Returns all state information hashes for a ticket type.

Parameters

integer $type

A ticket type ID.

Throws

\Whups_Exception

Returns

array —

A list of state hashes.

updateState()

updateState(integer  $stateId, string  $name, string  $description, string  $category) 

Updates a state.

Parameters

integer $stateId

A state ID.

string $name

A state name.

string $description

A state description.

string $category

A state category.

Throws

\Whups_Exception

getDefaultState()

getDefaultState(integer  $type) : integer

Returns the default state for a ticket type.

Parameters

integer $type

A type ID.

Throws

\Whups_Exception

Returns

integer —

The default state ID for the specified type.

setDefaultState()

setDefaultState(integer  $type, integer  $state) 

Sets the default state for a ticket type.

Parameters

integer $type

A type ID.

integer $state

A state ID.

Throws

\Whups_Exception

deleteState()

deleteState(integer  $state_id) 

Deletes a state.

Parameters

integer $state_id

A state ID.

Throws

\Whups_Exception

getQuery()

getQuery(integer  $queryId) : array

Returns query details.

Parameters

integer $queryId

A query ID.

Throws

\Whups_Exception

Returns

array —

Query information.

saveQuery()

saveQuery(\Whups_Query  $query) 

Saves query details.

If the query doesn't exist yes, it is added, update otherwise.

Parameters

\Whups_Query $query

A query.

Throws

\Whups_Exception

deleteQuery()

deleteQuery(integer  $queryId) 

Deletes a query.

Parameters

integer $queryId

A query ID.

Throws

\Whups_Exception

isCategory()

isCategory(string  $category, integer  $state_id) : boolean

Returns whether a state is of a certain category.

Parameters

string $category

A state category.

integer $state_id

A state ID.

Throws

\Whups_Exception

Returns

boolean —

True if the state is of the given category.

getAllPriorityInfo()

getAllPriorityInfo(integer  $type) : array

Returns all priority information hashes for a ticket type.

Parameters

integer $type

A ticket type ID.

Throws

\Whups_Exception

Returns

array —

A list of priority hashes.

getPriorities()

getPriorities(integer  $type = null) : array

Returns a list of priorities.

If the priorities are not limited to a ticket type, the priority names are suffixed with associated ticket type names.

Parameters

integer $type

Limit result to this ticket type's priorities.

Throws

\Whups_Exception

Returns

array —

A hash of priority ID => priority name.

getPriority()

getPriority(integer  $priorityId) : array

Returns a priority information hash.

Parameters

integer $priorityId

A state ID.

Throws

\Whups_Exception

Returns

array —

A priority definition hash.

updatePriority()

updatePriority(integer  $priorityId, string  $name, string  $description) 

Updates a priority.

Parameters

integer $priorityId

A priority ID.

string $name

A priority name.

string $description

A priority description.

Throws

\Whups_Exception

getDefaultPriority()

getDefaultPriority(integer  $type) : integer

Returns the default priority for a ticket type.

Parameters

integer $type

A type ID.

Throws

\Whups_Exception

Returns

integer —

The default priority ID for the specified type.

setDefaultPriority()

setDefaultPriority(integer  $type, integer  $priority) 

Sets the default priority for a ticket type.

Parameters

integer $type

A type ID.

integer $priority

A priority ID.

Throws

\Whups_Exception

deletePriority()

deletePriority(integer  $priorityId) 

Deletes a priority.

Parameters

integer $priorityId

A priority ID.

Throws

\Whups_Exception

getVersionInfoInternal()

getVersionInfoInternal(integer  $queue) : array

Returns all versions of a queue.

Parameters

integer $queue

A queue ID.

Throws

\Whups_Exception

Returns

array —

A list of version information hashes.

getVersionInternal()

getVersionInternal(integer  $versionId) : array

Returns a version information hash.

Parameters

integer $versionId

A state ID.

Throws

\Whups_Exception

Returns

array —

A version definition hash.

updateVersion()

updateVersion(integer  $versionId, string  $name, string  $description, boolean  $active) 

Updates a version.

Parameters

integer $versionId

A version ID.

string $name

A version name.

string $description

A version description.

boolean $active

Whether the version is still active.

Throws

\Whups_Exception

deleteVersion()

deleteVersion(integer  $versionId) 

Deletes a version.

Parameters

integer $versionId

A version ID.

Throws

\Whups_Exception

getReplies()

getReplies(integer  $type) : array

Returns all available form replies for a ticket type.

Parameters

integer $type

A type ID.

Throws

\Whups_Exception

Returns

array —

A hash of reply ID => reply information hash.

getReply()

getReply(integer  $reply_id) : array

Returns a form reply.

Parameters

integer $reply_id

A form reply ID.

Throws

\Whups_Exception

Returns

array —

A hash with all form reply information.

updateReply()

updateReply(integer  $reply, string  $name, string  $text) 

Updates a form reply.

Parameters

integer $reply

A reply ID.

string $name

A reply name.

string $text

A reply text.

Throws

\Whups_Exception

addListener()

addListener(integer  $ticket, string  $user) 

Adds a ticket listener.

Parameters

integer $ticket

A ticket ID.

string $user

An email address.

Throws

\Whups_Exception

addUniqueListener()

addUniqueListener(\Whups_Ticket  $ticket, string  $user) 

Adds a ticket listener if it doesn't exist yet.

Parameters

\Whups_Ticket $ticket

A ticket.

string $user

An email address.

Throws

\Whups_Exception

deleteListener()

deleteListener(integer  $ticket, string  $user) 

Deletes a ticket listener.

Parameters

integer $ticket

A ticket ID.

string $user

An email address.

Throws

\Whups_Exception

getListeners()

getListeners(integer  $ticket, boolean  $withowners = true, boolean  $withrequester = true, boolean  $withresponsible = false) : array

Returns all ticket listeners.

Parameters

integer $ticket

A ticket ID.

boolean $withowners

Include ticket owners?

boolean $withrequester

Include ticket creators?

boolean $withresponsible

Include users responsible for the ticket queue?

Throws

\Whups_Exception

Returns

array —

A list of all ticket listeners.

addAttributeDesc()

addAttributeDesc(integer  $type_id, string  $name, string  $desc, string  $type, array  $params, boolean  $required) : integer

Adds an attribute to a ticket type.

Parameters

integer $type_id

A ticket type ID.

string $name

An attribute name.

string $desc

An attribute description.

string $type

A form field type.

array $params

Additional parameters for the field type.

boolean $required

Whether the attribute is mandatory.

Throws

\Whups_Exception

Returns

integer —

The new attribute ID.

updateAttributeDesc()

updateAttributeDesc(integer  $attribute_id, string  $newname, string  $newdesc, string  $newtype, array  $newparams, boolean  $newrequired) 

Updates an attribute for a ticket type.

Parameters

integer $attribute_id

An attribute ID.

string $newname

An attribute name.

string $newdesc

An attribute description.

string $newtype

A form field type.

array $newparams

Additional parameters for the field type.

boolean $newrequired

Whether the attribute is mandatory.

Throws

\Whups_Exception

deleteAttributeDesc()

deleteAttributeDesc(integer  $attribute_id) 

Deletes an attribute for a ticket type.

Parameters

integer $attribute_id

An attribute ID.

Throws

\Whups_Exception

getAllAttributes()

getAllAttributes() : array

Returns all attributes.

Throws

\Whups_Exception

Returns

array —

A list of attributes hashes.

getAttributeDesc()

getAttributeDesc(integer  $attribute_id) : array

Returns an attribute information hash.

Parameters

integer $attribute_id

An attribute ID.

Throws

\Whups_Exception

Returns

array —

The attribute hash.

getAttributeName()

getAttributeName(integer  $attribute_id) : string

Returns an attribute name.

Parameters

integer $attribute_id

An attribute ID.

Throws

\Whups_Exception

Returns

string —

The attribute name.

getAttributeNamesForType()

getAttributeNamesForType(integer  $type_id) : array

Returns available attribute names for a ticket type.

Parameters

integer $type_id

A ticket type ID.

Throws

\Whups_Exception

Returns

array —

A list of attribute names.

getAttributeInfoForType()

getAttributeInfoForType(integer  $type_id) : array

Returns available attributes for a ticket type.

Parameters

integer $type_id

A ticket type ID.

Throws

\Whups_Exception

Returns

array —

A list of attribute information hashes.

getTicketAttributes()

getTicketAttributes(integer|array  $ticket_id) : array

Returns the attribute values of a ticket.

Parameters

integer|array $ticket_id

One or more ticket IDs.

Throws

\Whups_Exception

Returns

array —

If requesting a single ticket, an attribute ID => attribute value hash. If requesting multiple tickets, a list of hashes with ticket ID, attribute ID and attribute value.

getTicketAttributesWithNames()

getTicketAttributesWithNames(integer|array  $ticket_id) : array

Returns the attribute values and names of a ticket.

Parameters

integer|array $ticket_id

One or more ticket IDs.

Throws

\Whups_Exception

Returns

array —

If requesting a single ticket, an attribute name => attribute value hash. If requesting multiple tickets, a list of hashes with ticket ID, attribute ID, attribute name, and attribute value.

getOwners()

getOwners(  $ticketId) : array

Returns the owners of a ticket.

Parameters

$ticketId

Throws

\Whups_Exception

Returns

array —

An hash of ticket ID => owner IDs

updateLog()

updateLog(integer  $ticket_id, string  $user, array  $changes = array(), integer  $transactionId = null) : integer

Adds a new log entry

Parameters

integer $ticket_id

A ticket ID.

string $user

A user updating the ticket.

array $changes

A list of changes.

integer $transactionId

A transaction ID to use.

Throws

\Whups_Exception

Returns

integer —

A transaction ID.

newTransaction()

newTransaction(string  $creator, string  $creator_email = null) : integer

Create a new transaction ID.

Parameters

string $creator

A transaction creator.

string $creator_email

The transaction creator's email address.

Throws

\Whups_Exception

Returns

integer —

A transaction ID.

_serializeAttribute()

_serializeAttribute(  $value) : string

Returns a serialized value, if necessary.

Parameters

$value

Returns

string —

The JSON encoded value if not already a string.

_json_decode()

_json_decode(  $value) : mixed

Helper to decode attribute value, which may be a bare scalar value, or a json encoded structure that may contain large numeric strings that should not be taken as integers.

Parameters

$value

Returns

mixed —

The decoded value.

_concatClauses()

_concatClauses(  $args,   $conjunction) 

Parameters

$args
$conjunction

_notClause()

_notClause(  $args) 

Parameters

$args

_criterionClause()

_criterionClause(  $criterion,   $cvalue,   $operator,   $value) : string

Parameters

$criterion
$cvalue
$operator
$value

Returns

string

_getHistory()

_getHistory(integer  $ticket_id) : array

Returns a ticket's history.

Parameters

integer $ticket_id

A ticket ID.

Throws

\Whups_Exception

Returns

array —

The ticket's history.

_getAttributesForType()

_getAttributesForType(  $type = null) : array

Returns the attributes for a ticket type.

Parameters

$type

Returns

array —

A list of attribute ID => attribute information hashes.

_setAttributeValue()

_setAttributeValue(integer  $ticket_id, integer  $attribute_id, string  $attribute_value) 

Save an attribute value.

Parameters

integer $ticket_id

A ticket ID.

integer $attribute_id

An attribute ID.

string $attribute_value

An attribute value.

Throws

\Whups_Exception

_getAllTicketAttributesWithNames()

_getAllTicketAttributesWithNames(integer  $ticket_id) : array

Returns attribute values and information of a ticket.

Parameters

integer $ticket_id

A ticket IDs.

Throws

\Whups_Exception

Returns

array —

A list of hashes with attribute information and attribute value.

_generateWhere()

_generateWhere(  $table,   $fields,   $info,   $type) 

Parameters

$table
$fields
$info
$type

_mapFields()

_mapFields(  $info) 

Parameters

$info

_addWhere()

_addWhere(  $where,   $condition,   $clause,   $conjunction = 'AND') 

Parameters

$where
$condition
$clause
$conjunction

_addDateWhere()

_addDateWhere(  $where,   $data,   $type) 

Parameters

$where
$data
$type

_prefixTableToColumns()

_prefixTableToColumns(  $table,   $columns) 

Parameters

$table
$columns

_toBackend()

_toBackend(  $value) 

Parameters

$value

_fromBackend()

_fromBackend(  $value) 

Parameters

$value