
######
Create
######


****
NAME
****


Kernel::System::Calendar::Plugin::Ticket::Create - Ticket::Create plugin


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


Ticket appointment plugin.


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


new()
=====


create an object. Do not use it directly, instead use:


.. code-block:: perl

     use Kernel::System::ObjectManager;
     local $Kernel::OM = Kernel::System::ObjectManager->new();
     my $TicketCreatePluginObject = $Kernel::OM->Get('Kernel::System::Calendar::Plugin::Ticket::Create');



RenderOutput()
==============


renders the output as html.


.. code-block:: perl

     my $HTML = $TicketCreatePluginObject->RenderOutput(
         Param           => \%Param,
         GetParam        => \%GetParam,
         Appointment     => \%Appointment,
         Plugin          => \%Plugin,
         PermissionLevel => $PermissionLevel{$Permissions},
         UserID          => $Param{UserID},
     );


Returns:


.. code-block:: perl

     my $HTML = 'HTML';



Update()
========


updated accordingly as needed.


.. code-block:: perl

     my $Success = $TicketCreatePluginObject->Update(
         GetParam    => \%GetParam,
         Appointment => \%Appointment,
         Plugin      => {
             Name      => 'Ticket Create',
             PluginKey => 'TicketCreate',
             Block     => 'Ticket',
             Module    => 'Kernel::System::Calendar::Plugin::Ticket::Create',
             Prio      => '1000',
             Param     => {
                 CustomerID                  => 'customer',
                 CustomerUserID              => 'customer',
                 Link                        => 1,
                 LockID                      => 1,
                 Offset                      => 12,
                 OwnerID                     => 1,
                 PendingStateIDs             => [7,8,6],
                 TicketPendingTimeOffset     => 11,
                 TicketPendingTimeOffsetUnit => 60,
                 PriorityID                  => 1,
                 ProcessID                   => 'Process-37d25e23af417c91c78939039316f8c5',
                 QueueID                     => 1,
                 ResponsibleUserID           => 1,
                 SLAID                       => 1,
                 ServiceID                   => 1,
                 StateID                     => 1,
                 TicketCreateTimeType        => 'Never',                # Never|Relative|StartTime
                 TicketCreateOffset          => 2,
                 TicketCreateOffsetUnit      => 3600,
                 TicketCreateTime            => '2019-05-01 08:00:00',
                 TicketCreated               => 1,
                 TypeID                      => 1,
             },
         },
         UserID => 1,
     );


Returns:


.. code-block:: perl

     my $Success = 1;



Get()
=====


Get all plugin information.


.. code-block:: perl

     my $Data = $TicketCreatePluginObject->Get(
         GetParam    => \%GetParam,
         Appointment => \%Appointment,
         Plugin      => \%Plugin,
         UserID      => $Self->{UserID},
     );


Returns:


.. code-block:: perl

     my $Data = {};



AJAXUpdate()
============


Return an array with all plugin ajax update informations to build the LayoutObject selection JSON.


.. code-block:: perl

     my $PluginAJAX = $TicketCreatePluginObject->AJAXUpdate(
         GetParam    => \%GetParam,
         Appointment => \%Appointment,
         Plugin      => \%Plugin,
         UserID      => $Self->{UserID},
     );


Returns:


.. code-block:: perl

     my $PluginAJAX = (
         {
             Data         => \%Data,
             Name         => 'Plugin_HTML_Field',
             ID           => 'Plugin_HTML_Field',
             SelectedID   => 1,
             PossibleNone => 1,
             Translation  => 1,
             Class        => 'Modernize',
         },
     );



CalculateTicketCreateTime()
===========================


calculates the ticket create time as time stamp


.. code-block:: perl

     my $TicketCreateTime = $TicketCreatePluginObject->CalculateTicketCreateTime(
         StartTimeStamp          => '2019-05-01 08:00:00',
         EndTimeStamp            => '2019-05-02 08:00:00',
         TicketCreateOffset      => 2,
         TicketCreateOffsetUnit  => 3600,
         TicketCreateOffsetPoint => 'beforestart', #  afterstart | beforeend | afterend
     );


Returns:


.. code-block:: perl

     my $TicketCreateTime = 1;



TicketCreate()
==============


Creates tickets for appointments.


.. code-block:: perl

     my $TicketCounter = $TicketCreatePluginObject->TicketCreate(
         %CalendarBasedTicketCreationData,
         UserID => 123,
     );


Returns number of created tickets.


Cleanup()
=========


Cleanup obsolete calendar based ticket creation data.


.. code-block:: perl

     my $Counter = $TicketCreatePluginObject->Cleanup();


Returns:


.. code-block:: perl

     my $Counter = 1;




