import rt 3.4.6
[freeside.git] / rt / html / Ticket / Elements / ShowHistory
index 37b670d..878e253 100644 (file)
@@ -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,7 @@
 %# works based on those contributions, and sublicense and distribute
 %# those contributions and any derivatives thereof.
 %# 
-%# }}} END BPS TAGGED BLOCK
+%# END BPS TAGGED BLOCK }}}
 <%perl>
  if ($ShowDisplayModes or $ShowTitle) {
 my $title;
@@ -104,8 +104,8 @@ while ( my $Transaction = $Transactions->Next ) {
     $m->comp( 'ShowTransaction',
             %ARGS,
 
-             AttachPath          => $AttachPath,
-             UpdatePath           => $UpdatePath,
+              AttachPath           => $AttachPath,
+              UpdatePath           => $UpdatePath,
               Ticket               => $Ticket,
               Transaction          => $Transaction,
               ShowHeaders          => $ShowHeaders,
@@ -116,6 +116,10 @@ while ( my $Transaction = $Transactions->Next ) {
               AttachmentContent    => $trans_content,
               LastTransaction      => $Transactions->IsLast
  );
+
+# manually flush the content buffer after each txn, so the user sees
+# some update
+$m->flush_buffer(); 
 }
 
 </%perl>
@@ -127,15 +131,21 @@ while ( my $Transaction = $Transactions->Next ) {
 my $Transactions = new RT::Transactions($session{'CurrentUser'});
 if ($Tickets) {
     while (my $t = $Tickets->Next) {
-       $Transactions->Limit(FIELD => 'Ticket',
-                            OPERATOR => '=',
-                            VALUE => $t->Id);
+        $Transactions->LimitToTicket($t->id);
     }
 } else {
     $Transactions = $Ticket->Transactions;
 }
-my $i;
 
+
+my $OldestFirst = $RT::OldestTransactionsFirst? 'ASC': 'DESC';
+$Transactions->OrderByCols( { FIELD => 'Created',
+                              ORDER => $OldestFirst },
+                            { FIELD => 'id',
+                              ORDER => $OldestFirst },
+                          );
+
+my $i;
 $Attachments ||=  $m->comp('/Ticket/Elements/FindAttachments', Ticket => $Ticket, Tickets => $Tickets || undef);
 $AttachmentContent ||= $m->comp('/Ticket/Elements/LoadTextAttachments', Ticket => $Ticket);
 
@@ -153,5 +163,4 @@ $ShowDisplayModes => 1
 $ShowTitleBarCommands => 1
 $AttachPath => $RT::WebPath."/Ticket/Attachment"
 $UpdatePath => $RT::WebPath."/Ticket/Update.html"
-
 </%ARGS>