
####
Util
####


****
NAME
****


Kernel::System::Util


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


All Util functions.


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



IsITSMInstalled()
=================


Checks if ITSM is installed.


.. code-block:: perl

     my $IsITSMInstalled = $UtilObject->IsITSMInstalled();
 
     Returns 1 if ITSM is installed and 0 otherwise.



IsITSMIncidentProblemManagementInstalled()
==========================================


Checks if ITSMIncidentProblemManagement is installed.


.. code-block:: perl

     my $IsITSMIncidentProblemManagementInstalled = $UtilObject->IsITSMIncidentProblemManagementInstalled();
 
     Returns 1 if ITSMIncidentProblemManagement is installed and 0 otherwise.



IsFrontendContext()
===================


Checks if current code is being executed in frontend context, e.g. agent frontend.


.. code-block:: perl

     my $IsFrontendContext = $UtilObject->IsFrontendContext();
 
     Returns 1 if current code is being executed in frontend context.
     Returns 0 if otherwise (e.g. console command context).



Base64DeepEncode()
==================



.. code-block:: perl

     Base-64 encodes elements of given data for given keys.
     If data is an array, all of its child elements will be checked for given keys whose elements
     will be encoded recursively.
 
     my $Base64EncodedData = $UtilObject->Base64DeepEncode(
         # Data can be a scalar, hash or array
         Data => {
             Article => {
                 # ...
             },
             # ...
         },
         HashKeys => [
             # All 'Body' elements of array $Hash->{Articles} will be base-64 encoded.
             # Also can mean: $Hash->{Articles}->{Body}, if 'Articles' is a hash.
             # Will encode nothing if last key ('Body') cannot be reached or is not a scalar/string.
             'Articles->Body',
 
             'QueueData->Comment',
             # ...
         ],
     );



DataStructureRemoveElements()
=============================



.. code-block:: perl

     Removes elements of given data for given keys.
     If data is an array, all of its child elements will be checked for given keys whose elements
     will be removed recursively.
 
     my $Data = $UtilObject->DataStructureRemoveElements(
         # Data can be a scalar, hash or array
         Data => {
             Article => {
                 # ...
             },
             # ...
         },
         HashKeys => [
             # All 'Body' elements of array $Hash->{Articles} will be removed.
             # Also can mean: $Hash->{Articles}->{Body}, if 'Articles' is a hash.
             # Will remove nothing if last key ('Body') cannot be reached or is not a scalar/string.
             'Articles->Body',
 
             'QueueData->Comment',
             # ...
         ],
     );



GetInstalledDBCRUDObjects()
===========================



.. code-block:: perl

     Returns installed DBCRUD objects.
 
     my $DBCRUDObjects = $UtilObject->GetInstalledDBCRUDObjects();
 
     Returns:
     my $DBCRUDObjects = [
         # DBCRUD objects as returned by $Kernel::OM->Get('Kernel::System::...')
     ];




