%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
my $i = 0;
for my $queue (@queues) {
$i++;
- my $name = $queue->{Name};
- $name =~ s/(['\\])/\\$1/g;
- my $queue_cond = "Queue = '$name' AND ";
my $lifecycle = $lifecycle{ lc $queue->{'Lifecycle'} };
- my $all_q = $queue_cond . '(' . join( " OR ", map "Status = '$_'", grep $lifecycle->IsValid($_), @statuses ) . ')';
+ my @queue_statuses = grep { $lifecycle->IsValid($_) } @statuses;
</%PERL>
<tr class="<% $i%2 ? 'oddline' : 'evenline'%>" >
<td>
- <a href="<% RT->Config->Get('WebPath') %>/Search/Results.html?Query=<% $all_q |u,n %>" title="<% $queue->{Description} %>"><% $queue->{Name} %></a>
+ <a href="<% $link_all->($queue, \@queue_statuses) %>" title="<% $queue->{Description} %>"><% $queue->{Name} %></a>
</td>
<%perl>
if ( $lifecycle->IsValid( $status ) ) {
</%perl>
<td align="right">
- <a href="<% RT->Config->Get('WebPath') %>/Search/Results.html?Query=<% $queue_cond ."Status = '$status'" |u,n %>"><% $data->{$queue->{id}}->{$status } || '-' %></a>
+ <a href="<% $link_status->($queue, $status) %>"><% $data->{$queue->{id}}->{$status } || '-' %></a>
</td>
% } else {
<td align="right">-</td>
% }
</table>
<%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();
use RT::Report::Tickets;
my $report = RT::Report::Tickets->new( RT->SystemUser );
-my $query = @queues
- ? join(' OR ', map "Queue = ".$_->{id}, @queues)
- : 'id < 0';
+my $query =
+ "(".
+ join(" OR ", map {s{(['\\])}{\\$1}g; "Status = '$_'"} @statuses) #'
+ .") AND (".
+ join(' OR ', map "Queue = ".$_->{id}, @queues)
+ .")";
+$query = 'id < 0' unless @queues;
$report->SetupGroupings( Query => $query, GroupBy => [qw(Status Queue)] );
while ( my $entry = $report->Next ) {