
#########
Signature
#########


****
NAME
****


Kernel::System::Signature - signature lib


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


All signature functions.


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


new()
=====


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


.. code-block:: perl

     my $SignatureObject = $Kernel::OM->Get('Kernel::System::Signature');



SignatureAdd()
==============


add new signatures


.. code-block:: perl

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



SignatureGet()
==============


get signatures attributes


.. code-block:: perl

     my %Signature = $SignatureObject->SignatureGet(
         ID => 123,
     );



SignatureUpdate()
=================


update signature attributes


.. code-block:: perl

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



SignatureDelete()
=================


delete a signature from the database by it's id


.. code-block:: perl

     my $Success = $SignatureObject->SignatureDelete(
         ID     => 1,
         UserID => 1,
     );



SignatureExport()
=================


export a signature


.. code-block:: perl

     my $ExportData = $SignatureObject->SignatureExport(
         # required either ID or ExportAll
         ID                       => $SignatureID,
         ExportAll                => 0,               # possible: 0, 1
 
         UserID                   => 1,               # required
     }


returns Signature hashes in an array with data:


.. code-block:: perl

     my $ExportData =
     [
         {
             'ID' => 1,
             'Name' => 'system standard signature (en)',
             'Text' => '
 Your Ticket-Team


<OTRS_Agent_UserFirstname> <OTRS_Agent_UserLastname>

--
Super Support - Waterford Business Park
5201 Blue Lagoon Drive - 8th Floor & 9th Floor - Miami, 33126 USA
Email: hot@example.com - Web: http://www.example.com/
--',
            'CreateTime' => '2024-02-06 14:49:56',
            'Queues' => {},
            'Comment'     => 'Standard Signature.',
            'ValidID'     => 1,
            'ChangeTime'  => '2024-02-06 14:49:56',
            'ContentType' => 'text/plain; charset=utf-8'
        },
        {
            'ID' => 2,
            'Name' => 'system standard signature (pl)',
            'Text' => '
Your Ticket-Team

<OTRS_Agent_UserFirstname> <OTRS_Agent_UserLastname>

--
Super Support - Waterford Business Park
5201 Blue Lagoon Drive - 8th Floor & 9th Floor - Miami, 33126 USA
Email: hot@example.com - Web: http://www.example.com/
--',
            'CreateTime' => '2024-07-22 11:58:32',
            'Queues'     => {},
            'Comment'     => 'Standard Signature.',
            'ValidID'     => 1,
            'ChangeTime'  => '2024-07-22 11:58:32',
            'ContentType' => 'text/plain; charset=utf-8'
        }
    ];


SignatureImport()
=================


import a signature via YAML content


.. code-block:: perl

     my $ImportResult = $SignatureObject->SignatureImport(
         Content                     => $YAMLContent, # mandatory, YAML format
         OverwriteExistingSignatures => 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             => 'Signature1, Signature2',           # string of Signatures correctly added
         Updated           => 'Signature3, Signature4',           # string of Signatures correctly updated
         NotUpdated        => 'Signature5, Signature6',           # string of Signatures not updated due to existing entity
                                                                  # with the same name
         Errors            => 'Signature',                        # string of Signatures that could not be added or updated
         AdditionalErrors  => ['Some error occured!', 'Error2!'], # list of additional error not necessarily related to specified Signature
     };



SignatureCopy()
===============


copy a signature


.. code-block:: perl

     my $NewSignatureID = $SignatureObject->SignatureCopy(
         ID     => 1, # mandatory
         UserID => 1, # mandatory
     );



SignatureExportDataGet()
========================


get data to export signature


.. code-block:: perl

     my %SignatureData = $SignatureObject->SignatureExportDataGet(
         ID               => 1, # mandatory
     );


Returns:


.. code-block:: perl

     my %SignatureData = (
         'ContentType' => 'text/plain; charset=utf-8',
         'ValidID' => 1,
         'Comment' => 'Standard Signature.',
         'CreateTime' => '2024-07-22 11:58:32',
         'Queues' => {
             '6' => 'Queuetest1192009180100007',
             '21' => 'Queuetest1450009665400005',
         },
         'ID' => 2,
         'Text' => '
 Your Ticket-


<OTRS_Agent_UserFirstname> <OTRS_Agent_UserLastname>

--
Super Support - Waterford Business Park
5201 Blue Lagoon Drive - 8th Floor & 9th Floor - Miami, 33126 USA
Email: hot@example.com - Web: http://www.example.com/
--',
        'Name' => 'system standard signature (pl)',
        'ChangeTime' => '2024-07-22 12:13:18'
    )


SignatureExportFilenameGet()
============================


get export file name based on signature name


.. code-block:: perl

     my $Filename = $SignatureObject->SignatureExportFilenameGet(
         Name => 'Signature_1',
         Format => 'YAML',
     );



SignatureQueuesList()
=====================


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


.. code-block:: perl

     my %SignatureQueues = $SignatureObject->SignatureQueuesList(
         ID => 1, # mandatory
     );


Returns:


.. code-block:: perl

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



SignatureQueueLinkBySignature()
===============================


assign a list of queues to a signature


.. code-block:: perl

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



SignatureList()
===============


get signature list


.. code-block:: perl

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


returns:


.. code-block:: perl

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





