RT 3.8.17 Documentation
RT::Template Overlay
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 <identifer>
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 "LoadGlobalTemplate" and/or LoadQueueTemplate to get precise result.
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. THe following code can be used:
$template->LoadQueueTemplate( Queue => $queue_id, Name => $template_name );
unless ( $template->id ) {
$template->LoadGlobalTemplate( $template_name );
unless ( $template->id ) {
# no template
...
}
}
# ok, template either queue's or global
...
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.
IsEmpty
Returns true value if content of the template is empty, otherwise returns false.
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 UTF-8, but MIME::Parser is not good at handling it and all data of the entity should be treated as octets and converted to perl strings using Encode::decode_utf8 or something else.
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.
← Back to index