[Rt-commit] rt branch, 4.0/restore-SQL-for-search-by-id-of-link, created. rt-4.0.13-53-g9fe2bfc

Ruslan Zakirov ruz at bestpractical.com
Tue Jun 4 16:42:33 EDT 2013


The branch, 4.0/restore-SQL-for-search-by-id-of-link has been created
        at  9fe2bfcd6fcd3b8d2fadeba8a80972b4ff534b01 (commit)

- Log -----------------------------------------------------------------
commit 9fe2bfcd6fcd3b8d2fadeba8a80972b4ff534b01
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Jun 5 00:38:39 2013 +0400

    LinkType = <id> search was switched from LocalX to X columns
    
    It was side effect of 5075951855fe6bfb4f3698386a1a3d4827f25259
    change.

diff --git a/lib/RT/Tickets.pm b/lib/RT/Tickets.pm
index 41aa313..689ff83 100644
--- a/lib/RT/Tickets.pm
+++ b/lib/RT/Tickets.pm
@@ -438,10 +438,6 @@ sub _LinkLimit {
     my $is_null = 0;
     $is_null = 1 if !$value || $value =~ /^null$/io;
 
-    unless ($is_null) {
-        $value = RT::URI->new( $sb->CurrentUser )->CanonicalizeURI( $value );
-    }
-
     my $direction = $meta->[1] || '';
     my ($matchfield, $linkfield) = ('', '');
     if ( $direction eq 'To' ) {
@@ -468,6 +464,7 @@ sub _LinkLimit {
         $op = ($op =~ /^(=|IS)$/i)? 'IS': 'IS NOT';
     }
     elsif ( $value =~ /\D/ ) {
+        $value = RT::URI->new( $sb->CurrentUser )->CanonicalizeURI( $value );
         $is_local = 0;
     }
     $matchfield = "Local$matchfield" if $is_local;
diff --git a/t/ticket/search_by_links.t b/t/ticket/search_by_links.t
index d25d300..2657718 100644
--- a/t/ticket/search_by_links.t
+++ b/t/ticket/search_by_links.t
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use RT::Test nodata => 1, tests => 98;
+use RT::Test nodata => 1, tests => 100;
 use RT::Ticket;
 
 my $q = RT::Test->load_or_create_queue( Name => 'Regression' );
@@ -71,6 +71,14 @@ $total += @tickets;
 }
 run_tests();
 
+# make sure search by id is on LocalXXX columns
+{
+    my $tickets = RT::Tickets->new( RT->SystemUser );
+    $tickets->FromSQL('MemberOf = '. $tickets[0]->id);
+    like $tickets->BuildSelectQuery, qr/LocalBase/;
+    like $tickets->BuildSelectQuery, qr/LocalTarget/;
+}
+
 # another set with tests of combinations searches
 @tickets = RT::Test->create_tickets(
     { Queue => $q->id },

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


More information about the Rt-commit mailing list