ITSMChangeManagement -> rel-3_2 API documentation

NAME

Kernel::System::ITSMChange::History - all change and workorder history functions

SYNOPSIS

All history functions.

PUBLIC INTERFACE

  • new()

    create an object

    use Kernel::Config;
    use Kernel::System::Encode;
    use Kernel::System::Log;
    use Kernel::System::DB;
    use Kernel::System::Main;
    use Kernel::System::Time;
    use Kernel::System::ITSMChange::History;
    
    my $ConfigObject = Kernel::Config->new();
    my $EncodeObject = Kernel::System::Encode->new(
        ConfigObject => $ConfigObject,
    );
    my $LogObject = Kernel::System::Log->new(
        ConfigObject => $ConfigObject,
        EncodeObject => $EncodeObject,
    );
    my $MainObject = Kernel::System::Main->new(
        ConfigObject => $ConfigObject,
        EncodeObject => $EncodeObject,
        LogObject    => $LogObject,
    );
    my $TimeObject = Kernel::System::Time->new(
        ConfigObject => $ConfigObject,
        LogObject    => $LogObject,
    );
    my $DBObject = Kernel::System::DB->new(
        ConfigObject => $ConfigObject,
        EncodeObject => $EncodeObject,
        LogObject    => $LogObject,
        MainObject   => $MainObject,
    );
    my $HistoryObject = Kernel::System::ITSMChange::History->new(
        ConfigObject => $ConfigObject,
        EncodeObject => $EncodeObject,
        LogObject    => $LogObject,
        DBObject     => $DBObject,
        TimeObject   => $TimeObject,
        MainObject   => $MainObject,
    );
    
  • HistoryAdd()

    Adds a single history entry to the history. Returns 1 on success, undef otherwise.

    my $Success = $HistoryObject->HistoryAdd(
        ChangeID      => 1234,            # either ChangeID or WorkOrderID is needed
        WorkOrderID   => 123,             # either ChangeID or WorkOrderID is needed
        HistoryType   => 'WorkOrderAdd',  # either HistoryType or HistoryTypeID is needed
        HistoryTypeID => 1,               # either HistoryType or HistoryTypeID is needed
        Fieldname     => 'Justification', # optional
        ContentNew    => 'Any useful information', # optional
        ContentOld    => 'Old value of field',     # optional
        UserID        => 1,
    );
    
  • HistoryAddMultiple()

    Adds multiple history entries to the history. Returns 1 on success, undef otherwise.

    my $Success = $HistoryObject->HistoryAddMultiple(
        Data => \@HistoryAddData,
    );
    
  • WorkOrderHistoryGet()

    Returns a list of all history entries that belong to the given WorkOrderID. The list contains hash references with these information:

    $Info{HistoryEntryID}
    $Info{ChangeID}
    $Info{WorkOrderID}
    $Info{HistoryType}
    $Info{HistoryTypeID}
    $Info{Fieldname}
    $Info{ContentNew}
    $Info{ContentOld}
    $Info{CreateBy}
    $Info{CreateTime}
    $Info{UserID}
    $Info{UserLogin}
    $Info{UserLastname}
    $Info{UserFirstname}
    
    my $HistoryEntries = $HistoryObject->WorkOrderHistoryGet(
        WorkOrderID => 123,
        UserID   => 1,
    );
    
  • ChangeHistoryGet()

    Returns a list of all history entries that belong to the given ChangeID - including history entries for workorders. The list contains hash references with these information:

    $Info{HistoryEntryID}
    $Info{ChangeID}
    $Info{WorkOrderID}
    $Info{HistoryType}
    $Info{HistoryTypeID}
    $Info{Fieldname}
    $Info{ContentNew}
    $Info{ContentOld}
    $Info{CreateBy}
    $Info{CreateTime}
    $Info{UserID}
    $Info{UserLogin}
    $Info{UserLastname}
    $Info{UserFirstname}
    
    my $HistoryEntries = $HistoryObject->ChangeHistoryGet(
        ChangeID => 123,
        UserID   => 1,
    );
    
  • HistoryEntryGet()

    Returns a single history entry. The hash reference has these information:

    $Info{HistoryEntryID}
    $Info{ChangeID}
    $Info{WorkOrderID}
    $Info{HistoryType}
    $Info{HistoryTypeID}
    $Info{Fieldname}
    $Info{ContentNew}
    $Info{ContentOld}
    $Info{CreateBy}
    $Info{CreateTime}
    $Info{UserID}
    $Info{UserLogin}
    $Info{UserLastname}
    $Info{UserFirstname}
    
    my $HistoryEntry = $HistoryObject->HistoryEntryGet(
        HistoryEntryID => 123,
        UserID         => 1,
    );
    
  • WorkOrderHistoryDelete()

    Deletes all entries in history table that belongs to the given WorkOrderID. The method returns 1 on success and undef otherwise.

    my $Success = $HistoryObject->WorkOrderHistoryDelete(
        WorkOrderID => 123,
        UserID      => 1,
    );
    
  • ChangeHistoryDelete()

    Deletes all entries in history table that belongs to the given ChangeID. The method returns 1 on success and undef otherwise.

    my $Success = $HistoryObject->ChangeHistoryDelete(
        ChangeID => 123,
        UserID   => 1,
    );
    
  • HistoryUpdate()

    This method updates a history entry. It returns 1 on success, and undef otherwise.

    my $Success = $HistoryObject->HistoryUpdate(
        HistoryEntryID => 123,
        WorkOrderID    => 3451,         # optional
        ChangeID       => 1235,         # optional
        ContentNew     => 'new value',  # optional
        ContentOld     => 'old value',  # optional
        UserID         => 1,
    );
    
  • HistorySearch()

    Searches for changes/workorders that matches the given search criteria. It returns an array reference with change or workorder IDs. If Result => 'COUNT' then the number of found changes is returned.

    my $IDs = $HistoryObject->HistorySearch(
        Type                => 'Change',       # Change|Workorder which IDs should be returned
        Attribute           => 'ChangeState',
        OldValues           => [ 'rejected' ], # optional - OldValues OR NewValues is needed
        NewValues           => [ 'approved' ], # optional - OldValues OR NewValues is needed
        ChangeBy            => [ 1, 2, 3 ],    # optional
        ChangeDateNewerDate => '2009-01-13 00:00:01', #optional
        ChangeDateOlderDate => '2009-01-13 00:00:01', #optional
        UserID              => 1,
        UsingWildcards      => 0,              # 0|1 - default 1
        Result              => 'ARRAY',        # ARRAY|COUNT - default ARRAY
    );
    
  • HistoryTypeLookup()

    This method does a lookup for a history type. If a history type id is given, it returns the name of the history type. If a history type is given, the appropriate id is returned.

    my $Name = $HistoryObject->HistoryTypeLookup(
        HistoryTypeID => 1234,
    );
    
    my $ID = $HistoryObject->HistoryTypeLookup(
        HistoryType => 'WorkOrderAdd',
    );
    
  • HistoryTypeList()

    returns an array reference with hashreferences. The key of the hashreference is the id of an recipient and the name is the value.

TERMS AND CONDITIONS

This software is part of the OTRS project (http://otrs.com/).

This software comes with ABSOLUTELY NO WARRANTY. For details, see the enclosed file COPYING for license information (AGPL). If you did not receive this file, see http://www.gnu.org/licenses/agpl.txt.