blob: 083e81512731cecc97d47abe9e739cfd45b66d02 (
plain)
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
|
% if ($enabled) {
<div style="font-weight: bold; vertical-align: bottom; text-align: left">
% if ( $UnrepliedTickets->Count > 0 ) {
<a href="<% $fsurl %>rt/Search/UnrepliedTickets.html">
<div class="dot" style="background-color: green"></div>
<% emt('New activity on [quant,_1,ticket]', $UnrepliedTickets->Count) %>
</a>
% } else {
<% emt('No new activity on tickets') %>
% }
</div>
% }
<%init>
use Class::Load 'load_class';
my $enabled = $FS::TicketSystem::system eq 'RT_Internal';
$enabled = 0 unless $FS::CurrentUser::CurrentUser->access_right('RT activity notification');
my $UnrepliedTickets;
if ($enabled) {
my $class = 'RT::Search::UnrepliedTickets';
load_class($class);
my $session = eval { FS::TicketSystem->session; };
if ( $session ) {
my $CurrentUser = $session->{CurrentUser};
# if there are no tickets the current user could see, always hide it
my $AnyTickets = RT::Tickets->new($CurrentUser);
foreach my $status (qw(resolved rejected deleted)) {
$AnyTickets->RT::SearchBuilder::Limit(
FIELD => 'Status',
OPERATOR => '!=',
ENTRYAGGREGATOR => 'AND',
VALUE => $status,
);
}
$enabled = 0 if $AnyTickets->Count == 0;
$UnrepliedTickets = RT::Tickets->new($CurrentUser);
my $search = $class->new(TicketsObj => $UnrepliedTickets);
$search->Prepare;
} else {
$enabled = 0;
}
}
</%init>
|