[Rt-commit] rt branch, 4.0/tickets-entryaggregator-none, created. rt-4.0.5-82-g705bf2a

Thomas Sibley trs at bestpractical.com
Wed Mar 14 15:40:30 EDT 2012


The branch, 4.0/tickets-entryaggregator-none has been created
        at  705bf2af674ac8d88edbd57a26a83bc7dcd32ab5 (commit)

- Log -----------------------------------------------------------------
commit 705bf2af674ac8d88edbd57a26a83bc7dcd32ab5
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Wed Mar 14 15:31:40 2012 -0400

    Make ENTRYAGGREGATOR => 'none' work for RT::Tickets
    
    "none" is a supported aggregator in DBIx::SearchBuilder and using it
    means your Limit _replaces_ any existing limits.  This is particularly
    useful when programmatically building collections in a loop.

diff --git a/lib/RT/Tickets.pm b/lib/RT/Tickets.pm
index 7ed43f7..738c3e6 100644
--- a/lib/RT/Tickets.pm
+++ b/lib/RT/Tickets.pm
@@ -3379,7 +3379,11 @@ sub _RestrictionsToClauses {
         # here is where we store extra data, say if it's a keyword or
         # something.  (I.e. "TYPE SPECIFIC STUFF")
 
-        push @{ $clause{$realfield} }, $data;
+        if (lc $ea eq 'none') {
+            $clause{$realfield} = [ $data ];
+        } else {
+            push @{ $clause{$realfield} }, $data;
+        }
     }
     return \%clause;
 }
diff --git a/t/api/tickets.t b/t/api/tickets.t
index cabb00e..50d08f7 100644
--- a/t/api/tickets.t
+++ b/t/api/tickets.t
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 use RT;
-use RT::Test tests => 16;
+use RT::Test tests => 18;
 
 
 {
@@ -101,3 +101,16 @@ ok( $unlimittickets->Count > 0, "UnLimited tickets object should return tickets"
 
 }
 
+
+{
+    my $tickets = RT::Tickets->new( RT->SystemUser );
+    $tickets->Limit( FIELD => 'id', OPERATOR => '>', VALUE => 0 );
+    my $count = $tickets->Count();
+    ok $count > 1, "found more than one ticket";
+    undef $count;
+
+    $tickets->Limit( FIELD => 'id', OPERATOR => '=', VALUE => 1, ENTRYAGGREGATOR => 'none' );
+    $count = $tickets->Count();
+    ok $count == 1, "found one ticket";
+}
+

-----------------------------------------------------------------------


More information about the Rt-commit mailing list