RT 4.4.0 Documentation
RT::Template
- NAME
- SYNOPSIS
- DESCRIPTION
- METHODS
- _Value
- Load <identifier>
- LoadByName
- LoadGlobalTemplate NAME
- LoadQueueTemplate (Queue => QUEUEID, Name => NAME)
- Create
- Delete
- UsedBy
- IsEmpty
- IsOverride
- MIMEObj
- Parse
- CurrentUserHasQueueRight
- SetQueue
- SetName
- SetType
- SetContent
- CompileCheck
- CurrentUserCanRead
- id
- Queue
- SetQueue VALUE
- QueueObj
- Name
- SetName VALUE
- Description
- SetDescription VALUE
- Type
- SetType VALUE
- Content
- SetContent VALUE
- LastUpdated
- LastUpdatedBy
- Creator
- Created
NAME
RT::Template - RT's template object
SYNOPSIS
use RT::Template;
DESCRIPTION
METHODS
_Value
Takes the name of a table column. Returns its value as a string, if the user passes an ACL check, otherwise returns undef.
Load <identifier>
Load a template, either by number or by name.
Note that loading templates by name using this method is ambiguous. Several queues may have template with the same name and as well global template with the same name may exist. Use "LoadByName", "LoadGlobalTemplate" or LoadQueueTemplate to get precise result.
LoadByName
Takes Name and Queue arguments. Tries to load queue specific template first, then global. If Queue argument is omitted then global template is tried, not template with the name in any queue.
LoadGlobalTemplate NAME
Load the global template with the name NAME
LoadQueueTemplate (Queue => QUEUEID, Name => NAME)
Loads the Queue template named NAME for Queue QUEUE.
Note that this method doesn't load a global template with the same name if template in the queue doesn't exist. Use "LoadByName".
Create
Takes a paramhash of Content, Queue, Name and Description. Name should be a unique string identifying this Template. Description and Content should be the template's title and content. Queue should be 0 for a global template and the queue # for a queue-specific template.
Returns the Template's id # if the create was successful. Returns undef for unknown database failure.
Delete
Delete this template.
UsedBy
Returns RT::Scrips limitted to scrips that use this template. Takes into account that template can be overriden in a queue.
IsEmpty
Returns true value if content of the template is empty, otherwise returns false.
IsOverride
Returns true if it's queue specific template and there is global template with the same name.
MIMEObj
Returns MIME::Entity object parsed using "Parse" method. Returns undef if last call to "Parse" failed or never be called.
Note that content of the template is characters, but the contents of all MIME::Entity objects (including the one returned by this function, are bytes in UTF-8.
Parse
This routine performs Text::Template parsing on the template and then imports the results into a MIME::Entity so we can really use it. Use "MIMEObj" method to get the MIME::Entity object.
Takes a hash containing Argument, TicketObj, and TransactionObj and other arguments that will be available in the template's code. TicketObj and TransactionObj are not mandatory, but highly recommended.
It returns a tuple of (val, message). If val is false, the message contains an error message.
CurrentUserHasQueueRight
Helper function to call the template's queue's CurrentUserHasQueueRight with the passed in args.
SetQueue
Changing queue is not implemented.
SetName
Change name of the template.
SetType
If setting Type to Perl, require the ExecuteCode right.
SetContent
If changing content and the type is Perl, require the ExecuteCode right.
CompileCheck
If the template's Type is Perl, then compile check all the codeblocks to see if they are syntactically valid. We eval them in a codeblock to avoid actually executing the code.
Returns an (ok, message) pair.
CurrentUserCanRead
id
Returns the current value of id. (In the database, id is stored as int(11).)
Queue
Returns the current value of Queue. (In the database, Queue is stored as int(11).)
SetQueue VALUE
Set Queue to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, Queue will be stored as a int(11).)
QueueObj
Returns the Queue Object which has the id returned by Queue
Name
Returns the current value of Name. (In the database, Name is stored as varchar(200).)
SetName VALUE
Set Name to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, Name will be stored as a varchar(200).)
Description
Returns the current value of Description. (In the database, Description is stored as varchar(255).)
SetDescription VALUE
Set Description to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, Description will be stored as a varchar(255).)
Type
Returns the current value of Type. (In the database, Type is stored as varchar(16).)
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(16).)
Content
Returns the current value of Content. (In the database, Content is stored as text.)
SetContent VALUE
Set Content to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, Content will be stored as a text.)
LastUpdated
Returns the current value of LastUpdated. (In the database, LastUpdated is stored as datetime.)
LastUpdatedBy
Returns the current value of LastUpdatedBy. (In the database, LastUpdatedBy is stored as int(11).)
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