Kernel::System::StdAttachment

NAME

Kernel::System::StdAttachment – standard attachment lib

DESCRIPTION

All standard attachment functions.

PUBLIC INTERFACE

new()

Don't use the constructor directly, use the ObjectManager instead:

    my $StdAttachmentObject = $Kernel::OM->Get('Kernel::System::StdAttachment');

StdAttachmentAdd()

create a new standard attachment

    my $ID = $StdAttachmentObject->StdAttachmentAdd(
        Name        => 'Some Name',
        ValidID     => 1,
        Content     => $Content,
        ContentType => 'text/xml',
        Filename    => 'SomeFile.xml',
        UserID      => 123,
    );

StdAttachmentGet()

get a standard attachment

    my %Data = $StdAttachmentObject->StdAttachmentGet(
        ID => $ID,
    );

StdAttachmentUpdate()

update a new standard attachment

    my $ID = $StdAttachmentObject->StdAttachmentUpdate(
        ID          => $ID,
        Name        => 'Some Name',
        ValidID     => 1,
        Content     => $Content,
        ContentType => 'text/xml',
        Filename    => 'SomeFile.xml',
        UserID      => 123,
    );

StdAttachmentDelete()

delete a standard attachment

    $StdAttachmentObject->StdAttachmentDelete(
        ID => $ID,
    );

StdAttachmentLookup()

lookup for a standard attachment

    my $ID = $StdAttachmentObject->StdAttachmentLookup(
        StdAttachment => 'Some Name',
    );

    my $Name = $StdAttachmentObject->StdAttachmentLookup(
        StdAttachmentID => $ID,
    );

StdAttachmentList()

get list of standard attachments – return a hash (ID => Name (Filename))

    my %List = $StdAttachmentObject->StdAttachmentList(
        Valid => 0,  # optional, defaults to 1
    );

returns:

        %List = (
          '1' => 'Some Name' ( Filname ),
          '2' => 'Some Name' ( Filname ),
          '3' => 'Some Name' ( Filname ),
    );

StdAttachmentStandardTemplateMemberAdd()

to add an attachment to a template

    my $Success = $StdAttachmentObject->StdAttachmentStandardTemplateMemberAdd(
        AttachmentID       => 123,
        StandardTemplateID => 123,
        Active             => 1,        # optional
        UserID             => 123,
    );

StdAttachmentStandardTemplateMemberList()

returns a list of Standard Attachment / Standard Template members

    my %List = $StdAttachmentObject->StdAttachmentStandardTemplateMemberList(
        AttachmentID => 123,
    );

    or
    my %List = $StdAttachmentObject->StdAttachmentStandardTemplateMemberList(
        StandardTemplateID => 123,
    );

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

Scroll to Top