X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=rt%2Fshare%2Fhtml%2FElements%2FQueueSummaryByLifecycle;h=6c45cfdeac139682d3d486b7435e75ad53f2cacd;hb=93e64d8dec78c90f4a65249f5294c736b6129a9c;hp=1410e82efa21a8e2f2aec4a91ef744525b814005;hpb=a6fe07e49e3fc12169e801b1ed6874c3a5bd8500;p=freeside.git diff --git a/rt/share/html/Elements/QueueSummaryByLifecycle b/rt/share/html/Elements/QueueSummaryByLifecycle index 1410e82ef..6c45cfdea 100644 --- a/rt/share/html/Elements/QueueSummaryByLifecycle +++ b/rt/share/html/Elements/QueueSummaryByLifecycle @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -66,20 +66,20 @@ for my $queue (@queues) { next if lc($queue->{Lifecycle} || '') ne lc $lifecycle->Name; $i++; - my $name = $queue->{Name}; - $name =~ s/(['\\])/\\$1/g; - my $queue_cond = "Queue = '$name' AND "; - my $all_q = $queue_cond . '(' . join( " OR ", map "Status = '$_'", @cur_statuses ) . ')'; + + my $classes = $i%2 ? 'oddline' : 'evenline'; + $classes .= ' unreplied-ticket' if $queue->{Unreplied} > 0; - + + - <% $queue->{Name} %> + <% $queue->{Name} %> % for my $status (@cur_statuses) { - "><% $data->{$queue->{id}}->{$status } || '-' %> + <% $data->{$queue->{id}}->{lc $status} || '-' %> % } @@ -87,6 +87,31 @@ for my $queue (@queues) { % } <%INIT> +my $build_search_link = sub { + my ($queue_name, $extra_query) = @_; + $queue_name =~ s/(['\\])/\\$1/g; #' + + return RT->Config->Get('WebPath') + . "/Search/Results.html?Query=" + . $m->interp->apply_escapes("Queue = '$queue_name' AND $extra_query", 'u'); +}; + +my $link_all = sub { + my ($queue, $all_statuses) = @_; + return $build_search_link->($queue->{Name}, "(".join(" OR ", map "Status = '$_'", @$all_statuses).")"); +}; + +my $link_status = sub { + my ($queue, $status) = @_; + return $build_search_link->($queue->{Name}, "Status = '$status'"); +}; + +$m->callback( + CallbackName => 'LinkBuilders', + build_search_link => \$build_search_link, + link_all => \$link_all, + link_status => \$link_status, +); my $Queues = RT::Queues->new( $session{'CurrentUser'} ); $Queues->UnLimit(); @@ -110,6 +135,24 @@ for my $queue (@queues) { $lifecycle{ lc $cycle->Name } = $cycle; } +use RT::Search::UnrepliedTickets; +my $Tickets = RT::Tickets->new( RT->SystemUser ); +my $Search = RT::Search::UnrepliedTickets->new( TicketsObj => $Tickets ); +$Search->Prepare; + +for my $queue (@queues) { + my $cycle = RT::Lifecycle->Load( Name => $queue->{'Lifecycle'} ); + $lifecycle{ lc $cycle->Name } = $cycle; + + # show whether there are unreplied tickets + # somewhat inefficient but we only use the count query + my $tix = $Tickets->Clone; + $tix->Limit(FIELD => 'Queue', + OPERATOR => '=', + VALUE => $queue->{id}); + $queue->{Unreplied} = $tix->Count; +} + unless (@statuses) { my %seen; foreach my $set ( 'initial', 'active' ) {