Kernel::System::StandardTemplate - standard template lib
All standard template functions. E. g. to add standard template or other functions.
create an object
my $StandardTemplateObject = $Kernel::OM->Get('Kernel::System::StandardTemplate');
add new standard template
my $ID = $StandardTemplateObject->StandardTemplateAdd( Name => 'New Standard Template', Template => 'Thank you for your email.', ContentType => 'text/plain; charset=utf-8', TemplateType => 'Answer', # or 'Forward' or 'Create' ValidID => 1, UserID => 123, );
get standard template attributes
my %StandardTemplate = $StandardTemplateObject->StandardTemplateGet( ID => 123, );
Returns:
%StandardTemplate = ( ID => '123', Name => 'Simple remplate', Comment => 'Some comment', Template => 'Template content', ContentType => 'text/plain', TemplateType => 'Answer', ValidID => '1', CreateTime => '2010-04-07 15:41:15', CreateBy => '321', ChangeTime => '2010-04-07 15:59:45', ChangeBy => '223', );
delete a standard template
$StandardTemplateObject->StandardTemplateDelete( ID => 123, );
update standard template attributes
$StandardTemplateObject->StandardTemplateUpdate( ID => 123, Name => 'New Standard Template', Template => 'Thank you for your email.', ContentType => 'text/plain; charset=utf-8', TemplateType => 'Answer', ValidID => 1, UserID => 123, );
return the name or the standard template id
my $StandardTemplateName = $StandardTemplateObject->StandardTemplateLookup( StandardTemplateID => 123, ); or my $StandardTemplateID = $StandardTemplateObject->StandardTemplateLookup( StandardTemplate => 'Std Template Name', );
get all valid standard templates
my %StandardTemplates = $StandardTemplateObject->StandardTemplateList();
Returns: %StandardTemplates = ( 1 => 'Some Name', 2 => 'Some Name2', 3 => 'Some Name3', );
get all standard templates
my %StandardTemplates = $StandardTemplateObject->StandardTemplateList( Valid => 0, );
Returns: %StandardTemplates = ( 1 => 'Some Name', 2 => 'Some Name2', );
get standard templates from a certain type my %StandardTemplates = $StandardTemplateObject->StandardTemplateList( Valid => 0, Type => 'Answer', );
Returns: %StandardTemplates = ( 1 => 'Answer - Some Name', );
return 1 if another standard template with this name already exists $Exist = $StandardTemplateObject->NameExistsCheck( Name => 'Some::Template', ID => 1, # optional );
This software is part of the OTRS project (https://otrs.org/).
This software comes with ABSOLUTELY NO WARRANTY. For details, see the enclosed file COPYING for license information (GPL). If you did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.