X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Flib%2FRT%2FTickets.pm;h=af6b6edb9f94a8a659669835166fa1cc24054ae0;hb=7d6a2e0b66cc0c3f5ff7187bafb1d6e8fb1db525;hp=4d091ce7a0ac87f23a78a77e8956a75454e7384e;hpb=5b3efac57771fbc37874a3dd39d3df835cdd6133;p=freeside.git diff --git a/rt/lib/RT/Tickets.pm b/rt/lib/RT/Tickets.pm index 4d091ce7a..af6b6edb9 100755 --- a/rt/lib/RT/Tickets.pm +++ b/rt/lib/RT/Tickets.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -89,7 +89,6 @@ use base 'RT::SearchBuilder'; sub Table { 'Tickets'} use RT::CustomFields; -use DBIx::SearchBuilder::Unique; # Configuration Tables: @@ -2014,16 +2013,6 @@ sub OrderByCols { QUOTEVALUE => 1, ENTRYAGGREGATOR => 'AND', ) if $CFs; - unless ($cf_obj) { - # For those cases where we are doing a join against the - # CF name, and don't have a CFid, use Unique to make sure - # we don't show duplicate tickets. NOTE: I'm pretty sure - # this will stay mixed in for the life of the - # class/package, and not just for the life of the object. - # Potential performance issue. - require DBIx::SearchBuilder::Unique; - DBIx::SearchBuilder::Unique->import; - } my $CFvs = $self->Join( TYPE => 'LEFT', ALIAS1 => $ObjectCFs, @@ -2288,7 +2277,7 @@ sub _FreesideFieldLimit { # if it's compound, create a join from cust_main or cust_svc to that # table, using custnum or svcnum, and Limit on that table instead. - my @_SQLLimit = (); + my @Limit = (); foreach my $a (@alias) { if ( $table2 ) { $a = $self->Join( @@ -2318,8 +2307,12 @@ sub _FreesideFieldLimit { # will produce a subclause: "cust_main_1.custnum IS NOT NULL OR # cust_main_2.custnum IS NOT NULL" (or "IS NULL AND..." for a negative # query). - #$self->_SQLLimit( - push @_SQLLimit, { + # This requires the ENTRYAGGREGATOR to be OR for positive queries + # (where a matching customer exists), but ONLY between these two + # constraints and NOT with anything else in the query, hence the + # subclause. + + push @Limit, { %rest, ALIAS => $a, FIELD => $pkey, @@ -2331,11 +2324,10 @@ sub _FreesideFieldLimit { }; } - $self->_OpenParen; - foreach my $_SQLLimit (@_SQLLimit) { - $self->_SQLLimit( %$_SQLLimit); + foreach (@Limit) { + # _SQLLimit would force SUBCLAUSE to 'ticketsql'; bypass it + $self->SUPER::Limit( %$_ ); } - $self->_CloseParen; }