[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.5-286-g771eadf

Ruslan Zakirov ruz at bestpractical.com
Fri Oct 9 14:49:12 EDT 2009


The branch, 3.8-trunk has been updated
       via  771eadff7930e642b8415b207b0085099ea4b0e1 (commit)
      from  55289bb0304f1dca06d1b179a3c3ede6565c5eb2 (commit)

Summary of changes:
 lib/RT/SQL.pm                |   26 +++++++++++++++++++++-----
 sbin/rt-test-dependencies.in |    1 -
 2 files changed, 21 insertions(+), 6 deletions(-)

- Log -----------------------------------------------------------------
commit 771eadff7930e642b8415b207b0085099ea4b0e1
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Oct 9 22:48:12 2009 +0400

    make dependency on Parse::BooleanLogic optional

diff --git a/lib/RT/SQL.pm b/lib/RT/SQL.pm
index 96c65f8..3074328 100644
--- a/lib/RT/SQL.pm
+++ b/lib/RT/SQL.pm
@@ -51,7 +51,10 @@ package RT::SQL;
 use strict;
 use warnings;
 
-use Parse::BooleanLogic;
+use constant HAS_BOOLEAN_PARSER => do {
+    local $@;
+    eval { require Parse::BooleanLogic; 1 }
+};
 
 # States
 use constant VALUE       => 1;
@@ -215,13 +218,17 @@ sub _BitmaskToString {
 sub PossibleCustomFields {
     my %args = (Query => undef, CurrentUser => undef, @_);
 
-    my $tree = Parse::BooleanLogic->filter(
-        RT::SQL::ParseToArray( $args{'Query'} ),
-        sub { $_[0]->{'key'} =~ /^Queue(?:\z|\.)/ },
-    );
     my $cfs = RT::CustomFields->new( $args{'CurrentUser'} );
     my $ocf_alias = $cfs->_OCFAlias;
     $cfs->LimitToLookupType( 'RT::Queue-RT::Ticket' );
+
+    my $tree;
+    if ( HAS_BOOLEAN_PARSER ) {
+        $tree = Parse::BooleanLogic->filter(
+            RT::SQL::ParseToArray( $args{'Query'} ),
+            sub { $_[0]->{'key'} =~ /^Queue(?:\z|\.)/ },
+        );
+    }
     if ( $tree ) {
         my $clause = 'QUEUES';
         my $queue_alias = $cfs->Join(
@@ -269,10 +276,19 @@ sub PossibleCustomFields {
 
         $cfs->_CloseParen($clause);
         $cfs->_CloseParen($clause);
+    } else {
+        $cfs->Limit(
+            ENTRYAGGREGATOR => 'AND',
+            ALIAS           => $ocf_alias,
+            FIELD           => 'ObjectId',
+            OPERATOR        => 'IS NOT',
+            VALUE           => 'NULL',
+        );
     }
     return $cfs;
 }
 
+
 eval "require RT::SQL_Vendor";
 if ($@ && $@ !~ qr{^Can't locate RT/SQL_Vendor.pm}) {
     die $@;
diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index 645ebfe..b596fba 100755
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -238,7 +238,6 @@ Encode 2.21
 CSS::Squish 0.06
 File::Glob
 Devel::StackTrace 1.19
-Parse::BooleanLogic 0.09
 .
 
 $deps{'MASON'} = [ text_to_hash( << '.') ];

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


More information about the Rt-commit mailing list