diff options
author | Mark Wells <mark@freeside.biz> | 2016-11-23 15:00:20 -0800 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2016-11-23 15:14:12 -0800 |
commit | ba7725a58fa6c211df8614f57973f49d71d64b80 (patch) | |
tree | 64d15b3ba71824bff00a9e06d5559b177bc21204 /httemplate/elements | |
parent | 8afd2939872ed96d7e205e85c183a5cf20c36ef6 (diff) |
hide the notify-tickets widget if there are no tickets, or if the user turns it off, #73490
Diffstat (limited to 'httemplate/elements')
-rw-r--r-- | httemplate/elements/notify-tickets.html | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/httemplate/elements/notify-tickets.html b/httemplate/elements/notify-tickets.html index e661737bc..16a04f4d9 100644 --- a/httemplate/elements/notify-tickets.html +++ b/httemplate/elements/notify-tickets.html @@ -14,12 +14,20 @@ use Class::Load 'load_class'; my $enabled = $FS::TicketSystem::system eq 'RT_Internal'; +$enabled = 0 if $FS::CurrentUser::CurrentUser->option('hide_notify_tickets'); my $UnrepliedTickets; if ($enabled) { my $class = 'RT::Search::UnrepliedTickets'; load_class($class); my $session = FS::TicketSystem->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->LimitStatus( OPERATOR => '!=', VALUE => $status ); + } + $enabled = 0 if $AnyTickets->Count == 0; + $UnrepliedTickets = RT::Tickets->new($CurrentUser); my $search = $class->new(TicketsObj => $UnrepliedTickets); $search->Prepare; |