<commit_before># --
# Kernel/Output/HTML/DashboardCustomerIDStatus.pm
# Copyright (C) 2001-2014 OTRS AG, 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.
# --

package Kernel::Output::HTML::DashboardCustomerIDStatus;

use strict;
use warnings;

#use Kernel::System::CustomerCompany;
#use Kernel::System::Valid;

sub new {
    my ( $Type, %Param ) = @_;

    # allocate new hash for object
    my $Self = {%Param};
    bless( $Self, $Type );

    # get needed objects
    for (
        qw(Config Name ConfigObject LogObject DBObject LayoutObject ParamObject TicketObject UserID)
        )
    {
        die "Got no $_!" if ( !$Self->{$_} );
    }

    #    $Self->{CustomerCompanyObject} = Kernel::System::CustomerCompany->new( %{$Self} );
    #    $Self->{ValidObject}           = Kernel::System::Valid->new( %{$Self} );

    $Self->{PrefKey} = 'UserDashboardPref' . $Self->{Name} . '-Shown';

    $Self->{CacheKey} = $Self->{Name};

    return $Self;
}

sub Preferences {
    my ( $Self, %Param ) = @_;

    return;
}

sub Config {
    my ( $Self, %Param ) = @_;

    return (
        %{ $Self->{Config} },

        # caching not needed
        CacheKey => undef,
        CacheTTL => undef,
    );
}

sub Run {
    my ( $Self, %Param ) = @_;

    return if !$Param{CustomerID};

    my $CustomerIDRaw = $Param{CustomerID};

    # escalated tickets
    my $Count = $Self->{TicketObject}->TicketSearch(
        TicketEscalationTimeOlderMinutes => 1,
        CustomerIDRaw                    => $CustomerIDRaw,
        Result                           => 'COUNT',
        Permission                       => $Self->{Config}->{Permission},
        UserID                           => $Self->{UserID},
        CacheTTL                         => $Self->{Config}->{CacheTTLLocal} * 60,
    );

    $Self->{LayoutObject}->Block(
        Name => 'ContentSmallCustomerIDStatusEscalatedTickets',
        Data => {
            %Param,
            Count => $Count
        },
    );

    # open tickets
    $Count = $Self->{TicketObject}->TicketSearch(
        StateType     => 'Open',
        CustomerIDRaw => $CustomerIDRaw,
        Result        => 'COUNT',
        Permission    => $Self->{Config}->{Permission},
        UserID        => $Self->{UserID},
        CacheTTL      => $Self->{Config}->{CacheTTLLocal} * 60,
    );

    $Self->{LayoutObject}->Block(
        Name => 'ContentSmallCustomerIDStatusOpenTickets',
        Data => {
            %Param,
            Count => $Count
        },
    );

    # closed tickets
    $Count = $Self->{TicketObject}->TicketSearch(
        StateType     => 'Closed',
        CustomerIDRaw => $CustomerIDRaw,
        Result        => 'COUNT',
        Permission    => $Self->{Config}->{Permission},
        UserID        => $Self->{UserID},
        CacheTTL      => $Self->{Config}->{CacheTTLLocal} * 60,
    );

    $Self->{LayoutObject}->Block(
        Name => 'ContentSmallCustomerIDStatusClosedTickets',
        Data => {
            %Param,
            Count => $Count
        },
    );

    # all tickets
    $Count = $Self->{TicketObject}->TicketSearch(
        CustomerIDRaw => $CustomerIDRaw,
        Result        => 'COUNT',
        Permission    => $Self->{Config}->{Permission},
        UserID        => $Self->{UserID},
        CacheTTL      => $Self->{Config}->{CacheTTLLocal} * 60,
    );

    $Self->{LayoutObject}->Block(
        Name => 'ContentSmallCustomerIDStatusAllTickets',
        Data => {
            %Param,
            Count => $Count
        },
    );

    # archived tickets
    if ( $Self->{ConfigObject}->Get('Ticket::ArchiveSystem') ) {
        $Count = $Self->{TicketObject}->TicketSearch(
            CustomerIDRaw => $CustomerIDRaw,
            ArchiveFlags  => ['y'],
            Result        => 'COUNT',
            Permission    => $Self->{Config}->{Permission},
            UserID        => $Self->{UserID},
            CacheTTL      => $Self->{Config}->{CacheTTLLocal} * 60,
        );

        $Self->{LayoutObject}->Block(
            Name => 'ContentSmallCustomerIDStatusArchivedTickets',<commit_msg>Switched Output/HTML/DashboardCustomerIDStatus.pm to OM.<commit_after># --
# Kernel/Output/HTML/DashboardCustomerIDStatus.pm
# Copyright (C) 2001-2014 OTRS AG, 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.
# --

package Kernel::Output::HTML::DashboardCustomerIDStatus;

use strict;
use warnings;

our $ObjectManagerDisabled = 1;

sub new {
    my ( $Type, %Param ) = @_;

    # allocate new hash for object
    my $Self = {%Param};
    bless( $Self, $Type );

    # get needed objects
    for my $Needed (qw(Config Name ConfigObject UserID)) {
        die "Got no $Needed!" if ( !$Self->{$Needed} );
    }

    $Self->{PrefKey} = 'UserDashboardPref' . $Self->{Name} . '-Shown';

    $Self->{CacheKey} = $Self->{Name};

    return $Self;
}

sub Preferences {
    my ( $Self, %Param ) = @_;

    return;
}

sub Config {
    my ( $Self, %Param ) = @_;

    return (
        %{ $Self->{Config} },

        # caching not needed
        CacheKey => undef,
        CacheTTL => undef,
    );
}

sub Run {
    my ( $Self, %Param ) = @_;

    return if !$Param{CustomerID};

    my $CustomerIDRaw = $Param{CustomerID};

    # get ticket object
    my $TicketObject = $Kernel::OM->Get('Kernel::System::Ticket');

    # escalated tickets
    my $Count = $Self->{TicketObject}->TicketSearch(
        TicketEscalationTimeOlderMinutes => 1,
        CustomerIDRaw                    => $CustomerIDRaw,
        Result                           => 'COUNT',
        Permission                       => $Self->{Config}->{Permission},
        UserID                           => $Self->{UserID},
        CacheTTL                         => $Self->{Config}->{CacheTTLLocal} * 60,
    );

    # get layout object
    my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');

    $Self->{LayoutObject}->Block(
        Name => 'ContentSmallCustomerIDStatusEscalatedTickets',
        Data => {
            %Param,
            Count => $Count
        },
    );

    # open tickets
    $Count = $Self->{TicketObject}->TicketSearch(
        StateType     => 'Open',
        CustomerIDRaw => $CustomerIDRaw,
        Result        => 'COUNT',
        Permission    => $Self->{Config}->{Permission},
        UserID        => $Self->{UserID},
        CacheTTL      => $Self->{Config}->{CacheTTLLocal} * 60,
    );

    $Self->{LayoutObject}->Block(
        Name => 'ContentSmallCustomerIDStatusOpenTickets',
        Data => {
            %Param,
            Count => $Count
        },
    );

    # closed tickets
    $Count = $Self->{TicketObject}->TicketSearch(
        StateType     => 'Closed',
        CustomerIDRaw => $CustomerIDRaw,
        Result        => 'COUNT',
        Permission    => $Self->{Config}->{Permission},
        UserID        => $Self->{UserID},
        CacheTTL      => $Self->{Config}->{CacheTTLLocal} * 60,
    );

    $Self->{LayoutObject}->Block(
        Name => 'ContentSmallCustomerIDStatusClosedTickets',
        Data => {
            %Param,
            Count => $Count
        },
    );

    # all tickets
    $Count = $Self->{TicketObject}->TicketSearch(
        CustomerIDRaw => $CustomerIDRaw,
        Result        => 'COUNT',
        Permission    => $Self->{Config}->{Permission},
        UserID        => $Self->{UserID},
        CacheTTL      => $Self->{Config}->{CacheTTLLocal} * 60,
    );

    $Self->{LayoutObject}->Block(
        Name => 'ContentSmallCustomerIDStatusAllTickets',
        Data => {
            %Param,
            Count => $Count
        },
    );

    # archived tickets
    if ( $Kernel::OM->Get('Kernel::Config')->Get('Ticket::ArchiveSystem') ) {
        $Count = $Self->{TicketObject}->TicketSearch(
            CustomerIDRaw => $CustomerIDRaw,
            ArchiveFlags  => ['y'],
            Result        => 'COUNT',
            Permission    => $Self->{Config}->{Permission},
            UserID        => $Self->{UserID},
            CacheTTL      => $Self->{Config}->{CacheTTLLocal} * 60,
        );

        $Self->{LayoutObject}->Block(
            Name => 'ContentSmallCustomerIDStatusArchivedTickets',
{'fraction_non_alphanumeric': 0.1567243205082951, 'fraction_numerical': 0.004588775150017649, 'mean_word_length': 1.9866479269149684, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 203, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7550102', 'n_tokens_mistral': 2651, 'n_tokens_neox': 2539, 'n_words': 487}