[Rt-commit] r4396 - in rt/branches/3.4-RELEASE: html/Elements

ruz at bestpractical.com ruz at bestpractical.com
Wed Jan 18 16:15:47 EST 2006


Author: ruz
Date: Wed Jan 18 16:15:46 2006
New Revision: 4396

Modified:
   rt/branches/3.4-RELEASE/html/Elements/Quicksearch
   rt/branches/3.4-RELEASE/lib/RT/Tickets_Overlay.pm

Log:
* in _EnumLimit load referenced object only if value
  is defined and is not number, this could safe several
  fetches from caches or in worst case from DB
* use this advantage in Quicksearch element,
  change in load time should be noticable on the systems
  with many queues


Modified: rt/branches/3.4-RELEASE/html/Elements/Quicksearch
==============================================================================
--- rt/branches/3.4-RELEASE/html/Elements/Quicksearch	(original)
+++ rt/branches/3.4-RELEASE/html/Elements/Quicksearch	Wed Jan 18 16:15:46 2006
@@ -57,12 +57,10 @@
 while (my $queue = $Queues->Next) {
   next unless ($queue->CurrentUserHasRight('ShowTicket'));
 
-  my $name = $queue->Name;
-  $name =~ s|(['\\])|\\$1|g;
-  
-  my $new_q = "Queue = '$name' AND Status = 'new'";
-  my $open_q = "Queue = '$name' AND Status = 'open'";
-  my $all_q = "Queue = '$name' AND (Status = 'open' OR Status = 'new')";
+  my $qid = $queue->Id;
+  my $new_q = "Queue = '$qid' AND Status = 'new'";
+  my $open_q = "Queue = '$qid' AND Status = 'open'";
+  my $all_q = "Queue = '$qid' AND (Status = 'open' OR Status = 'new')";
 
   $Tickets->FromSQL($open_q);
   my $open = $Tickets->Count();

Modified: rt/branches/3.4-RELEASE/lib/RT/Tickets_Overlay.pm
==============================================================================
--- rt/branches/3.4-RELEASE/lib/RT/Tickets_Overlay.pm	(original)
+++ rt/branches/3.4-RELEASE/lib/RT/Tickets_Overlay.pm	Wed Jan 18 16:15:46 2006
@@ -272,7 +272,7 @@
         or $op     eq "!=";
 
     my $meta = $FIELDS{$field};
-    if ( defined $meta->[1] ) {
+    if ( defined $meta->[1] && defined $value && $value !~ /^\d+$/ ) {
         my $class = "RT::" . $meta->[1];
         my $o     = $class->new( $sb->CurrentUser );
         $o->Load($value);
@@ -1413,12 +1413,11 @@
         @_
     );
 
-    #TODO  VALUE should also take queue names and queue objects
-    #TODO FIXME why are we canonicalizing to name, not id, robrt?
-    if ( $args{VALUE} =~ /^\d+$/ ) {
+    #TODO  VALUE should also take queue objects
+    if ( defined $args{'VALUE'} && $args{'VALUE'} !~ /^\d+$/ ) {
         my $queue = new RT::Queue( $self->CurrentUser );
         $queue->Load( $args{'VALUE'} );
-        $args{VALUE} = $queue->Name;
+        $args{'VALUE'} = $queue->Id;
     }
 
     # What if they pass in an Id?  Check for isNum() and convert to
@@ -1428,10 +1427,10 @@
 
     $self->Limit(
         FIELD       => 'Queue',
-        VALUE       => $args{VALUE},
+        VALUE       => $args{'VALUE'},
         OPERATOR    => $args{'OPERATOR'},
         DESCRIPTION => join(
-            ' ', $self->loc('Queue'), $args{'OPERATOR'}, $args{VALUE},
+            ' ', $self->loc('Queue'), $args{'OPERATOR'}, $args{'VALUE'},
         ),
     );
 


More information about the Rt-commit mailing list