[Rt-commit] [rtir] 16/18: Switch "OurQuery" to return Lifecycles
Jesse Vincent
jesse at bestpractical.com
Wed Mar 11 03:36:48 EDT 2015
This is an automated email from the git hooks/post-receive script.
jesse pushed a commit to branch 3.4/remove_old_constituencies
in repository rtir.
commit b9811a8e9021a2102aebe805f68c377dea5eefcc
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Wed Mar 11 00:19:53 2015 -0700
Switch "OurQuery" to return Lifecycles
Switch "OurQuery" to return Lifecycles, as most of its callers
already thought it was.
---
html/Callbacks/RTIR/Search/Results.html/Initial | 4 ++--
lib/RT/IR.pm | 9 +++++----
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/html/Callbacks/RTIR/Search/Results.html/Initial b/html/Callbacks/RTIR/Search/Results.html/Initial
index 90ab7aa..00a5e35 100644
--- a/html/Callbacks/RTIR/Search/Results.html/Initial
+++ b/html/Callbacks/RTIR/Search/Results.html/Initial
@@ -49,14 +49,14 @@
$ARGSRef => {}
</%ARGS>
<%INIT>
-my ($our, @queues) = RT::IR->OurQuery( $ARGSRef->{'Query'} );
+my ($our, @lifecycles) = RT::IR->OurQuery( $ARGSRef->{'Query'} );
return unless $our;
RT::Interface::Web::Redirect( RT->Config->Get('WebURL') .'RTIR/Search/Results.html?'
. $m->comp(
'/Elements/QueryString',
%$ARGSRef,
- @queues == 1? (Queue => $queues[0]) : (Queue => undef)
+ @lifecycles == 1? (Lifecycle => $lifecycles[0]) : (Lifecycle => undef)
)
);
</%INIT>
\ No newline at end of file
diff --git a/lib/RT/IR.pm b/lib/RT/IR.pm
index 27646ba..876d93e 100644
--- a/lib/RT/IR.pm
+++ b/lib/RT/IR.pm
@@ -401,10 +401,11 @@ sub OurQuery {
my $self = shift;
my $query = shift;
- my ($has_our, $has_other, @queues) = (0, 0);
+ my ($has_our, $has_other, @lifecycles) = (0, 0);
$ticket_sql_parser->walk(
RT::SQL::ParseToArray( $query ),
{ operand => sub {
+ # XXX TODO also pull out lifecycle keys
return undef unless $_[0]->{'key'} =~ /^Queue(?:\z|\.)/;
my $queue = RT::Queue->new( RT->SystemUser );
$queue->Load( $_[0]->{'value'} );
@@ -412,7 +413,7 @@ sub OurQuery {
my ($negative) = ( $_[0]->{'op'} eq '!=' || $_[0]->{'op'} =~ /\bNOT\b/i );
if ( $our && !$negative ) {
$has_our = 1;
- push @queues, $queue->Name;
+ push @lifecycles, $queue->Lifecycle;
} else {
$has_other = 1;
}
@@ -422,9 +423,9 @@ sub OurQuery {
return 1 unless wantarray;
my %seen;
- @queues = grep !$seen{ lc $_ }++, @queues;
+ @lifecycles = grep !$seen{ lc $_ }++, @lifecycles;
- return (1, @queues);
+ return (1, @lifecycles);
}
=head2 Incidents
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the rt-commit
mailing list