
#################
TemplateGenerator
#################


****
NAME
****


Kernel::System::TemplateGenerator - signature lib


***********
DESCRIPTION
***********


All signature functions.


****************
PUBLIC INTERFACE
****************


new()
=====


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


.. code-block:: perl

     my $TemplateGeneratorObject = $Kernel::OM->Get('Kernel::System::TemplateGenerator');



Salutation()
============


generate salutation


.. code-block:: perl

     my $Salutation = $TemplateGeneratorObject->Salutation(
         TicketID => 123,
         UserID   => 123,
         Data     => $ArticleHashRef,
     );


returns
    Text
    ContentType


Signature()
===========


generate salutation


.. code-block:: perl

     my $Signature = $TemplateGeneratorObject->Signature(
         TicketID => 123,
         UserID   => 123,
         Data     => $ArticleHashRef,
     );


or


.. code-block:: perl

     my $Signature = $TemplateGeneratorObject->Signature(
         QueueID => 123,
         UserID  => 123,
         Data    => $ArticleHashRef,
     );


returns
    Text
    ContentType


Sender()
========


generate sender address (FROM string) for emails


.. code-block:: perl

     my $Sender = $TemplateGeneratorObject->Sender(
         QueueID => 123,
         UserID  => 123,
     );


returns:


.. code-block:: perl

     John Doe at Super Support <service@example.com>


and it returns the quoted real name if necessary


.. code-block:: perl

     "John Doe, Support" <service@example.tld>



Template()
==========


generate template


.. code-block:: perl

     my $Template = $TemplateGeneratorObject->Template(
         TemplateID => 123,
         TicketID   => 123,                  # Optional
         Data       => $ArticleHashRef,      # Optional
         UserID     => 123,
     );


Returns:


.. code-block:: perl

     $Template => 'Some text';



GenericAgentArticle()
=====================


generate internal or external notes


.. code-block:: perl

     my $GenericAgentArticle = $TemplateGeneratorObject->GenericAgentArticle(
         Notification => $NotificationDataHashRef,
         TicketID     => 123,
         UserID       => 123,
         Data         => $ArticleHashRef,             # Optional
     );



Attributes()
============


generate attributes


.. code-block:: perl

     my %Attributes = $TemplateGeneratorObject->Attributes(
         TicketID   => 123,
         ArticleID  => 123,
         ResponseID => 123,
         UserID     => 123,
         Action     => 'Forward', # Possible values are Reply and Forward, Reply is default.
     );


returns
    StandardResponse
    Salutation
    Signature


AutoResponse()
==============


generate response


.. code-block:: perl

     my %AutoResponse = $TemplateGeneratorObject->AutoResponse(
         TicketID         => 123,
         OrigHeader       => {},
         AutoResponseType => 'auto reply',
         UserID           => 123,
         UserType         => 'Agent', # optional
     );



NotificationEvent()
===================


replace all OTRS smart tags in the notification body and subject


.. code-block:: perl

     my %NotificationEvent = $TemplateGeneratorObject->NotificationEvent(
         TicketData            => $TicketDataHashRef,
         Recipient             => $UserDataHashRef,          # Agent or Customer data get result
         Notification          => $NotificationDataHashRef,
         CustomerMessageParams => $ArticleHashRef,           # optional
         UserID                => 123,
     );



_RemoveUnSupportedTag()
=======================


cleanup all not supported tags


.. code-block:: perl

     my $Text = $TemplateGeneratorObject->_RemoveUnSupportedTag(
         Text => $SomeTextWithTags,
         ListOfUnSupportedTag => \@ListOfUnSupportedTag,
     );



_MaskSensitiveValue()
=====================


Mask sensitive value, i.e. a password, a security token, etc.


.. code-block:: perl

     my $MaskedValue = $Self->_MaskSensitiveValue(
         Key      => 'DatabasePassword', # (required) Name of the field/key.
         Value    => 'secretvalue',      # (optional) Value to potentially mask.
         IsConfig => 1,                  # (optional) Whether the value is a config option, default: 0.
     );


Returns masked value, in case the key is matched:


.. code-block:: perl

    $MaskedValue = 'xxx';





