[Rt-commit] r5052 - in rt/branches/3.7-EXPERIMENTAL: . lib/RT/Report
ruz at bestpractical.com
ruz at bestpractical.com
Wed Apr 19 17:04:36 EDT 2006
Author: ruz
Date: Wed Apr 19 17:04:34 2006
New Revision: 5052
Modified:
rt/branches/3.7-EXPERIMENTAL/ (props changed)
rt/branches/3.7-EXPERIMENTAL/html/Search/Elements/ResultViews
rt/branches/3.7-EXPERIMENTAL/html/Search/Elements/SelectGroupBy
rt/branches/3.7-EXPERIMENTAL/lib/RT/Report/Tickets.pm
Log:
r2412 at cubic-pc: cubic | 2006-04-19 23:51:07 +0400
* support for grouping by CFs
Modified: rt/branches/3.7-EXPERIMENTAL/html/Search/Elements/ResultViews
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Search/Elements/ResultViews (original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Search/Elements/ResultViews Wed Apr 19 17:04:34 2006
@@ -19,7 +19,7 @@
% foreach my $key (keys(%hiddens)) {
<input type="hidden" class="hidden" name="<%$key%>" value="<%defined($hiddens{$key})?$hiddens{$key}:''%>" />
% }
-<&|/l, $m->scomp('SelectGroupBy', Name => 'PrimaryGroupBy') &>grouped by [_1]</&>
+<&|/l, $m->scomp('SelectGroupBy', Name => 'PrimaryGroupBy', Query => $Query) &>grouped by [_1]</&>
<&|/l, $m->scomp('SelectChartType', Name => 'ChartStyle') &>style: [_1]</&>
<input type="submit" class="button" value="<%loc('Go')%>" />
</form>
Modified: rt/branches/3.7-EXPERIMENTAL/html/Search/Elements/SelectGroupBy
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Search/Elements/SelectGroupBy (original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Search/Elements/SelectGroupBy Wed Apr 19 17:04:34 2006
@@ -1,6 +1,7 @@
<%args>
$Name => 'GroupBy'
$Default => 'Status'
+$Query => ''
</%args>
<select name="<%$Name%>">
% foreach my $option (@options) {
@@ -10,5 +11,5 @@
<%init>
use RT::Report::Tickets;
my $report = RT::Report::Tickets->new($session{'CurrentUser'});
-my @options = $report->Groupings;
+my @options = $report->Groupings( Query => $Query );
</%init>
Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Report/Tickets.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Report/Tickets.pm (original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Report/Tickets.pm Wed Apr 19 17:04:34 2006
@@ -7,28 +7,55 @@
use warnings;
sub Groupings {
- qw (Owner
- Status
- Queue
- DueDaily
- DueMonthly
- DueAnnually
- ResolvedDaily
- ResolvedMonthly
- ResolvedAnnually
- CreatedDaily
- CreatedMonthly
- CreatedAnnually
- LastUpdatedDaily
- LastUpdatedMonthly
- LastUpdatedAnnually
- StartedDaily
- StartedMonthly
- StartedAnnually
- StartsDaily
- StartsMonthly
- StartsAnnually
- )
+ my $self = shift;
+ my %args = (@_);
+ my @fields = qw(
+ Owner
+ Status
+ Queue
+ DueDaily
+ DueMonthly
+ DueAnnually
+ ResolvedDaily
+ ResolvedMonthly
+ ResolvedAnnually
+ CreatedDaily
+ CreatedMonthly
+ CreatedAnnually
+ LastUpdatedDaily
+ LastUpdatedMonthly
+ LastUpdatedAnnually
+ StartedDaily
+ StartedMonthly
+ StartedAnnually
+ StartsDaily
+ StartsMonthly
+ StartsAnnually
+ );
+ if ( $args{'Query'} ) {
+ require RT::Interface::Web::QueryBuilder::Tree;
+ my $tree = RT::Interface::Web::QueryBuilder::Tree->new('AND');
+ $tree->ParseSQL( Query => $args{'Query'}, CurrentUser => $self->CurrentUser );
+ my $queues = $tree->GetReferencedQueues;
+
+ my $CustomFields = RT::CustomFields->new( $self->CurrentUser );
+ foreach my $id (keys %$queues) {
+ my $queue = RT::Queue->new( $self->CurrentUser );
+ $queue->Load($id);
+ unless ($queue->id) {
+ # XXX TODO: This ancient code dates from a former developer
+ # we have no idea what it means or why cfqueues are so encoded.
+ $id =~ s/^.'*(.*).'*$/$1/;
+ $queue->Load($id);
+ }
+ $CustomFields->LimitToQueue($queue->Id);
+ }
+ $CustomFields->LimitToGlobal;
+ while ( my $CustomField = $CustomFields->Next ) {
+ push @fields, "CF.{". $CustomField->Name ."}";
+ }
+ }
+ return @fields;
}
sub GroupBy {
More information about the Rt-commit
mailing list