[Rt-commit] r4178 - in rt/branches/CHALDEA-EXPERIMENTAL: .
html/Search lib/RT lib/t/regression
jesse at bestpractical.com
jesse at bestpractical.com
Wed Nov 30 16:26:35 EST 2005
Author: jesse
Date: Wed Nov 30 16:26:34 2005
New Revision: 4178
Modified:
rt/branches/CHALDEA-EXPERIMENTAL/ (props changed)
rt/branches/CHALDEA-EXPERIMENTAL/html/Search/Results.html
rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Tickets_Overlay.pm
rt/branches/CHALDEA-EXPERIMENTAL/lib/t/regression/12-search.t
rt/branches/CHALDEA-EXPERIMENTAL/lib/t/regression/20-sort-by-requestor.t
Log:
r19595 at truegrounds: jesse | 2005-11-30 16:04:52 -0500
r19551 at truegrounds: jesse | 2005-11-30 15:24:09 -0500
r19350 at truegrounds (orig r4145): alexmv | 2005-11-23 16:32:25 -0500
r7341 at zoq-fot-pik: chmrr | 2005-11-23 16:31:44 -0500
* Limiting based on CFs should make sure that the CFs in question are
on the right queue, otherwise negative searches might be wrong.
* Removed debugging lines from 20-sort-by-requestor.t
r19521 at truegrounds (orig r4149): alexmv | 2005-11-28 15:00:53 -0500
r7368 at zoq-fot-pik: chmrr | 2005-11-28 15:00:18 -0500
* Search/Build.html passes Rows not RowsPerPage -- don't hard-force
to 50 all the time!
Modified: rt/branches/CHALDEA-EXPERIMENTAL/html/Search/Results.html
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/html/Search/Results.html (original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/html/Search/Results.html Wed Nov 30 16:26:34 2005
@@ -114,7 +114,7 @@
$Rows = $prefs->{'RowsPerPage'};
}
else {
- $Rows = 50;
+ $Rows ||= 50;
}
Modified: rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Tickets_Overlay.pm
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Tickets_Overlay.pm (original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Tickets_Overlay.pm Wed Nov 30 16:26:34 2005
@@ -135,7 +135,7 @@
Requestors => [ 'WATCHERFIELD' => 'Requestor', ],
Cc => [ 'WATCHERFIELD' => 'Cc', ],
AdminCc => [ 'WATCHERFIELD' => 'AdminCc', ],
- Watcher => ['WATCHERFIELD'],
+ Watcher => [ 'WATCHERFIELD', ],
LinkedTo => [ 'LINKFIELD', ],
CustomFieldValue => [ 'CUSTOMFIELD', ],
CF => [ 'CUSTOMFIELD', ],
@@ -1207,6 +1207,7 @@
}
my $TicketCFs;
+ my $CFs;
my $cfkey = $cfid ? $cfid : "$queue.$field";
# Perform one Join per CustomField
@@ -1230,16 +1231,23 @@
);
}
else {
- my $cfalias = $self->Join(
+ my $ocfalias = $self->Join(
TYPE => 'left',
- EXPRESSION => "'$field'",
+ FIELD1 => 'Queue',
+ TABLE2 => 'ObjectCustomFields',
+ FIELD2 => 'ObjectId',
+ );
+ $CFs = $self->Join(
+ TYPE => 'left',
+ ALIAS1 => $ocfalias,
+ FIELD1 => 'CustomField',
TABLE2 => 'CustomFields',
- FIELD2 => 'Name',
+ FIELD2 => 'id',
);
$TicketCFs = $self->{_sql_object_cf_alias}{$cfkey} = $self->Join(
TYPE => 'left',
- ALIAS1 => $cfalias,
+ ALIAS1 => $CFs,
FIELD1 => 'id',
TABLE2 => 'ObjectCustomFieldValues',
FIELD2 => 'CustomField',
@@ -1267,8 +1275,16 @@
);
}
- $self->_OpenParen if ($null_columns_ok);
+ $self->_OpenParen;
+
+ $self->SUPER::Limit(
+ ALIAS => $CFs,
+ FIELD => 'name',
+ VALUE => $field,
+ ENTRYAGGREGATOR => 'AND',
+ );
+ $self->_OpenParen if $null_columns_ok;
$self->_SQLLimit(
ALIAS => $TicketCFs,
FIELD => 'Content',
@@ -1288,7 +1304,9 @@
ENTRYAGGREGATOR => 'OR',
);
}
- $self->_CloseParen if ($null_columns_ok);
+ $self->_CloseParen if $null_columns_ok;
+
+ $self->_CloseParen;
}
Modified: rt/branches/CHALDEA-EXPERIMENTAL/lib/t/regression/12-search.t
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/lib/t/regression/12-search.t (original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/lib/t/regression/12-search.t Wed Nov 30 16:26:34 2005
@@ -6,7 +6,7 @@
use strict;
use warnings;
-use Test::More tests => 35;
+use Test::More tests => 39;
use_ok('RT');
RT::LoadConfig();
RT::Init();
@@ -38,6 +38,24 @@
my $cflabel3 = "CustomField-".$cf3->id;
+# There was a bug involving a missing join to ObjectCustomFields that
+# caused spurious results on negative searches if another custom field
+# with the same name existed on a different queue. Hence, we make
+# duplicate CFs on a different queue here
+my $dup = RT::Queue->new($RT::SystemUser);
+$dup->Create(Name => $queue . "-Copy");
+ok ($dup->id, "Created the duplicate queue");
+my $dupcf = RT::CustomField->new($RT::SystemUser);
+$dupcf->Create(Name => 'SearchTest', Type => 'Freeform', MaxValues => 0, Queue => $dup->id);
+ok($dupcf->id, "Created the duplicate SearchTest CF");
+$dupcf = RT::CustomField->new($RT::SystemUser);
+$dupcf->Create(Name => 'SearchTest2', Type => 'Freeform', MaxValues => 0, Queue => $dup->id);
+ok($dupcf->id, "Created the SearchTest2 CF");
+$dupcf = RT::CustomField->new($RT::SystemUser);
+$dupcf->Create(Name => 'SearchTest3', Type => 'Freeform', MaxValues => 0, Queue => $dup->id);
+ok($dupcf->id, "Created the SearchTest3 CF");
+
+
# setup some tickets
# we'll need a small pile of them, to test various combinations and nulls.
# there's probably a way to think harder and do this with fewer
@@ -148,8 +166,7 @@
$tix = RT::Tickets->new($RT::SystemUser);
$tix->FromSQL("Queue = '$queue' AND CF.SearchTest IS NULL");
-
- is($tix->Count, 2, "IS null CF");
+is($tix->Count, 2, "IS null CF");
$tix = RT::Tickets->new($RT::SystemUser);
$tix->FromSQL("Queue = '$queue' AND Requestors LIKE 'search1'");
@@ -218,13 +235,11 @@
$tix = RT::Tickets->new($RT::SystemUser);
$tix->FromSQL("CF.SearchTest IS NULL AND CF.SearchTest2 = 'bar2'");
-
- is($tix->Count, 1, "null cf and is cf");
+is($tix->Count, 1, "null cf and is cf");
$tix = RT::Tickets->new($RT::SystemUser);
$tix->FromSQL("Queue = '$queue' AND CF.SearchTest IS NULL AND CF.SearchTest2 IS NULL");
-
- is($tix->Count, 1, "null cf and null cf");
+is($tix->Count, 1, "null cf and null cf");
Modified: rt/branches/CHALDEA-EXPERIMENTAL/lib/t/regression/20-sort-by-requestor.t
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/lib/t/regression/20-sort-by-requestor.t (original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/lib/t/regression/20-sort-by-requestor.t Wed Nov 30 16:26:34 2005
@@ -49,7 +49,6 @@
while (my $t = $tix->Next) { push @mails, $t->RequestorAddresses; }
is(@mails, 5, "found five tickets");
is_deeply( \@mails, [ sort @mails ], "Addresses are sorted");
- print STDERR "Emails are ", join(" ", map {defined $_ ? $_ : "undef"} @mails);
}
{
@@ -60,7 +59,6 @@
while (my $t = $tix->Next) { push @mails, $t->RequestorAddresses; }
is(@mails, 6, "found six tickets");
is_deeply( \@mails, [ sort @mails ], "Addresses are sorted");
- print STDERR "Emails are ", join(" ", map {defined $_ ? $_ : "undef"} @mails);
}
# vim:ft=perl:
More information about the Rt-commit
mailing list