summaryrefslogtreecommitdiff
path: root/rt/lib/RT/Transactions_Overlay.pm
diff options
context:
space:
mode:
authorivan <ivan>2005-10-15 09:11:20 +0000
committerivan <ivan>2005-10-15 09:11:20 +0000
commit673b9a458d9138523026963df6fa3b4683e09bae (patch)
tree42acc524ff5fd53e4fdb2f5b6dac4a42ce8057f6 /rt/lib/RT/Transactions_Overlay.pm
parent591613cf1c861505335646fff3ffb4a705e011bf (diff)
parentd4d0590bef31071e8809ec046717444b95b3f30a (diff)
This commit was generated by cvs2svn to compensate for changes in r4407,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'rt/lib/RT/Transactions_Overlay.pm')
-rw-r--r--rt/lib/RT/Transactions_Overlay.pm76
1 files changed, 73 insertions, 3 deletions
diff --git a/rt/lib/RT/Transactions_Overlay.pm b/rt/lib/RT/Transactions_Overlay.pm
index 62a072750..fe5157556 100644
--- a/rt/lib/RT/Transactions_Overlay.pm
+++ b/rt/lib/RT/Transactions_Overlay.pm
@@ -1,8 +1,8 @@
-# {{{ BEGIN BPS TAGGED BLOCK
+# BEGIN BPS TAGGED BLOCK {{{
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
# <jesse@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -42,7 +42,8 @@
# works based on those contributions, and sublicense and distribute
# those contributions and any derivatives thereof.
#
-# }}} END BPS TAGGED BLOCK
+# END BPS TAGGED BLOCK }}}
+
=head1 NAME
RT::Transactions - a collection of RT Transaction objects
@@ -65,6 +66,9 @@ ok (require RT::Transactions);
=cut
+
+package RT::Transactions;
+
use strict;
no warnings qw(redefine);
@@ -85,6 +89,72 @@ sub _Init {
}
# }}}
+=head2 Limit
+
+A wrapper around SUPER::Limit to catch migration issues
+
+=cut
+
+sub Limit {
+ my $self = shift;
+ my %args = (@_);
+
+ if ($args{'FIELD'} eq 'Ticket') {
+ Carp::cluck("Historical code calling RT::Transactions::Limit with a 'Ticket'. This deprecated API will be deleted in 3.6");
+ $self->SUPER::Limit(FIELD => 'ObjectType', OPERATOR => '=', VALUE =>'RT::Ticket');
+ $args{'FIELD'} = 'ObjectId';
+ $self->SUPER::Limit(%args);
+
+ } else {
+
+ $self->SUPER::Limit(%args);
+ }
+
+
+}
+
+
+
+=head2 LimitToTicket TICKETID
+
+Find only transactions for the ticket whose id is TICKETID.
+
+This includes tickets merged into TICKETID.
+
+Repeated calls to this method will intelligently limit down to that set of tickets, joined with an OR
+
+
+=cut
+
+
+sub LimitToTicket {
+ my $self = shift;
+ my $tid = shift;
+
+ unless ( $self->{'tickets_table'} ) {
+ $self->{'tickets_table'} ||= $self->NewAlias('Tickets');
+ $self->Join(
+ ALIAS1 => 'main',
+ FIELD1 => 'ObjectId',
+ ALIAS2 => $self->{'tickets_table'},
+ FIELD2 => 'id'
+ );
+ $self->Limit(
+ FIELD => 'ObjectType',
+ VALUE => 'RT::Ticket',
+ );
+ }
+ $self->Limit(
+ ALIAS => $self->{tickets_table},
+ FIELD => 'EffectiveId',
+ OPERATOR => '=',
+ ENTRYAGGREGATOR => 'OR',
+ VALUE => $tid,
+ );
+
+}
+
+
# {{{ sub Next
sub Next {
my $self = shift;