[Rt-commit] r7326 - in rt/branches/3.7-EXPERIMENTAL: .
ruz at bestpractical.com
ruz at bestpractical.com
Thu Mar 22 21:39:03 EDT 2007
Author: ruz
Date: Thu Mar 22 21:39:02 2007
New Revision: 7326
Modified:
rt/branches/3.7-EXPERIMENTAL/ (props changed)
rt/branches/3.7-EXPERIMENTAL/lib/RT/Attachments_Overlay.pm
Log:
r4780 at cubic-pc: cubic | 2007-03-23 01:26:19 +0300
* add LimitByTicket
Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Attachments_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Attachments_Overlay.pm (original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Attachments_Overlay.pm Thu Mar 22 21:39:02 2007
@@ -156,6 +156,46 @@
return;
}
+=head2 LimitByTicket $ticket_id
+
+Limit result set to attachments of a ticket.
+
+=cut
+
+sub LimitByTicket {
+ my $self = shift;
+ my $tid = shift;
+ my $transactions = $self->NewAlias('Transactions');
+ $self->Limit(
+ ENTRYAGGREGATOR => 'AND',
+ FIELD => 'TransactionId',
+ VALUE => $transactions . '.id',
+ QUOTEVALUE => 0,
+ );
+ $self->Limit(
+ ENTRYAGGREGATOR => 'AND',
+ ALIAS => $transactions,
+ FIELD => 'ObjectType',
+ VALUE => 'RT::Ticket',
+ );
+
+ my $tickets = $self->NewAlias('Tickets');
+ $self->Limit(
+ ENTRYAGGREGATOR => 'AND',
+ ALIAS => $tickets,
+ FIELD => 'id',
+ VALUE => $transactions . '.ObjectId',
+ QUOTEVALUE => 0,
+ );
+ $self->Limit(
+ ENTRYAGGREGATOR => 'AND',
+ ALIAS => $tickets,
+ FIELD => 'EffectiveId',
+ VALUE => $tid,
+ );
+ return;
+}
+
# {{{ sub NewItem
sub NewItem {
my $self = shift;
More information about the Rt-commit
mailing list