
######
Common
######


****
NAME
****


Kernel::GenericInterface::Operation::Ticket::Common - Base class for all Ticket Operations


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


Init()
======


Initialize the operation by checking the web service configuration and gather of the dynamic fields.


.. code-block:: perl

     my $Return = $CommonObject->Init(
         WebserviceID => 1,
     );


Returns:


.. code-block:: perl

     $Return = {
         Success => 1,                       # or 0 in case of failure,
         ErrorMessage => 'Error Message',
     }



ValidateQueue()
===============


Checks if the given queue or queue ID is valid.


.. code-block:: perl

     my $Success = $CommonObject->ValidateQueue(
         QueueID => 123,
     );
 
     my $Success = $CommonObject->ValidateQueue(
         Queue   => 'some queue',
     );


Returns:


.. code-block:: perl

     my $Success = 1;            # or 0



ValidateLock()
==============


Checks if the given lock or lock ID is valid.


.. code-block:: perl

     my $Success = $CommonObject->ValidateLock(
         LockID => 123,
     );
 
     my $Success = $CommonObject->ValidateLock(
         Lock   => 'some lock',
     );


Returns:


.. code-block:: perl

     my $Success = 1;            # or 0



ValidateType()
==============


Checks if the given type or type ID is valid.


.. code-block:: perl

     my $Success = $CommonObject->ValidateType(
         TypeID => 123,
     );
 
     my $Success = $CommonObject->ValidateType(
         Type   => 'some type',
     );


Returns:


.. code-block:: perl

     my $Success = 1;            # or 0



ValidateCustomer()
==================


Checks if the given customer user or customer ID is valid.


.. code-block:: perl

     my $Success = $CommonObject->ValidateCustomer(
         CustomerUser   => 'some type',
     );


Returns:


.. code-block:: perl

     my $Success = 1;            # or 0



ValidateService()
=================


Checks if the given service or service ID is valid.


.. code-block:: perl

     my $Success = $CommonObject->ValidateService(
         ServiceID    => 123,
         CustomerUser => 'Test',
     );
 
     my $Success = $CommonObject->ValidateService(
         Service      => 'some service',
         CustomerUser => 'Test',
     );


Returns:


.. code-block:: perl

     my $Success = 1;            # or 0



ValidateSLA()
=============


Checks if the given sla or sla ID is valid.


.. code-block:: perl

     my $Success = $CommonObject->ValidateSLA(
         SLAID     => 12,
         # or
         SLA       => 'some SLA',
 
         ServiceID => 123,
         # or
         Service   => 'some service',
     );


Returns:


.. code-block:: perl

     my $Success = 1            # or 0



ValidateState()
===============


Checks if the given state or state ID is valid.


.. code-block:: perl

     my $Success = $CommonObject->ValidateState(
         StateID => 123,
     );
 
     my $Success = $CommonObject->ValidateState(
         State   => 'some state',
     );


Returns:


.. code-block:: perl

     my $Success = 1;            # or 0



ValidatePriority()
==================


Checks if the given priority or priority ID is valid.


.. code-block:: perl

     my $Success = $CommonObject->ValidatePriority(
         PriorityID => 123,
     );
 
     my $Success = $CommonObject->ValidatePriority(
         Priority   => 'some priority',
     );


Returns:


.. code-block:: perl

     my $Success = 1;            # or 0



ValidateOwner()
===============


Checks if the given owner or owner ID is valid.


.. code-block:: perl

     my $Success = $CommonObject->ValidateOwner(
         OwnerID => 123,
     );
 
     my $Success = $CommonObject->ValidateOwner(
         Owner   => 'some user',
     );


Returns:


.. code-block:: perl

     my $Success = 1;            # or 0



ValidateResponsible()
=====================


Checks if the given responsible or responsible ID is valid.


.. code-block:: perl

     my $Success = $CommonObject->ValidateResponsible(
         ResponsibleID => 123,
     );
 
     my $Success = $CommonObject->ValidateResponsible(
         Responsible   => 'some user',
     );


Returns:


.. code-block:: perl

     my $Success = 1;            # or 0



ValidatePendingTime()
=====================


Checks if the given pending time is valid.


.. code-block:: perl

     my $Success = $CommonObject->ValidatePendingTime(
         PendingTime => {
             Year   => 2011,
             Month  => 12,
             Day    => 23,
             Hour   => 15,
             Minute => 0,
         },
     );
 
     my $Success = $CommonObject->ValidatePendingTime(
         PendingTime => {
             Diff => 10080,
         },
     );


Returns:


.. code-block:: perl

     my $Success = 1;            # or 0



ValidateAutoResponseType()
==========================


Checks if the given AutoResponseType is valid.


.. code-block:: perl

     my $Success = $CommonObject->ValidateAutoResponseType(
         AutoResponseType => 'Some AutoResponse',
     );


Returns:


.. code-block:: perl

     my $Success = 1;            # or 0



ValidateFrom()
==============


Checks if the given from is valid.


.. code-block:: perl

     my $Success = $CommonObject->ValidateFrom(
         From => 'user@domain.com',
     );


Returns:


.. code-block:: perl

     my $Success = 1;            # or 0



ValidateArticleCommunicationChannel()
=====================================


Checks if provided Communication Channel is valid.


.. code-block:: perl

     my $Success = $CommonObject->ValidateArticleCommunicationChannel(
         CommunicationChannel   => 'Internal',   # optional
                                                 # or
         CommunicationChannelID => 1,            # optional
     );


Returns:


.. code-block:: perl

     my $Success = 1;            # or 0



ValidateSenderType()
====================


Checks if the given SenderType or SenderType ID is valid.


.. code-block:: perl

     my $Success = $CommonObject->ValidateSenderType(
         SenderTypeID => 123,
     );
 
     my $Success = $CommonObject->ValidateenderType(
         SenderType => 'some SenderType',
     );


Returns:


.. code-block:: perl

     my $Success = 1;            # or 0



ValidateMimeType()
==================


Checks if the given MimeType is valid.


.. code-block:: perl

     my $Success = $CommonObject->ValidateMimeType(
         MimeType => 'some MimeType',
     );


Returns:


.. code-block:: perl

     my $Success = 1;            # or 0



ValidateCharset()
=================


Checks if the given Charset is valid.


.. code-block:: perl

     my $Success = $CommonObject->ValidateCharset(
         Charset => 'some charset',
     );


Returns:


.. code-block:: perl

     my $Success = 1;            # or 0



ValidateHistoryType()
=====================


Checks if the given HistoryType is valid.


.. code-block:: perl

     my $Success = $CommonObject->ValidateHistoryType(
         HistoryType => 'some HostoryType',
     );


Returns:


.. code-block:: perl

     my $Success = 1;            # or 0



ValidateTimeUnit()
==================


Checks if the given TimeUnit is valid.


.. code-block:: perl

     my $Success = $CommonObject->ValidateTimeUnit(
         TimeUnit => 1,
     );


Returns:


.. code-block:: perl

     my $Success = 1;            # or 0



ValidateUserID()
================


Checks if the given user ID is valid.


.. code-block:: perl

     my $Success = $CommonObject->ValidateUserID(
         UserID => 123,
     );


Returns:


.. code-block:: perl

     my $Success = 1;            # or 0



ValidateDynamicFieldName()
==========================


Checks if the given dynamic field name is valid.


.. code-block:: perl

     my $Success = $CommonObject->ValidateDynamicFieldName(
         Name => 'some name',
     );


Returns:


.. code-block:: perl

     my $Success = 1;            # or 0



ValidateDynamicFieldValue()
===========================


Checks if the given dynamic field value is valid.


.. code-block:: perl

     my $Success = $CommonObject->ValidateDynamicFieldValue(
         Name  => 'some name',
         Value => 'some value',          # String or Integer or DateTime format
     );
 
     my $Success = $CommonObject->ValidateDynamicFieldValue(
         Value => [                      # Only for fields that can handle multiple values like
             'some value',               #   Multiselect
             'some other value',
         ],
     );
 
     returns
     $Success = 1                        # or 0



ValidateDynamicFieldObjectType()
================================


Checks if the given dynamic field name is valid.


.. code-block:: perl

     my $Success = $CommonObject->ValidateDynamicFieldObjectType(
         Name    => 'some name',
         Article => 1,               # if article exists
     );


Returns:


.. code-block:: perl

     my $Success = 1;            # or 0



SetDynamicFieldValue()
======================


Sets the value of a dynamic field.


.. code-block:: perl

     my $Result = $CommonObject->SetDynamicFieldValue(
         Name      => 'some name',           # the name of the dynamic field
         Value     => 'some value',          # String or Integer or DateTime format
         TicketID  => 123,
         ArticleID => 123,
         UserID    => 123,
     );
 
     my $Result = $CommonObject->SetDynamicFieldValue(
         Name   => 'some name',           # the name of the dynamic field
         Value => [
             'some value',
             'some other value',
         ],
         UserID => 123,
     );


Returns:


.. code-block:: perl

     my $Result = {
         Success => 1,                        # if everything is ok
     }
 
     my $Result = {
         Success      => 0,
         ErrorMessage => 'Error description'
     }



CreateAttachment()
==================


Creates a new attachment for the given article.


.. code-block:: perl

     my $Result = $CommonObject->CreateAttachment(
         TicketID   => 123,
         Attachment => $Attachment,          # file content (Base64 encoded)
         ArticleID  => 456,
         UserID     => 123,
     );


Returns:


.. code-block:: perl

     my $Result = {
         Success => 1,                       # if everything is ok
     }
 
     my $Result = {
         Success      => 0,
         ErrorMessage => 'Error description'
     }



CheckCreatePermissions ()
=========================


Tests if the user have the permissions to create a ticket on a determined queue.


.. code-block:: perl

     my $Result = $CommonObject->CheckCreatePermissions(
         Ticket   => $TicketHashReference,
         UserID   => 123,            # or 'CustomerLogin'
         UserType => 'Agent',        # or 'Customer'
     );


Returns:


.. code-block:: perl

     my $Success = 1;                    # if everything is OK



CheckAccessPermissions()
========================


Tests if the user have access permissions over a ticket.


.. code-block:: perl

     my $Result = $CommonObject->CheckAccessPermissions(
         TicketID       => 123,
         UserID         => 123,                      # or 'CustomerLogin'
         UserType       => 'Agent',                  # or 'Customer'
         PermissionType => 'rw',                     # defaults to 'ro'
     );


Returns:


.. code-block:: perl

     my $Success = 1;                    # if everything is OK



_ValidateUser()
===============


Checks if the given user or user ID is valid.


.. code-block:: perl

     my $Success = $CommonObject->_ValidateUser(
         UserID => 123,
     );
 
     my $Success = $CommonObject->_ValidateUser(
         User   => 'some user',
     );


Returns:


.. code-block:: perl

     my $Success = 1;            # or 0





