<&|/Widgets/TitleBox, title => $title, bodyclass => "" &> % for my $status (@statuses) { % } <%PERL> my $i = 0; for my $uinfo (sort { $display{$a} cmp $display{$b} } keys %table) { my $user_cond = $Role . ( $Field ? ".$Field". ( length $uinfo ? " = '$uinfo'" : " IS NULL" ) : " = $uinfo" ); my $all_q = "$user_cond AND ($status_cond)"; $i++; $m->out('' ); % for my $status (@statuses) { % if ( my $count = $table{$uinfo}{$status} ) { % my $cond = "$user_cond AND Status = '$status'"; % } else { % } % } % }
<% loc($Field || $Role) %><% loc($status) %>
<% $display{$uinfo} |n %><% $count %>-
<%ARGS> $Role => 'Owner' $Field => undef <%INIT> my $title; if ( $Role eq 'Owner' ) { $title = loc('Summary by owner'); } elsif ( $Role eq 'Creator' ) { $title = loc('Summary by creator'); } elsif ( $Role eq 'Requestor' ) { $title = loc('Summary by requestor'); } elsif ( $Role eq 'Cc' ) { $title = loc('Summary by cc'); } elsif ( $Role eq 'AdminCc' ) { $title = loc('Summary by admin cc'); } else { $RT::Logger->error("Unknown role '$Role'"); return; } $Field = undef if $Field && ($Field eq 'Name' || $Field eq 'EmailAddress'); $title .= ' ('. loc($Field) .')' if $Field; my @statuses = RT::Queue->ActiveStatusArray; my $status_cond = join 'OR', map "Status = '$_'", @statuses; use RT::Report::Tickets; my $tix = RT::Report::Tickets->new( $session{'CurrentUser'} ); my ($count_field, $user_field, $status_field) = $tix->SetupGroupings( Query => $status_cond, GroupBy => [ $Role .'.'. ($Field || 'id'), 'Status' ], ); my (%table, %display) = (); while ( my $entry = $tix->Next ) { my $uinfo = $entry->__Value( $user_field ); $uinfo = '' unless defined $uinfo; unless ( $display{ $uinfo } ) { unless ( $Field ) { my $user = RT::User->new( $RT::SystemUser ); $user->Load( $uinfo ); unless ( $user->id ) { $RT::Logger->error( "Couldn't load user $uinfo"); next; } $display{$uinfo} = $m->scomp('/Elements/ShowUser', User => $user ); } else { $display{$uinfo} = $uinfo; $display{$uinfo} = loc('(no value)') unless length $uinfo; } } my $status = $entry->__Value( $status_field ); my $count = $entry->__Value( $count_field ); $table{$uinfo}{$status} = $count; }