import rt 3.4.6
[freeside.git] / rt / html / Ticket / Elements / ShowAttachments
index 8a2a5cb..82028dd 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 }}}
 % if (keys %documents) {
 <& /Elements/TitleBoxStart, title => loc('Attachments'), 
         title_class=> 'inverse',  
@@ -82,8 +82,12 @@ if ($size) {
 % }
 
 <%INIT>
-my %documents;
 
+# If we haven't been passed in an Attachments object (through the precaching mechanism)
+# then we need to find one
+$Attachments ||= $m->comp('FindAttachments', Ticket => $Ticket);
+
+my %documents;
 while ( my $attach = $Attachments->Next() ) {
     next unless ($attach->Filename());
    unshift( @{ $documents{ $attach->Filename } }, $attach );