Kernel::System::Template::Category

NAME

Kernel::System::Template::Category – template category lib

SYNOPSIS

All template category functions.

PUBLIC INTERFACE

new()

create an object. Do not use it directly, instead use:

    use Kernel::System::ObjectManager;
    local $Kernel::OM = Kernel::System::ObjectManager->new();
    my $CategoryObject = $Kernel::OM->Get('Kernel::System::Template::Category');
CategoryList()

return a hash list of categories

    my %CategoryList = $CategoryObject->CategoryList(
        Valid  => 0,   # (optional) default 1 (0|1)
        UserID => 1,
    );
CategoryGet()

return a template category as hash

    my %CategoryData = $CategoryObject->CategoryGet(
        CategoryID => 123,
        UserID    => 1,
    );

    my %CategoryData = $CategoryObject->CategoryGet(
        Name    => 'Category::SubCategory',
        UserID  => 1,
    );

Returns:

    %CategoryData = (
        CategoryID => 123,
        ParentID   => 456,
        Name       => 'Category::SubCategory',
        NameShort  => 'SubCategory',
        ValidID    => 1,
        Comment    => 'Comment',
        CreateTime => '12-12-1977 12:00:00',
        CreateBy   => 123,
        ChangeTime => '12-12-1977 12:00:00',
        ChangeBy   => 123,
    );
CategoryLookup()

return a template category name or ID

    my $CategoryName = $CategoryObject->CategoryLookup(
        CategoryID => 123,
    );

    or

    my $CategoryID = $CategoryObject->CategoryLookup(
        Name => 'Category::SubCategory',
    );
CategoryAdd()

add a category

    my $CategoryID = $CategoryObject->CategoryAdd(
        Name     => 'Category Name',
        ParentID => 1,           # (optional)
        ValidID  => 1,
        Comment  => 'Comment',    # (optional)
        UserID   => 1,
    );

Returns:

    $CategoryID = 123;      # or false in case of an error
CategoryUpdate()

update a existing category

    my $Success = $CategoryObject->CategoryUpdate(
        CategoryID => 123,
        ParentID  => 1,           # (optional)
        Name      => 'Category Name',
        ValidID   => 1,
        Comment   => 'Comment',    # (optional)
        UserID    => 1,
    );

Returns:

    $Success = 1        # or false in case of an error
CategorySearch()

return template category IDs as an array

    my @CategoryList = $CategoryObject->CategorySearch(
        Name   => 'Category Name', # (optional)
        Limit  => 122,            # (optional) default 1000
        UserID => 1,
    );
GetCategoryByTemplate()

return an array with template category ids

    my @CategoryIDs = $CategoryObject->GetCategoryByTemplate(
        TemplateID => 5,
        Valid      => 0,   # (optional) default 1 (0|1)
        UserID     => 1,
    );
CategoryStandardTemplateMemberAdd()

to add a template to a category

    my $Success = $CategoryObject->CategoryStandardTemplateMemberAdd(
        CategoryID            => 123,
        StandardTemplateID => 123,
        Active             => 1,        # optional
        UserID             => 123,
    );

Return: $Success = 1; # or false in case of an error

CategoryStandardTemplateMemberList()

get standard templates of a template category

    my %Templates = $CategoryObject->CategoryStandardTemplateMemberList(
        CategoryID => 123,
        UserID      => 123,
        Valid       => 1,       # or 0, default 1
    );

Returns: %Templates = ( 1 => 'Some Name', 2 => 'Some Name', );

    my %Categories = $CategoryObject->CategoryStandardTemplateMemberList(
        StandardTemplateID => 123,
        UserID             => 123,
        Valid       => 1,       # or 0, default 1
    );

Returns: %Categories = ( 1 => 'Some Name', 2 => 'Some Name', );

Scroll to Top