[Rt-commit] rt branch, 4.2/remove-cfqueues-wrong-unquoting, created. rt-4.0.0rc7-247-gcd59f32
Alex Vandiver
alexmv at bestpractical.com
Mon Mar 28 15:31:47 EDT 2011
The branch, 4.2/remove-cfqueues-wrong-unquoting has been created
at cd59f326a857475090d14225598b6298e40ff25c (commit)
- Log -----------------------------------------------------------------
commit cd59f326a857475090d14225598b6298e40ff25c
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Mon Mar 28 15:23:38 2011 -0400
Remove a horrid and wrong unquoting regex used by GetReferencedQueues
GetReferencedQueues used to return the Value keys of the tree that
RT::Interface::Web::QueryBuildeR::Tree returned -- which are simply a
re-escaping of what the TicketSQL parser found. Skip having to
un-escape the re-escaped values by storing them away explicitly.
diff --git a/lib/RT/Interface/Web/QueryBuilder/Tree.pm b/lib/RT/Interface/Web/QueryBuilder/Tree.pm
index 493ab44..87b516e 100644
--- a/lib/RT/Interface/Web/QueryBuilder/Tree.pm
+++ b/lib/RT/Interface/Web/QueryBuilder/Tree.pm
@@ -112,7 +112,7 @@ sub GetReferencedQueues {
my $clause = $node->getNodeValue();
if ( $clause->{Key} eq 'Queue' ) {
- $queues->{ $clause->{Value} } = 1;
+ $queues->{ $clause->{RawValue} } = 1;
};
}
);
@@ -255,6 +255,7 @@ sub ParseSQL {
$callback{'EntryAggregator'} = sub { $node->setNodeValue( $_[0] ) };
$callback{'Condition'} = sub {
my ($key, $op, $value) = @_;
+ my $rawvalue = $value;
my ($main_key) = split /[.]/, $key;
@@ -275,7 +276,7 @@ sub ParseSQL {
}
$key = "'$key'" if $key =~ /^CF./;
- my $clause = { Key => $key, Op => $op, Value => $value };
+ my $clause = { Key => $key, Op => $op, Value => $value, RawValue => $rawvalue };
$node->addChild( __PACKAGE__->new( $clause ) );
};
$callback{'Error'} = sub { push @results, @_ };
diff --git a/lib/RT/Report/Tickets.pm b/lib/RT/Report/Tickets.pm
index 32eb4cc..7dc82d7 100644
--- a/lib/RT/Report/Tickets.pm
+++ b/lib/RT/Report/Tickets.pm
@@ -89,12 +89,6 @@ sub Groupings {
foreach my $id (keys %$queues) {
my $queue = RT::Queue->new( $self->CurrentUser );
$queue->Load($id);
- unless ($queue->id) {
- # XXX TODO: This ancient code dates from a former developer
- # we have no idea what it means or why cfqueues are so encoded.
- $id =~ s/^.'*(.*).'*$/$1/;
- $queue->Load($id);
- }
$CustomFields->LimitToQueue($queue->Id);
}
$CustomFields->LimitToGlobal;
diff --git a/share/html/Search/Build.html b/share/html/Search/Build.html
index 91c254f..9998b84 100644
--- a/share/html/Search/Build.html
+++ b/share/html/Search/Build.html
@@ -219,6 +219,7 @@ foreach my $arg ( keys %ARGS ) {
for ( my $i = 0; $i < @ops; $i++ ) {
my ( $op, $value ) = ( $ops[$i], $values[$i] );
next if !defined $value || $value eq '';
+ my $rawvalue = $value;
if ( $value eq 'NULL' && $op =~ /=/ ) {
if ( $op eq '=' ) {
@@ -240,7 +241,8 @@ foreach my $arg ( keys %ARGS ) {
my $clause = {
Key => $keyword,
Op => $op,
- Value => $value
+ Value => $value,
+ RawValue => $rawvalue,
};
push @new_values, RT::Interface::Web::QueryBuilder::Tree->new($clause);
diff --git a/share/html/Search/Elements/BuildFormatString b/share/html/Search/Elements/BuildFormatString
index 89ac642..572f1e1 100644
--- a/share/html/Search/Elements/BuildFormatString
+++ b/share/html/Search/Elements/BuildFormatString
@@ -102,15 +102,9 @@ $m->callback( CallbackOnce => 1, CallbackName => 'SetFieldsOnce', Fields => \@fi
my $CustomFields = RT::CustomFields->new( $session{'CurrentUser'});
foreach my $id (keys %cfqueues) {
- # Gotta load up the $queue object, since queues get stored by name now. my $id
+ # Gotta load up the $queue object, since queues get stored by name now.
my $queue = RT::Queue->new($session{'CurrentUser'});
$queue->Load($id);
- unless ($queue->id) {
- # XXX TODO: This ancient code dates from a former developer
- # we have no idea what it means or why cfqueues are so encoded.
- $id =~ s/^.'*(.*).'*$/$1/;
- $queue->Load($id);
- }
$CustomFields->LimitToQueue($queue->Id);
}
$CustomFields->LimitToGlobal;
diff --git a/share/html/Search/Elements/PickCFs b/share/html/Search/Elements/PickCFs
index 00adb43..5206b7d 100644
--- a/share/html/Search/Elements/PickCFs
+++ b/share/html/Search/Elements/PickCFs
@@ -51,19 +51,9 @@
<%INIT>
my $CustomFields = RT::CustomFields->new( $session{'CurrentUser'});
foreach my $id (keys %cfqueues) {
- # Gotta load up the $queue object, since queues get stored by name now. my $id
+ # Gotta load up the $queue object, since queues get stored by name now.
my $queue = RT::Queue->new($session{'CurrentUser'});
$queue->Load($id);
- unless ($queue->id) {
- # XXX TODO: This ancient code dates from a former developer
- # we have no idea what it means or why cfqueues are so encoded.
- $id =~ s/^.'*(.*).'*$/$1/;
-
- # unescape internal quotes
- $id =~ s/(\\(.))/$2 eq "'" ? "'" : $1/eg;
-
- $queue->Load($id);
- }
$CustomFields->LimitToQueue($queue->Id);
}
$CustomFields->LimitToGlobal;
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list