+sub LimitByTicket {
+ my $self = shift;
+ my $tid = shift;
+
+ my $transactions = $self->TransactionAlias;
+ $self->Limit(
+ ENTRYAGGREGATOR => 'AND',
+ ALIAS => $transactions,
+ FIELD => 'ObjectType',
+ VALUE => 'RT::Ticket',
+ );
+
+ my $tickets = $self->Join(
+ ALIAS1 => $transactions,
+ FIELD1 => 'ObjectId',
+ TABLE2 => 'Tickets',
+ FIELD2 => 'id',
+ );
+ $self->Limit(
+ ENTRYAGGREGATOR => 'AND',
+ ALIAS => $tickets,
+ FIELD => 'EffectiveId',
+ VALUE => $tid,
+ );
+ return;
+}
+
+sub AddRecord {
+ my $self = shift;
+ my ($record) = @_;
+
+ return unless $record->TransactionObj->CurrentUserCanSee;
+ return $self->SUPER::AddRecord( $record );
+}
+
+RT::Base->_ImportOverlays();