]> git.uio.no Git - usit-rt.git/blobdiff - lib/RT/Transactions.pm
Putting 4.2.0 on top of 4.0.17
[usit-rt.git] / lib / RT / Transactions.pm
index 3c9dac4d7963df2f1bb53ef20e3299a7c645b5ed..e603997fda92b695e380b72f911b0aa7fe3c20dd 100644 (file)
@@ -69,11 +69,10 @@ package RT::Transactions;
 use strict;
 use warnings;
 
+use base 'RT::SearchBuilder';
 
 use RT::Transaction;
 
-use base 'RT::SearchBuilder';
-
 sub Table { 'Transactions'}
 
 # {{{ sub _Init  
@@ -85,9 +84,9 @@ sub _Init   {
   
   # By default, order by the date of the transaction, rather than ID.
   $self->OrderByCols( { FIELD => 'Created',
-                       ORDER => 'ASC' },
-                     { FIELD => 'id',
-                       ORDER => 'ASC' } );
+                        ORDER => 'ASC' },
+                      { FIELD => 'id',
+                        ORDER => 'ASC' } );
 
   return ( $self->SUPER::_Init(@_));
 }
@@ -109,11 +108,10 @@ sub LimitToTicket {
     my $tid  = shift;
 
     unless ( $self->{'tickets_table'} ) {
-        $self->{'tickets_table'} ||= $self->NewAlias('Tickets');
-        $self->Join(
+        $self->{'tickets_table'} ||= $self->Join(
             ALIAS1 => 'main',
             FIELD1 => 'ObjectId',
-            ALIAS2 => $self->{'tickets_table'},
+            TABLE2 => 'Tickets',
             FIELD2 => 'id'
         );
         $self->Limit(
@@ -134,41 +132,27 @@ sub LimitToTicket {
 
 sub Next {
     my $self = shift;
-       
+
     my $Transaction = $self->SUPER::Next();
     if ((defined($Transaction)) and (ref($Transaction))) {
-       # If the user can see the transaction's type, then they can 
-       #  see the transaction and we should hand it back.
-       if ($Transaction->Type) {
-           return($Transaction);
-       }
-
-       #If the user doesn't have the right to show this ticket
-       else {  
-           return($self->Next());
-       }
+        # If the user can see the transaction's type, then they can
+        #  see the transaction and we should hand it back.
+        if ($Transaction->Type) {
+            return($Transaction);
+        }
+
+        #If the user doesn't have the right to show this ticket
+        else {
+            return($self->Next());
+        }
     }
 
     #if there never was any ticket
     else {
-       return(undef);
-    }  
+        return(undef);
+    }
 }
 
-
-
-
-
-=head2 NewItem
-
-Returns an empty new RT::Transaction item
-
-=cut
-
-sub NewItem {
-    my $self = shift;
-    return(RT::Transaction->new($self->CurrentUser));
-}
 RT::Base->_ImportOverlays();
 
 1;