RT 4.4.1 Documentation

RT::Transaction

Go to latest version →

NAME

  RT::Transaction - RT's transaction object

SYNOPSIS

  use RT::Transaction;

DESCRIPTION

Each RT::Transaction describes an atomic change to a ticket object or an update to an RT::Ticket object. It can have arbitrary MIME attachments.

METHODS

Create

Create a new transaction.

This routine should _never_ be called by anything other than RT::Ticket. It should not be called from client code. Ever. Not ever. If you do this, we will hunt you down and break your kneecaps. Then the unpleasant stuff will start.

TODO: Document what gets passed to this

Scrips

Returns the Scrips object for this transaction. This routine is only useful on a freshly created transaction object. Scrips do not get persisted to the database with transactions.

Rules

Returns the array of Rule objects for this transaction. This routine is only useful on a freshly created transaction object. Rules do not get persisted to the database with transactions.

Delete

Delete this transaction. Currently DOES NOT CHECK ACLS

Message

Returns the RT::Attachments object which contains the "top-level" object attachment for this transaction.

HasContent

Returns whether this transaction has attached mime objects.

Content PARAMHASH

If this transaction has attached mime objects, returns the body of the first textual part (as defined in RT::I18N::IsTextualContentType). Otherwise, returns the message "This transaction appears to have no content".

Takes a paramhash. If the $args{'Quote'} parameter is set, wraps this message at $args{'Wrap'}. $args{'Wrap'} defaults to 70.

If $args{'Type'} is set to text/html, this will return an HTML part of the message, if available. Otherwise it looks for a text/plain part. If $args{'Type'} is missing, it defaults to the value of $RT::Transaction::PreferredContentType, if that's missing too, defaults to textual.

QuoteHeader

Returns text prepended to content when transaction is quoted (see Quote argument in "Content"). By default returns localized "On <date> <user name> wrote:\n".

ApplyQuoteWrap PARAMHASH

Wrapper to calculate wrap criteria and apply quote wrapping if needed.

QuoteWrap PARAMHASH

Wrap the contents of transactions based on Wrap settings, maintaining the quote character from the original.

Addresses

Returns a hashref of addresses related to this transaction. See "Addresses" in RT::Attachment for details.

ContentObj

Returns the RT::Attachment object which contains the content for this Transaction

_IsDisplayableTextualContentType

We may need to pull this out to another module later, but for now, this is better than RT::I18N::IsTextualContentType because that believes that a message/rfc822 email is displayable, despite it having no content

Subject

If this transaction has attached mime objects, returns the first one's subject Otherwise, returns null

Attachments

Returns all the RT::Attachment objects which are attached to this transaction. Takes an optional parameter, which is a ContentType that Attachments should be restricted to.

_Attach

A private method used to attach a mime object to this transaction.

Description

Returns a text string which describes this transaction

BriefDescription

Returns a text string which briefly describes this transaction

BriefDescriptionAsHTML

Returns an HTML string which briefly describes this transaction.

IsInbound

Returns true if the creator of the transaction is a requestor of the ticket. Returns false otherwise

_Value

Takes the name of a table column. Returns its value as a string, if the user passes an ACL check

CurrentUserCanSee

Returns true if current user has rights to see this particular transaction.

This fact depends on type of the transaction, type of an object the transaction is attached to and may be other conditions, so this method is prefered over custom implementations.

It always returns true if current user is system user.

NewReferenceObject

OldReferenceObject

Returns an object of the class specified by the column ReferenceType and loaded with the id specified by the column NewReference or OldReference. ReferenceType is assumed to be an RT::Record subclass.

The object may be unloaded (check $object->id) if the reference is corrupt (such as if the referenced record was improperly deleted).

Returns undef if either ReferenceType or NewReference/OldReference is false.

UpdateCustomFields

Takes a hash of:

    CustomField-C<Id> => Value

or:

    Object-RT::Transaction-CustomField-C<Id> => Value

parameters to update this transaction's custom fields.

LoadCustomFieldByIdentifier

Finds and returns the custom field of the given name for the transaction, overriding "LoadCustomFieldByIdentifier" in RT::Record to look for queue-specific CFs before global ones.

CustomFieldLookupType

Returns the RT::Transaction lookup type, which can be passed to RT::CustomField->Create() via the 'LookupType' hash key.

SquelchMailTo

Similar to Ticket class SquelchMailTo method - returns a list of transaction's squelched addresses. As transactions are immutable, the list of squelched recipients cannot be modified after creation.

Recipients

Returns the list of email addresses (as Email::Address objects) that this transaction would send mail to. There may be duplicates.

DeferredRecipients($freq, $include_sent )

Takes the following arguments:

Returns an array of users who should now receive the notification that was recorded in this transaction. Returns an empty array if there were no deferred users, or if $include_sent was not specified and the deferred notifications have been sent.

ACLEquivalenceObjects

This method returns a list of objects for which a user's rights also apply to this Transaction.

This currently only applies to Transaction Custom Fields on Tickets, so we return the Ticket's Queue and the Ticket.

This method is called from "HasRight" in RT::Principal.

id

Returns the current value of id. (In the database, id is stored as int(11).)

ObjectType

Returns the current value of ObjectType. (In the database, ObjectType is stored as varchar(64).)

SetObjectType VALUE

Set ObjectType to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, ObjectType will be stored as a varchar(64).)

ObjectId

Returns the current value of ObjectId. (In the database, ObjectId is stored as int(11).)

SetObjectId VALUE

Set ObjectId to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, ObjectId will be stored as a int(11).)

TimeTaken

Returns the current value of TimeTaken. (In the database, TimeTaken is stored as int(11).)

SetTimeTaken VALUE

Set TimeTaken to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, TimeTaken will be stored as a int(11).)

Type

Returns the current value of Type. (In the database, Type is stored as varchar(20).)

SetType VALUE

Set Type to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, Type will be stored as a varchar(20).)

Field

Returns the current value of Field. (In the database, Field is stored as varchar(40).)

SetField VALUE

Set Field to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, Field will be stored as a varchar(40).)

OldValue

Returns the current value of OldValue. (In the database, OldValue is stored as varchar(255).)

SetOldValue VALUE

Set OldValue to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, OldValue will be stored as a varchar(255).)

NewValue

Returns the current value of NewValue. (In the database, NewValue is stored as varchar(255).)

SetNewValue VALUE

Set NewValue to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, NewValue will be stored as a varchar(255).)

ReferenceType

Returns the current value of ReferenceType. (In the database, ReferenceType is stored as varchar(255).)

SetReferenceType VALUE

Set ReferenceType to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, ReferenceType will be stored as a varchar(255).)

OldReference

Returns the current value of OldReference. (In the database, OldReference is stored as int(11).)

SetOldReference VALUE

Set OldReference to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, OldReference will be stored as a int(11).)

NewReference

Returns the current value of NewReference. (In the database, NewReference is stored as int(11).)

SetNewReference VALUE

Set NewReference to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, NewReference will be stored as a int(11).)

Data

Returns the current value of Data. (In the database, Data is stored as varchar(255).)

SetData VALUE

Set Data to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, Data will be stored as a varchar(255).)

Creator

Returns the current value of Creator. (In the database, Creator is stored as int(11).)

Created

Returns the current value of Created. (In the database, Created is stored as datetime.)

← Back to index