summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2016-11-23 15:00:20 -0800
committerMark Wells <mark@freeside.biz>2016-11-23 15:00:20 -0800
commitfd90ad324e6e19d2e51676d0be8951801731f2e7 (patch)
tree49c07feeea28473fdff194885e0bb2d6179a0d8d
parentf1675daf6b326dfedf0cab80d9c9683a0db5c820 (diff)
hide the notify-tickets widget if there are no tickets, or if the user turns it off, #73490
-rw-r--r--httemplate/elements/notify-tickets.html8
-rw-r--r--httemplate/pref/pref-process.html1
-rw-r--r--httemplate/pref/pref.html7
3 files changed, 16 insertions, 0 deletions
diff --git a/httemplate/elements/notify-tickets.html b/httemplate/elements/notify-tickets.html
index e661737..16a04f4 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;
diff --git a/httemplate/pref/pref-process.html b/httemplate/pref/pref-process.html
index 75e5795..a87036b 100644
--- a/httemplate/pref/pref-process.html
+++ b/httemplate/pref/pref-process.html
@@ -56,6 +56,7 @@ unless ( $error ) { # if ($access_user) {
enable_mask_clipboard_hack dashboard_customers
customer_view_emails
printtofit
+ hide_notify_tickets
email_address
snom-ip snom-username snom-password
vonage-fromnumber vonage-username vonage-password
diff --git a/httemplate/pref/pref.html b/httemplate/pref/pref.html
index 0f23a0c..f26d209 100644
--- a/httemplate/pref/pref.html
+++ b/httemplate/pref/pref.html
@@ -137,6 +137,13 @@
</TR>
<TR>
+ <TH ALIGN="right"><% emt('Hide notification of new ticket activity') %></TH>
+ <TD ALIGN="left">
+ <INPUT TYPE="checkbox" NAME="hide_notify_tickets" VALUE="1" <% $curuser->option('hide_notify_tickets') ? 'CHECKED' : '' %>>
+ </TD>
+ </TR>
+
+ <TR>
<TH ALIGN="right"><% emt("How many recently-modified customers displayed on dashboard") %></TH>
<TD ALIGN="left" COLSPAN=2>
<INPUT TYPE="text" NAME="dashboard_customers" VALUE="<% $curuser->option('dashboard_customers') %>"></TD>