RT 6.0.0 Documentation
RT::Template
- NAME
- SYNOPSIS
- DESCRIPTION
- METHODS
- _Value
- Load <identifier>
- LoadByName
- LoadGlobalTemplate NAME LOOKUPTYPE
- LoadObjectTemplate (ObjectId => QUEUEID, Name => NAME, LookupType => LOOKUPTYPE)
- Create
- Delete
- UsedBy
- IsEmpty
- IsOverride
- MIMEObj
- Parse
- CurrentUserHasObjectRight
- SetObjectId
- SetName
- SetType
- SetContent
- CompileCheck
- CurrentUserCanRead
- id
- ObjectId
- Object
- Name
- SetName VALUE
- Description
- SetDescription VALUE
- Type
- SetType VALUE
- Content
- SetContent VALUE
- LookupType
- 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 LoadObjectTemplate to get precise result.
LoadByName
Takes Name, LookupType, and ObjectId arguments. Tries to load object specific template first, then global. If ObjectId argument is omitted then global template is tried, not template with the name in any object.
LoadGlobalTemplate NAME LOOKUPTYPE
Load the global template with the name NAME and LookupType LOOKUPTYPE.
LoadObjectTemplate (ObjectId => QUEUEID, Name => NAME, LookupType => LOOKUPTYPE)
Loads the Object template named NAME for Object QUEUE.
Note that this method doesn't load a global template with the same name if template in the object doesn't exist. Use "LoadByName".
Create
Takes a paramhash of Content, Object, LookupType, Name, and Description. Name should be a unique string identifying this Template. Description and Content should be the template's title and content. ObjectId should be 0 for a global template and the object id for a object-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 limited to scrips that use this template. Takes into account that template can be overridden in a queue.
IsEmpty
Returns true value if content of the template is empty, otherwise returns false.
IsOverride
Returns true if it's object 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.
CurrentUserHasObjectRight
Helper function to call the template's object's CurrentUserHasRight with the passed in args.
SetObjectId
Changing ObjectId 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).)
ObjectId
Returns the current value of ObjectId. (In the database, ObjectId is stored as int(11).)
Object
Returns the Object which has the id returned by ObjectId
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.)
LookupType
Returns the current value of LookupType. (In the database, LookupType is stored as varchar(255).)
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