[Rt-commit] r12545 - rt/branches/3.6-RELEASE/lib/RT

ruz at bestpractical.com ruz at bestpractical.com
Mon May 19 20:31:17 EDT 2008


Author: ruz
Date: Mon May 19 20:31:16 2008
New Revision: 12545

Modified:
   rt/branches/3.6-RELEASE/lib/RT/Tickets_Overlay.pm

Log:
* fix a failing test with a lot of comments...

Modified: rt/branches/3.6-RELEASE/lib/RT/Tickets_Overlay.pm
==============================================================================
--- rt/branches/3.6-RELEASE/lib/RT/Tickets_Overlay.pm	(original)
+++ rt/branches/3.6-RELEASE/lib/RT/Tickets_Overlay.pm	Mon May 19 20:31:16 2008
@@ -1473,15 +1473,36 @@
 
     $self->_OpenParen;
 
+    $self->_OpenParen;
     $self->_SQLLimit(
         ALIAS      => $TicketCFs,
         FIELD      => 'Content',
         OPERATOR   => $op,
         VALUE      => $value,
-        QUOTEVALUE => 1,
         @rest
     );
 
+    # XXX: if we join via CustomFields table then
+    # because of order of left joins we get NULLs in
+    # CF table and then get nulls for those records
+    # in OCFVs table what result in wrong results
+    # as decifer method now tries to load a CF then
+    # we fall into this situation only when there
+    # are more than one CF with the name in the DB.
+    # the same thing applies to order by call.
+    # TODO: reorder joins T <- OCFVs <- CFs <- OCFs if
+    # we want treat IS NULL as (not applies or has
+    # no value)
+    $self->_SQLLimit(
+        ALIAS      => $CFs,
+        FIELD      => 'Name',
+        OPERATOR   => 'IS NOT',
+        VALUE      => 'NULL',
+        QUOTEVALUE => 1,
+        ENTRYAGGREGATOR => 'AND',
+    ) if $CFs;
+    $self->_CloseParen;
+
     if ($null_columns_ok) {
         $self->_SQLLimit(
             ALIAS           => $TicketCFs,
@@ -1570,6 +1591,15 @@
            my $cfkey = $cfid ? $cfid : "$queue.$field";
            $cfkey .= ".ordering" if !$cf_obj || ($cf_obj->MaxValues||0) != 1;
            my ($TicketCFs, $CFs) = $self->_CustomFieldJoin( $cfkey, $cfid, $field );
+           # this is described in _CustomFieldLimit
+           $self->_SQLLimit(
+               ALIAS      => $CFs,
+               FIELD      => 'Name',
+               OPERATOR   => 'IS NOT',
+               VALUE      => 'NULL',
+               QUOTEVALUE => 1,
+               ENTRYAGGREGATOR => 'AND',
+           ) if $CFs;
            unless ($cfid) {
                # For those cases where we are doing a join against the
                # CF name, and don't have a CFid, use Unique to make sure


More information about the Rt-commit mailing list