
#################
SystemMaintenance
#################


****
NAME
****


Kernel::System::SystemMaintenance


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


SystemMaintenance backend


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


new()
=====


create a SystemMaintenance object. Do not use it directly, instead use:


.. code-block:: perl

     my $SystemMaintenanceObject = $Kernel::OM->Get('Kernel::System::SystemMaintenance');



SystemMaintenanceAdd()
======================


add new SystemMaintenance

returns the id of the created SystemMaintenance if success or undef otherwise


.. code-block:: perl

     my $ID = $SystemMaintenance->SystemMaintenanceAdd(
         StartDate        => 1485346000,              # mandatory
         StopDate         => 1485349600,              # mandatory
         Comment          => 'Comment',               # mandatory
         LoginMessage     => 'A login message.',      # optional
         ShowLoginMessage => 1,                       # optional
         NotifyMessage    => 'Notification message.', # optional
         ValidID          => 1,                       # mandatory
         UserID           => 123,                     # mandatory
     );


Returns:


.. code-block:: perl

     $ID = 567;



SystemMaintenanceDelete()
=========================


delete a SystemMaintenance

returns 1 if success or undef otherwise


.. code-block:: perl

     my $Success = $SystemMaintenanceObject->SystemMaintenanceDelete(
         ID     => 123,
         UserID => 123,
     );



SystemMaintenanceGet()
======================


get SystemMaintenance attributes


.. code-block:: perl

     my $SystemMaintenance = $SystemMaintenanceObject->SystemMaintenanceGet(
         ID     => 123,          # mandatory
         UserID => 123,          # mandatory
     );


Returns:


.. code-block:: perl

     $SystemMaintenance = {
         ID             => 123,
         StartDate        => 1485346000,
         StopDate         => 1485349600,
         Comment          => 'Comment',
         LoginMessage     => 'A login message.',
         ShowLoginMessage => 1,
         NotifyMessage    => 'Notification message.',
         ValidID          => 1,
         CreateTime       => 1485346000,
         ChangeTime       => 1485347300,
         CreateBy         => 'user_login',
         ChangeBy         => 'user_login',
     };



SystemMaintenanceUpdate()
=========================


update SystemMaintenance attributes

returns 1 if success or undef otherwise


.. code-block:: perl

     my $Success = $SystemMaintenanceObject->SystemMaintenanceUpdate(
         ID               => 123,                        # mandatory
         StartDate        => 1485346000,                 # mandatory
         StopDate         => 1485349600,                 # mandatory
         Comment          => 'Comment',                  # mandatory
         LoginMessage     => 'Description',              # optional
         ShowLoginMessage => 1,                          # optional
         NotifyMessage    => 'Notification for showing', # optional
         ValidID          => 'ValidID',                  # mandatory
         UserID           => 123,                        # mandatory
     );



SystemMaintenanceList()
=======================


get an SystemMaintenance list


.. code-block:: perl

     my $List = $SystemMaintenanceObject->SystemMaintenanceList(
         ValidIDs => ['1','2'],           # optional, to filter SystemMaintenances that match listed valid IDs
         UserID   => 1,
     );


Returns a hash with the SystemMaintenance IDs as keys:


.. code-block:: perl

     $List = {
         42 => 1,
         24 => 1,
     }



SystemMaintenanceListGet()
==========================


get an SystemMaintenance list with all SystemMaintenance details


.. code-block:: perl

     my $List = $SystemMaintenanceObject->SystemMaintenanceListGet(
         UserID   => 1,
         ValidIDs => ['1','2'], # optional, to filter SystemMaintenances that match listed valid IDs
     );


Returns:


.. code-block:: perl

     $List = [
         {
             ID               => 123,
             StartDate        => 1485346000,
             StopDate         => 1485349600,
             Comment          => 'Comment',
             LoginMessage     => 'The message',
             ShowLoginMessage => 1,
             NotifyMessage    => 'The notification',
             ValidID          => 1,
             CreateTime       => 1485342400,
             ChangeTime       => 1485343700,
         },
         {
             ID               => 123,
             StartDate        => 1485346000,
             StopDate         => 1485349600,
             Comment          => 'Other Comment',
             LoginMessage     => 'To be shown on the login screen.',
             ShowLoginMessage => 0,
             NotifyMessage    => 'A different notification',
             ValidID          => 1,
             CreateTime       => 1485342400,
             ChangeTime       => 1485343700,
         },
     ];



SystemMaintenanceIsActive()
===========================


get a SystemMaintenance active flag


.. code-block:: perl

     my $ActiveMaintenance = $SystemMaintenanceObject->SystemMaintenanceIsActive();


Returns:


.. code-block:: perl

     $ActiveMaintenance = 7 # a System Maintenance ID



SystemMaintenanceIsComing()
===========================


Get a upcoming SystemMaintenance start and stop date.


.. code-block:: perl

     my %SystemMaintenanceIsComing = $SystemMaintenanceObject->SystemMaintenanceIsComing();


Returns:


.. code-block:: perl

     %SystemMaintenanceIsComing = {
         StartDate => 1515614400,
         StopDate  => 1515607200,
     };





