
######
Plugin
######


****
NAME
****


Kernel::System::Calendar::Plugin - Plugin lib


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


Abstraction layer for appointment plugins.


****************
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 $PluginObject = $Kernel::OM->Get('Kernel::System::Calendar::Plugin');



PluginList()
============


returns the hash of registered plugins


.. code-block:: perl

     my $PluginList = $PluginObject->PluginList();



PluginKeys()
============


returns the hash of proper plugin keys for lowercase matching


.. code-block:: perl

     my $PluginKeys = $PluginObject->PluginKeys();



PluginFunction()
================


run given plugin function with all existing params.


.. code-block:: perl

     # LinkAdd
     my $Result = $PluginObject->PluginFunction(
         PluginKey      => 'TicketLink',
         PluginFunction => 'LinkAdd',
         PluginData     => {
             TargetKey => 42,    # TicketID, depends on TargetObject
             SourceKey => 1,     # AppointmentID
             UserID    => 1,
         }
     );
 
     # LinkList
     my $Result = $PluginObject->PluginFunction(
         PluginKey      => 'TicketLink',
         PluginFunction => 'LinkList',
         PluginData     => {
             AppointmentID => 1,     # AppointmentID
             UserID        => 1,
             URL           => 'http://znuny.local/index.pl?Action=AgentTicketZoom;TicketID=%s', # optional
         }
     );
 
     # LinkDelete
     my $Result = $PluginObject->PluginFunction(
         PluginKey      => 'TicketLink',
         PluginFunction => 'LinkDelete',
         PluginData     => {
             AppointmentID => 1,
             UserID        => 1,
         },
     );
 
     # Search
     my $Result = $PluginObject->PluginFunction(
         PluginKey      => 'TicketLink',
         PluginFunction => 'Search',
         PluginData     => {
             UserID    => 1,
             Search    => 'SearchTerm',      # (required) Search string
                                             # or
             ObjectID  => $TicketID          # (required) Object ID
         },
     );



PluginGroups()
==============


return an array of plugin groups in correct order.


.. code-block:: perl

     my @PluginGroups = $PluginObject->PluginGroups(
         UserID => 123,
     );


Returns:


.. code-block:: perl

     my @PluginGroups = (
         {
             'Title' => 'Ticket',
             'Prio'  => 1000,
             'Key'   => 'Ticket'
         },
         {
             'Key'   => 'Miscellaneous',
             'Title' => 'Miscellaneous',
             'Prio'  => 9000
         }
     );



PluginGetParam()
================


Returns all params from ParamObject (Web::Request) of each plugin.


.. code-block:: perl

     my %PluginGetParam = $PluginObject->PluginGetParam(
         'Plugin_TicketCreate_PriorityID'                  => '3',
         'Plugin_TicketCreate_Offset'                      => '1',
         'Plugin_TicketCreate_LockID'                      => '2',
         'Plugin_TicketCreate_TicketPendingTimeOffsetUnit' => '86400',
         'Plugin_TicketCreate_QueueID[]'                   => '[4,1,28]',
         'Plugin_TicketCreate_OffsetPoint'                 => 'beforestart',
         'Plugin_TicketCreate_TypeID'                      => '105',
         'Plugin_TicketCreate_OffsetUnit'                  => '60',
         'Plugin_TicketCreate_SLAID'                       => '1',
         'Plugin_TicketCreate_ResponsibleUserID'           => '1',
         'Plugin_TicketCreate_ServiceID'                   => '1',
         'Plugin_TicketCreate_OwnerID'                     => '1',
         'Plugin_TicketCreate_StateID'                     => '1',
         'Plugin_TicketCreate_TimeType'                    => 'Never',
         'Plugin_TicketLink_LinkList[]'                      => '[438,414]',
     );
 
     my %PluginGetParam = $PluginObject->PluginGetParam(
         'Plugin[TicketCreate][Config][PriorityID]'                  => '3',
         'Plugin[TicketCreate][Config][Offset]'                      => '1',
         'Plugin[TicketCreate][Config][LockID]'                      => '2',
         'Plugin[TicketCreate][Config][TicketPendingTimeOffsetUnit]' => '86400',
         'Plugin[TicketCreate][Config][QueueID]'                     => '[4,1,28]',
         'Plugin[TicketCreate][Config][OffsetPoint]'                 => 'beforestart',
         'Plugin[TicketCreate][Config][TypeID]'                      => '105',
         'Plugin[TicketCreate][Config][OffsetUnit]'                  => '60',
         'Plugin[TicketCreate][Config][SLAID]'                       => '1',
         'Plugin[TicketCreate][Config][ResponsibleUserID]'           => '1',
         'Plugin[TicketCreate][Config][ServiceID]'                   => '1',
         'Plugin[TicketCreate][Config][OwnerID]'                     => '1',
         'Plugin[TicketCreate][Config][StateID]'                     => '1',
         'Plugin[TicketCreate][Config][TimeType]'                    => 'Never',
         'Plugin[TicketLink][Config][LinkList]'                      => '[438,414]',
     );


Returns:


.. code-block:: perl

     my %PluginGetParam = (
         'TicketCreate' => {
             'PriorityID'                  => '3',
             'Offset'                      => '1',
             'LockID'                      => '2',
             'TicketPendingTimeOffsetUnit' => '86400',
             'QueueID'                     => [
                 '4',
                 '1',
                 '28'
             ],
             'OffsetPoint'       => 'beforestart',
             'TypeID'            => '105',
             'OffsetUnit'        => '60',
             'SLAID'             => '1',
             'ResponsibleUserID' => '1',
             'ServiceID'         => '1',
             'OwnerID'           => '1',
             'StateID'           => '1',
             'TimeType'          => 'Never'
         },
         'TicketLink' => {
             'LinkList' => [
                 '438',
                 '414'
             ]
         }
     );



DataAdd()
=========


creates data attributes


.. code-block:: perl

     my $CreatedID = $PluginObject->DataAdd(
         ID            => '...',
         AppointmentID => '...',
         PluginKey     => '...',
         Config        => '...',
         CreateTime    => '...',
         CreateBy      => '...',
         ChangeTime    => '...',
         ChangeBy      => '...',
         UserID        => 1,
     );


Returns:


.. code-block:: perl

     my $CreatedID = 1;



DataGet()
=========


get data attributes


.. code-block:: perl

     my %Data = $PluginObject->DataGet(
         ID            => '...', # optional
         AppointmentID => '...', # optional
         PluginKey     => '...', # optional
         Config        => '...', # optional
         CreateTime    => '...', # optional
         CreateBy      => '...', # optional
         ChangeTime    => '...', # optional
         ChangeBy      => '...', # optional
         UserID        => 1,
     );


Returns:


.. code-block:: perl

     my %Data = (
         ID            => '...',
         AppointmentID => '...',
         PluginKey     => '...',
         Config        => '...',
         CreateTime    => '...',
         CreateBy      => '...',
         ChangeTime    => '...',
         ChangeBy      => '...',
     );



DataListGet()
=============


get list data with attributes


.. code-block:: perl

     my @Data = $PluginObject->DataListGet(
         ID            => '...', # optional
         AppointmentID => '...', # optional
         PluginKey     => '...', # optional
         Config        => '...', # optional
         CreateTime    => '...', # optional
         CreateBy      => '...', # optional
         ChangeTime    => '...', # optional
         ChangeBy      => '...', # optional
         UserID        => 1,
     );


Returns:


.. code-block:: perl

     my @Data = (
         {
             ID            => '...',
             AppointmentID => '...',
             PluginKey     => '...',
             Config        => '...',
             CreateTime    => '...',
             CreateBy      => '...',
             ChangeTime    => '...',
             ChangeBy      => '...',
         },
         # ...
     );



DataUpdate()
============


update data attributes


.. code-block:: perl

     my $Success = $PluginObject->DataUpdate(
         ID     => 1234,
         UserID => 1,
         # all other attributes are optional
     );


Returns:


.. code-block:: perl

     my $Success = 1; # 1|0



DataDelete()
============


deletes data attributes - at least one is required.


.. code-block:: perl

     my $Success = $PluginObject->DataDelete(
         ID            => '...', # optional
         AppointmentID => '...', # optional
         PluginKey     => '...', # optional
         Config        => '...', # optional
         CreateTime    => '...', # optional
         CreateBy      => '...', # optional
         ChangeTime    => '...', # optional
         ChangeBy      => '...', # optional
         UserID        => 1,
     );


Returns:


.. code-block:: perl

     my $Success = 1; # 1|0



DataSearch()
============


search for value in defined attributes


.. code-block:: perl

     my %Data = $PluginObject->DataSearch(
         Search        => 'test*test',
         ID            => '...', # optional
         AppointmentID => '...', # optional
         PluginKey     => '...', # optional
         Config        => '...', # optional
         CreateTime    => '...', # optional
         CreateBy      => '...', # optional
         ChangeTime    => '...', # optional
         ChangeBy      => '...', # optional
         UserID        => 1,
     );


Returns:


.. code-block:: perl

     my %Data = (
         '1' => {
             'ID'            => '...',
             'AppointmentID' => '...',
             'PluginKey'     => '...',
             'Config'        => '...',
             'CreateTime'    => '...',
             'CreateBy'      => '...',
             'ChangeTime'    => '...',
             'ChangeBy'      => '...',
         },
         # ...
     );



InitConfig()
============


init config for object


.. code-block:: perl

     my $Success = $PluginObject->InitConfig();


Returns:


.. code-block:: perl

     my $Success = 1;





