[Rt-commit] rt branch, 4.2/search-by-lifecycle, repushed
Jesse Vincent
jesse at bestpractical.com
Fri Feb 6 00:51:27 EST 2015
The branch 4.2/search-by-lifecycle was deleted and repushed:
was e79d257b11fb500e4ca2dfe725b673782ed596e5
now 6dc7abc9f20704c3e8c66a19db31dbbff17f99bb
-: ------- > 1: 20907a1 Lexically cache current user in ticket creation
-: ------- > 2: 4a71451 Consistency on ticket creation
1: e2de24a ! 3: 6dc7abc Add the ability to search for tickets based on queue lifecycle
@@ -2,7 +2,9 @@
Add the ability to search for tickets based on queue lifecycle
- It's sometimes useful to be able to search for all tickets in a specific lifecycle. This commit adds the 'Lifecycle' field to TicketSQL, as well as associated tests.
+ It's sometimes useful to be able to search for all tickets in a
+ specific lifecycle. This commit adds the 'Lifecycle' field to
+ TicketSQL, as well as associated tests.
Code by Alex Vandiver. Tests by Jesse Vincent.
@@ -32,6 +34,7 @@
+sub _LifecycleLimit {
+ my ( $self, $field, $op, $value, %rest ) = @_;
+
++ die "Invalid Operator $op for $field" if $op =~ /^(IS|IS NOT)$/io;
+ my $queue = $self->{_sql_aliases}{queues} ||= $_[0]->Join(
+ ALIAS1 => 'main',
+ FIELD1 => 'Queue',
@@ -65,6 +68,19 @@
+is($tix->Count,7,"We found all 7 tickets in a queue with the default lifecycle");
+
+$tix = RT::Tickets->new(RT->SystemUser);
++$tix->FromSQL('Lifecycle ="approvals" OR Lifecycle="default"');
++is($tix->Count,7,"We found 7 tickets in a queue with a lifecycle of default or approvals");
++
++$tix = RT::Tickets->new(RT->SystemUser);
++$tix->FromSQL('Lifecycle ="approvals" AND Lifecycle="default"');
++is($tix->Count,0,"We found 0 tickets in a queue with a lifecycle of default AND approvals...(because that's impossible");
++
++$tix = RT::Tickets->new(RT->SystemUser);
++$tix->FromSQL('Queue="'.$queue.'" AND Lifecycle="default"');
++is($tix->Count,7,"We found 7 tickets in $queue with a lifecycle of default");
++
++
++$tix = RT::Tickets->new(RT->SystemUser);
+$tix->FromSQL('Lifecycle !="approvals"');
+is($tix->Count,7,"We found 7 tickets in a queue with a lifecycle other than approvals");
+
@@ -75,5 +91,6 @@
+$tix = RT::Tickets->new(RT->SystemUser);
+$tix->FromSQL('Lifecycle="approvals"');
+is($tix->Count,0,"We found 0 tickets in a queue with the approvals lifecycle");
++
++
done_testing;
-
2: e79d257 < -: ------- Added tests for more complex lifecycle searches.
More information about the rt-commit
mailing list