[Rt-commit] rt branch, 4.2/autocomplete-ticket-warnings, created. rt-4.1.19-27-g77d4c60

Alex Vandiver alexmv at bestpractical.com
Tue Aug 20 18:37:48 EDT 2013


The branch, 4.2/autocomplete-ticket-warnings has been created
        at  77d4c60cb6dfe2bb2b8fe335e9394b6afaa3eda2 (commit)

- Log -----------------------------------------------------------------
commit 8b9ed15b67e4d07a8b5c169622d5aab51a7279a3
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Aug 20 18:34:41 2013 -0400

    Convert a call to the deprecated _SQLLimit function to Limit
    
    While 4f61730 removed all existant calls to _SQLLimit at the time,
    d43c6cf was later merged, which added another.  Convert it to using
    ->Limit.

diff --git a/lib/RT/Tickets.pm b/lib/RT/Tickets.pm
index e131ca3..155e551 100644
--- a/lib/RT/Tickets.pm
+++ b/lib/RT/Tickets.pm
@@ -405,7 +405,7 @@ sub _IntLimit {
     # We want to support <id LIKE '1%'> for ticket autocomplete,
     # but we need to explicitly typecast on Postgres
     if ( $is_a_like && RT->Config->Get('DatabaseType') eq 'Pg' ) {
-        return $sb->_SQLLimit(
+        return $sb->Limit(
             FUNCTION => "CAST(main.$field AS TEXT)",
             OPERATOR => $op,
             VALUE    => $value,

commit 77d4c60cb6dfe2bb2b8fe335e9394b6afaa3eda2
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Aug 20 18:37:07 2013 -0400

    Do not assume that FIELD is passed to Limit
    
    Multiple places assume that FIELD is defined; however, RT::Tickets'
    _IntLimit uses the new-ish FUNCTION argument instead, which elicits a
    number of warnings.  Avoid them by only examining case-sensitivity if
    FIELD is defined.

diff --git a/lib/RT/SearchBuilder.pm b/lib/RT/SearchBuilder.pm
index 94f299a..f96783e 100644
--- a/lib/RT/SearchBuilder.pm
+++ b/lib/RT/SearchBuilder.pm
@@ -891,7 +891,7 @@ sub Limit {
         $ARGS{'VALUE'} = 'NULL';
     }
 
-    if ($ARGS{FIELD} =~ /\W/
+    if (($ARGS{FIELD}||'') =~ /\W/
           or $ARGS{OPERATOR} !~ /^(=|<|>|!=|<>|<=|>=
                                   |(NOT\s*)?LIKE
                                   |(NOT\s*)?(STARTS|ENDS)WITH
@@ -914,7 +914,7 @@ sub Limit {
         : $self->Table
     ;
 
-    if ( $table and my $instead = $deprecated{ lc $table }{ lc $ARGS{'FIELD'} } ) {
+    if ( $table and $ARGS{FIELD} and my $instead = $deprecated{ lc $table }{ lc $ARGS{'FIELD'} } ) {
         RT->Deprecated(
             Message => "$table.$ARGS{'FIELD'} column is deprecated",
             Instead => $instead, Remove => '4.4'
@@ -922,7 +922,7 @@ sub Limit {
     }
 
     unless ( exists $ARGS{CASESENSITIVE} or (exists $ARGS{QUOTEVALUE} and not $ARGS{QUOTEVALUE}) ) {
-        if ( $ARGS{'OPERATOR'} !~ /IS/i
+        if ( $ARGS{FIELD} and $ARGS{'OPERATOR'} !~ /IS/i
             && $table && $check_case_sensitivity{ lc $table }{ lc $ARGS{'FIELD'} }
         ) {
             RT->Logger->warning(
diff --git a/lib/RT/Tickets.pm b/lib/RT/Tickets.pm
index 155e551..6400267 100644
--- a/lib/RT/Tickets.pm
+++ b/lib/RT/Tickets.pm
@@ -1339,7 +1339,7 @@ sub Limit {
         if $self->{parsing_ticketsql} and not $args{LEFTJOIN};
 
     $self->{_sql_looking_at}{ lc $args{FIELD} } = 1
-        if (not $args{ALIAS} or $args{ALIAS} eq "main");
+        if $args{FIELD} and (not $args{ALIAS} or $args{ALIAS} eq "main");
 
     $self->SUPER::Limit(%args);
 }

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


More information about the Rt-commit mailing list