1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
|
# --
# Copyright (C) 2021 Znuny GmbH, https://znuny.org/
# --
# 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::ToolBar::TicketOwner;
use parent 'Kernel::Output::HTML::Base';
use strict;
use warnings;
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::Output::HTML::Layout',
'Kernel::System::Log',
'Kernel::System::Ticket',
);
sub Run {
my ( $Self, %Param ) = @_;
my $TicketObject = $Kernel::OM->Get('Kernel::System::Ticket');
my $LogObject = $Kernel::OM->Get('Kernel::System::Log');
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
NEEDED:
for my $Needed (qw(Config)) {
next NEEDED if defined $Param{$Needed};
$LogObject->Log(
Priority => 'error',
Message => "Parameter '$Needed' is needed!",
);
return;
}
return if !$ConfigObject->Get('Frontend::Module')->{AgentTicketOwnerView};
# get user lock data
my $Count = $TicketObject->TicketSearch(
Result => 'COUNT',
StateType => 'Open',
OwnerIDs => [ $Self->{UserID} ],
UserID => $Self->{UserID},
Permission => 'ro',
) || 0;
my $CountNew = $TicketObject->TicketSearch(
Result => 'COUNT',
StateType => 'Open',
OwnerIDs => [ $Self->{UserID} ],
TicketFlag => {
Seen => 1,
},
TicketFlagUserID => $Self->{UserID},
UserID => $Self->{UserID},
Permission => 'ro',
) || 0;
$CountNew = $Count - $CountNew;
my $CountReached = $TicketObject->TicketSearch(
Result => 'COUNT',
StateType => ['pending reminder'],
TicketPendingTimeOlderMinutes => 1,
OwnerIDs => [ $Self->{UserID} ],
UserID => $Self->{UserID},
Permission => 'ro',
) || 0;
my $Class = $Param{Config}->{CssClass};
my $ClassNew = $Param{Config}->{CssClassNew};
my $ClassReached = $Param{Config}->{CssClassReached};
my $Icon = $Param{Config}->{Icon};
my $IconNew = $Param{Config}->{IconNew};
my $IconReached = $Param{Config}->{IconReached};
my $URL = $Kernel::OM->Get('Kernel::Output::HTML::Layout')->{Baselink};
my %Return;
my $Priority = $Param{Config}->{Priority};
if ($CountNew) {
$Return{ $Priority++ } = {
Block => 'ToolBarItem',
Count => $CountNew,
Description => Translatable('Owned Tickets New'),
Class => $ClassNew,
Icon => $IconNew,
Link => $URL . 'Action=AgentTicketOwnerView;Filter=New',
AccessKey => $Param{Config}->{AccessKeyNew} || '',
};
}
if ($CountReached) {
$Return{ $Priority++ } = {
Block => 'ToolBarItem',
Count => $CountReached,
Description => Translatable('Owned Tickets Reminder Reached'),
Class => $ClassReached,
Icon => $IconReached,
Link => $URL . 'Action=AgentTicketOwnerView;Filter=ReminderReached',
AccessKey => $Param{Config}->{AccessKeyReached} || '',
};
}
if ($Count) {
$Return{ $Priority++ } = {
Block => 'ToolBarItem',
Count => $Count,
Description => Translatable('Owned Tickets Total'),
Class => $Class,
Icon => $Icon,
Link => $URL . 'Action=AgentTicketOwnerView',
AccessKey => $Param{Config}->{AccessKey} || '',
};
}
return %Return;
}
1;
|