Kernel::System::Ticket::Article::Backend::Base - base class for article backends
This is a base class for article backends and should not be instantiated directly.
package Kernel::System::Ticket::Article::Backend::MyBackend; use strict; use warnings; use parent qw(Kernel::System::Ticket::Article::Backend::Base); # methods go here
Do not instantiate this class, instead use the real article backend classes. Also, don't use the constructor directly, use the ObjectManager instead:
my $ArticleBackendObject = $Kernel::OM->Get('Kernel::System::Ticket::Article::Backend::MyBackend');
Returns name of the communication channel used by the article backend. Used internally. Override this method in your backend class.
my $ChannelName = $ArticleBackendObject->ChannelNameGet(); $ChannelName = 'MyBackend';
Returns 1 if article has HTML content.
my $ArticleHasHTMLContent = $ArticleBackendObject->ArticleHasHTMLContent( TicketID => 1, ArticleID => 2, UserID => 1, );
Result:
$ArticleHasHTMLContent = 1; # or 0
Returns registered communication channel ID. Same for all article backends, don't override this particular method. In case of invalid article backend, this method will return false value.
my $ChannelID = $ArticleBackendObject->ChannelIDGet(); $ChannelID = 1;
Create an article. Override this method in your class.
my $ArticleID = $ArticleBackendObject->ArticleCreate( TicketID => 123, SenderType => 'agent', # agent|system|customer IsVisibleForCustomer => 1, UserID => 123, # Backend specific parameters: # From => 'Some Agent <email@example.com>', # To => 'Some Customer A <customer-a@example.com>', # Subject => 'some short description', # ... );
Events: ArticleCreate
Update an article. Override this method in your class.
my $Success = $ArticleBackendObject->ArticleUpdate( TicketID => 123, ArticleID => 123, Key => 'Body', Value => 'New Body', UserID => 123, );
Events: ArticleUpdate
Returns article data. Override this method in your class.
my %Article = $ArticleBackendObject->ArticleGet( TicketID => 123, ArticleID => 123, DynamicFields => 1, # Backend specific parameters: # RealNames => 1, );
Delete an article. Override this method in your class.
my $Success = $ArticleBackendObject->ArticleDelete( TicketID => 123, ArticleID => 123, UserID => 123, );
Get article attachment index as hash.
my %Index = $ArticleBackendObject->BackendSearchableFieldsGet();
Returns:
my %BackendSearchableFieldsGet = { From => 'from', To => 'to', Cc => 'cc', Subject => 'subject', Body => 'body', };
Get article attachment index as hash.
my %Index = $ArticleBackendObject->ArticleSearchableContentGet( TicketID => 123, # (required) ArticleID => 123, # (required) DynamicFields => 1, # (optional) To include the dynamic field values for this article on the return structure. RealNames => 1, # (optional) To include the From/To/Cc fields with real names. UserID => 123, # (required) );
Returns:
my %ArticleSearchData = [ { 'From' => 'Test User1 <testuser1@example.com>', 'To' => 'Test User2 <testuser2@example.com>', 'Cc' => 'Test User3 <testuser3@example.com>', 'Subject' => 'This is a test subject!', 'Body' => 'This is a body text!', ... }, ];
Use following functions from backends only.
Create a new article.
my $ArticleID = $Self->_MetaArticleCreate( TicketID => 123, SenderType => 'agent', # agent|system|customer IsVisibleForCustomer => 0, CommunicationChannel => 'Email', UserID => 1, );
Alternatively, you can pass in IDs too:
my $ArticleID = $Self->_MetaArticleCreate( TicketID => 123, SenderTypeID => 1, IsVisibleForCustomer => 0, CommunicationChannelID => 2, UserID => 1, );
Update an article.
Note: Keys SenderType
, SenderTypeID
and IsVisibleForCustomer
are implemented.
my $Success = $Self->_MetaArticleUpdate( TicketID => 123, # (required) ArticleID => 123, # (required) Key => 'IsVisibleForCustomer', # (optional) If not provided, only ChangeBy and ChangeTime will be updated. Value => 1, # (optional) UserID => 123, # (required) ); my $Success = $Self->_MetaArticleUpdate( TicketID => 123, ArticleID => 123, Key => 'SenderType', Value => 'agent', UserID => 123, );
Events: MetaArticleUpdate
Get article meta data.
my %Article = $Self->_MetaArticleGet( ArticleID => 42, TicketID => 23, );
Returns:
%Article = ( ArticleID => 1, TicketID => 2, CommunicationChannelID => 1, SenderTypeID => 1, IsVisibleForCustomer => 0, CreateTime => ..., CreateBy => ..., ChangeTime => ..., ChangeBy => ..., );
Delete an article. This must be called after all backend data has been deleted.
my $Success = $Self->_MetaArticleDelete( ArticleID => 123, UserID => 123, TicketID => 123, );
Returns article content with dynamic fields.
my %Data = $Self->_MetaArticleDynamicFieldsGet( Data => { # (required) article data TicketID => 1, ArticleID => 1, From => 'agent@mail.org', To => 'customer@mail.org', ... }, );
Returns: %Data = ( TicketID => 1, ArticleID => 1, From => 'agent@mail.org', To => 'customer@mail.org', ..., DynamicField_A => 'Value A', ... );
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.