[Rt-commit] [svn] r1649 - in rt/branches/3.3-TESTING: . lib/RT
jesse at pallas.eruditorum.org
jesse at pallas.eruditorum.org
Mon Oct 11 17:10:41 EDT 2004
Author: jesse
Date: Mon Oct 11 17:10:40 2004
New Revision: 1649
Modified:
rt/branches/3.3-TESTING/ (props changed)
rt/branches/3.3-TESTING/lib/RT/Tickets_Overlay.pm
rt/branches/3.3-TESTING/lib/RT/Tickets_Overlay_SQL.pm
Log:
r1985 at tinbook: jesse | 2004-10-11T20:26:31.046336Z
Fixed a bug in the merge from 3.2 that broke ticket transaction searching; added support for Ticket "Updated" as a synonym for TransactionDate as a search criterion
Modified: rt/branches/3.3-TESTING/lib/RT/Tickets_Overlay.pm
==============================================================================
--- rt/branches/3.3-TESTING/lib/RT/Tickets_Overlay.pm (original)
+++ rt/branches/3.3-TESTING/lib/RT/Tickets_Overlay.pm Mon Oct 11 17:10:40 2004
@@ -123,6 +123,7 @@
ContentType => ['TRANSFIELD',],
Filename => ['TRANSFIELD',],
TransactionDate => ['TRANSDATE',],
+ Updated => ['TRANSDATE',],
Requestor => ['WATCHERFIELD' => 'Requestor',],
Requestors => ['WATCHERFIELD' => 'Requestor',],
Cc => ['WATCHERFIELD' => 'Cc',],
@@ -479,6 +480,7 @@
=cut
+# This routine should really be factored into translimit.
sub _TransDateLimit {
my ($sb,$field,$op,$value, at rest) = @_;
@@ -489,19 +491,9 @@
$sb->{_sql_trattachalias} = $sb->NewAlias ('Attachments')
unless defined $sb->{_sql_trattachalias};
- $sb->_OpenParen;
# Join Transactions To Attachments
- $sb->_SQLJoin( ALIAS1 => $sb->{_sql_trattachalias}, FIELD1 => 'TransactionId',
- ALIAS2 => $sb->{_sql_transalias}, FIELD2 => 'id');
-
- # Join Transactions to Tickets
- $sb->_SQLJoin( ALIAS1 => 'main', FIELD1 => $sb->{'primary_key'}, # UGH!
- ALIAS2 => $sb->{_sql_transalias}, FIELD2 => 'Ticket');
-
- my $d = new RT::Date( $sb->CurrentUser );
- $d->Set( Format => 'ISO', Value => $value);
- $value = $d->ISO;
+ $sb->_OpenParen;
#Search for the right field
$sb->_SQLLimit(ALIAS => $sb->{_sql_trattachalias},
@@ -512,6 +504,20 @@
@rest
);
+ $sb->_SQLJoin( ALIAS1 => $sb->{_sql_trattachalias}, FIELD1 => 'TransactionId',
+ ALIAS2 => $sb->{_transalias}, FIELD2 => 'id');
+
+ # Join Transactions to Tickets
+ $sb->_SQLJoin( ALIAS1 => 'main', FIELD1 => $sb->{'primary_key'}, # UGH!
+ ALIAS2 => $sb->{_sql_transalias}, FIELD2 => 'ObjectId');
+
+ $sb->Limit( ALIAS => $sb->{_sql_transalias}, FIELD => 'ObjectType', VALUE => 'RT::Ticket');
+
+
+ my $d = new RT::Date( $sb->CurrentUser );
+ $d->Set( Format => 'ISO', Value => $value);
+ $value = $d->ISO;
+
$sb->_CloseParen;
}
@@ -557,25 +563,18 @@
# them all into the same subclause when you have (A op B op C) - the
# way they get parsed in the tree they're in different subclauses.
- my ($sb,$field,$op,$value, at rest) = @_;
+ my ($self,$field,$op,$value, at rest) = @_;
- $sb->{_sql_transalias} = $sb->NewAlias ('Transactions')
- unless defined $sb->{_sql_transalias};
- $sb->{_sql_trattachalias} = $sb->NewAlias ('Attachments')
- unless defined $sb->{_sql_trattachalias};
+ $self->{_sql_transalias} = $self->NewAlias ('Transactions')
+ unless defined $self->{_sql_transalias};
+ $self->{_sql_trattachalias} = $self->NewAlias ('Attachments')
+ unless defined $self->{_sql_trattachalias};
- $sb->_OpenParen;
- # Join Transactions To Attachments
- $sb->_SQLJoin( ALIAS1 => $sb->{_sql_trattachalias}, FIELD1 => 'TransactionId',
- ALIAS2 => $sb->{_sql_transalias}, FIELD2 => 'id');
-
- # Join Transactions to Tickets
- $sb->_SQLJoin( ALIAS1 => 'main', FIELD1 => $sb->{'primary_key'}, # UGH!
- ALIAS2 => $sb->{_sql_transalias}, FIELD2 => 'Ticket');
+ $self->_OpenParen;
#Search for the right field
- $sb->_SQLLimit(ALIAS => $sb->{_sql_trattachalias},
+ $self->_SQLLimit(ALIAS => $self->{_sql_trattachalias},
FIELD => $field,
OPERATOR => $op,
VALUE => $value,
@@ -583,7 +582,18 @@
@rest
);
- $sb->_CloseParen;
+
+ $self->_SQLJoin( ALIAS1 => $self->{_sql_trattachalias}, FIELD1 => 'TransactionId',
+ ALIAS2 => $self->{_sql_transalias}, FIELD2 => 'id');
+
+ # Join Transactions to Tickets
+ $self->_SQLJoin( ALIAS1 => 'main', FIELD1 => $self->{'primary_key'}, # Why not use "id" here?
+ ALIAS2 => $self->{_sql_transalias}, FIELD2 => 'ObjectId');
+
+ $self->Limit( ALIAS => $self->{_sql_transalias}, FIELD => 'ObjectType', VALUE => 'RT::Ticket', ENTRYAGGREGATOR => 'AND');
+
+
+ $self->_CloseParen;
}
Modified: rt/branches/3.3-TESTING/lib/RT/Tickets_Overlay_SQL.pm
==============================================================================
--- rt/branches/3.3-TESTING/lib/RT/Tickets_Overlay_SQL.pm (original)
+++ rt/branches/3.3-TESTING/lib/RT/Tickets_Overlay_SQL.pm Mon Oct 11 17:10:40 2004
@@ -435,14 +435,13 @@
my ($id, $msg) = $tix->FromSQL($query);
+
ok ($id, $msg);
is ($tix->Count, scalar @ids, "number of returned tickets same as entered");
-
while (my $tick = $tix->Next) {
push @expectedids, $tick->Id;
}
-
ok (eq_array(\@ids, \@expectedids), "returned expected tickets");
$query = ("id = $ids[0] OR MemberOf = $ids[0]");
More information about the Rt-commit
mailing list