StandardTemplate#

NAME#

Kernel::System::StandardTemplate - standard template lib

DESCRIPTION#

All standard template functions. E. g. to add standard template or other functions.

PUBLIC INTERFACE#

new()#

create an object

my $StandardTemplateObject = $Kernel::OM->Get('Kernel::System::StandardTemplate');

StandardTemplateAdd()#

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,Forward',
    ValidID      => 1,
    UserID       => 123,
);

StandardTemplateGet()#

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,Forward',
    ValidID             => '1',
    CreateTime          => '2010-04-07 15:41:15',
    CreateBy            => '321',
    ChangeTime          => '2010-04-07 15:59:45',
    ChangeBy            => '223',
);

StandardTemplateDelete()#

delete a standard template

$StandardTemplateObject->StandardTemplateDelete(
    ID => 123,
);

StandardTemplateUpdate()#

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,Forward',
    ValidID      => 1,
    UserID       => 123,
);

StandardTemplateLookup()#

return the name or the standard template id

my $StandardTemplateName = $StandardTemplateObject->StandardTemplateLookup(
    StandardTemplateID => 123,
);

or

my $StandardTemplateID = $StandardTemplateObject->StandardTemplateLookup(
    StandardTemplate => 'Std Template Name',
);

StandardTemplateList()#

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 of a single type
my %StandardTemplates = $StandardTemplateObject->StandardTemplateList(

Valid => 0, Type => ‘Answer’,

);

Returns:
%StandardTemplates = (

1 => ‘Some Name’,

);

get standard templates for multiple types
my %StandardTemplates = $StandardTemplateObject->StandardTemplateList(

Valid => 0, Type => ‘Answer,Forward’,

);

Returns:
%StandardTemplates = (
‘Answer’ => {

‘1’ => ‘Some Name’, ‘4’ => ‘AW FWD’,

}, ‘Forward’ => {

‘3’ => ‘Some Name3’, ‘4’ => ‘AW FWD’,

}

);

NameExistsCheck()#

return 1 if another standard template with this name already exists

    $Exist = $StandardTemplateObject->NameExistsCheck(
        Name => 'Some::Template',
        ID   => 1,                  # optional
    );