
##########
Salutation
##########


****
NAME
****


Kernel::System::Salutation - salutation lib


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


All salutation functions.


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


new()
=====


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


.. code-block:: perl

     my $SalutationObject = $Kernel::OM->Get('Kernel::System::Salutation');



SalutationAdd()
===============


add new salutations


.. code-block:: perl

     my $ID = $SalutationObject->SalutationAdd(
         Name        => 'New Salutation',
         Text        => "--\nSome Salutation Infos",
         ContentType => 'text/plain; charset=utf-8',
         Comment     => 'some comment',
         ValidID     => 1,
         UserID      => 123,
     );



SalutationGet()
===============


get salutations attributes


.. code-block:: perl

     my %Salutation = $SalutationObject->SalutationGet(
         ID => 123,
     );



SalutationUpdate()
==================


update salutation attributes


.. code-block:: perl

     $SalutationObject->SalutationUpdate(
         ID          => 123,
         Name        => 'New Salutation',
         Text        => "--\nSome Salutation Infos",
         ContentType => 'text/plain; charset=utf-8',
         Comment     => 'some comment',
         ValidID     => 1,
         UserID      => 123,
     );



SalutationDelete()
==================


delete a salutation from the database by it's id


.. code-block:: perl

     my $Success = $SalutationObject->SalutationDelete(
         ID     => 1,
         UserID => 1,
     );



SalutationExport()
==================


export a salutation


.. code-block:: perl

     my $ExportData = $SalutationObject->SalutationExport(
         # required either ID or ExportAll
         ID                       => $SalutationID,
         ExportAll                => 0,               # possible: 0, 1
 
         UserID                   => 1,               # required
     }


returns Salutation hashes in an array with data:


.. code-block:: perl

     my $ExportData =
     [
         {
             'Text' => 'Dear &lt;OTRS_CUSTOMER_REALNAME&gt;,<br />
 <br />
 Thank you for your request.<br />
 &nbsp;',
             'ValidID' => 1,
             'ChangeTime' => '2024-07-17 10:50:54',
             'Name' => 'system standard salutation (en)',
             'ContentType' => 'text/html',
             'Comment' => 'Standard Salutation.',
             'Queues' => {},
             'ID' => 1,
             'CreateTime' => '2024-02-06 14:49:56'
         },
         {
             'Text' => 'Dear &lt;OTRS_CUSTOMER_REALNAME&gt;,<br />
 <br />
 Thank you for your request.<br />
 &nbsp;',
             'ValidID' => 1,
             'ChangeTime' => '2024-07-17 12:43:03',
             'Name' => 'system standard salutation (en) (copy)',
             'ContentType' => 'text/html',
             'Comment' => 'Standard Salutation.',
             'Queues' => {},
             'ID' => 3,
             'CreateTime' => '2024-07-17 11:52:45'
         }
     ];



SalutationImport()
==================


import a salutation via YAML content


.. code-block:: perl

     my $ImportResult = $SalutationObject->SalutationImport(
         Content                      => $YAMLContent, # mandatory, YAML format
         OverwriteExistingSalutations => 0,            # optional, possible: 0, 1
         UserID                       => 1,            # mandatory
     );


Returns:


.. code-block:: perl

     $Result = {
         Success            => 1,                                  # 1 if success or undef if operation could not
                                                                   # be performed
         Message            => 'The Message to show.',             # error message
         Added              => 'Salutation1, Salutation2',         # string of Salutations correctly added
         Updated            => 'Salutation3, Salutation4',         # string of Salutations correctly updated
         NotUpdated         => 'Salutation5, Salutation6',         # string of Salutations not updated due to existing entity
                                                                   # with the same name
         Errors             => 'Salutation5',                      # string of Salutations that could not be added or updated
         AdditionalErrors   => ['Some error occured!', 'Error2!'], # list of additional error not necessarily related to specified salutation
     };



SalutationCopy()
================


copy a salutation


.. code-block:: perl

     my $NewSalutationID = $SalutationObject->SalutationCopy(
         ID     => 1, # mandatory
         UserID => 1, # mandatory
     );



SalutationExportDataGet()
=========================


get data to export salutation


.. code-block:: perl

     my %SalutationData = $SalutationObject->SalutationExportDataGet(
         ID               => 1, # mandatory
     );


Returns:


.. code-block:: perl

     my %SalutationData = (
         'ContentType' => 'text/html',
         'Comment' => 'Standard Salutation.',
         'ValidID' => 1,
         'CreateTime' => '2024-02-06 14:49:56',
         'Queues' => {
             '6' => 'Queuetest1192009180100007',
             '21' => 'Queuetest1450009665400005',
         },
         'ID' => 1,
         'Text' => 'Dear &lt;OTRS_CUSTOMER_REALNAME&gt;,<br />
 <br />
 Thank you for your request.<br />
 &nbsp;',
         'ChangeTime' => '2024-07-19 14:27:34',
         'Name' => 'system standard salutation (en)'
     )



SalutationExportFilenameGet()
=============================


get export file name based on salutation name


.. code-block:: perl

     my $Filename = $SalutationObject->SalutationExportFilenameGet(
         Name => 'Salutation_1',
         Format => 'YAML',
     );



SalutationQueuesList()
======================


get a list of the queues that have been linked to salutation


.. code-block:: perl

     my %SalutationQueues = $SalutationObject->SalutationQueuesList(
         ID => 1, # mandatory
     );


Returns:


.. code-block:: perl

     my %Queues = (
         1 => 'queue1',
         2 => 'queue2',
     )



SalutationQueueLinkBySalutation()
=================================


assign a list of queues to a salutation


.. code-block:: perl

     my $Success = $SalutationObject->SalutationQueueLinkBySalutation(
         QueueIDs => [1,2,3],
         ID       => 1,
         UserID   => 1,
     );



SalutationList()
================


get salutation list


.. code-block:: perl

     my %List = $SalutationObject->SalutationList();
 
     my %List = $SalutationObject->SalutationList(
         Valid => 0,
     );





