Kernel::System::Ticket::NumberBase

NAME

Kernel::System::Ticket::NumberBase – Common functions for ticket number generators

PUBLIC INTERFACE

IsDateBased()

informs if the current number counter has a reset with every new day or not. All generators need to implement this function.

    my $IsDatebased = $TicketNumberObject->IsDateBased();

TicketNumberCounterAdd()

Add a new unique ticket counter entry. These counters are used by the different number generators to generate unique TicketNumbers

    my $Counter = $TicketNumberObject->TicketNumberCounterAdd(
        Offset      => 123,
    );

Returns:

    my $Counter = 123;  # undef in case of an error

This method has logic to generate unique numbers even though concurrent processes might write to the same table. The algorithm runs as follows: – Insert a new record into the ticket_number_counter table with a counter value of 0. – Then update all preceding records including and up to the current one that still have value 0 and compute the correct value for each, which depends on the previous record.

This works well also if concurrent processes write to the records at the same time, because they will compute the same (unique) values for the counters.

TicketNumberCounterDelete()

Remove a ticket counter entry.

    my $Success = $TicketNumberObject->TicketNumberCounterDelete(
        CounterID => 123,
    );

Returns:

    my $Success = 1;  # false in case of an error

TicketNumberCounterIsEmpty()

Check if there are no records in ticket_number_counter DB table.

    my $IsEmpty = $TicketNumberObject->TicketNumberCounterIsEmpty();

Returns:

    my $IsEmpty = 1;  # 0 if it is not empty and undef in case of an error

TicketNumberCounterCleanup()

Removes old counters from the system.

    my $Success = $TicketNumberObject->TicketNumberCounterCleanup();

Returns:

    my $Success = 1;  # or false in case of an error

TicketCreateNumber()

Creates a unique ticket number.

    my $TicketNumber = $TicketNumberObject->TicketCreateNumber();

Returns:

    my $TicketNumber = 456;

PRIVATE INTERFACE

_GetUID()

Generates a unique identifier.

    my $UID = $TicketNumberObject->_GetUID();

Returns:

    my $UID = 14906327941360ed8455f125d0450277;
Scroll to Top