diff options
author | mark <mark> | 2009-08-09 09:05:38 +0000 |
---|---|---|
committer | mark <mark> | 2009-08-09 09:05:38 +0000 |
commit | 283ea2b5137ae3ec36882b492e6de024b0ce6027 (patch) | |
tree | 25edd2e6f0ba3446c13a5b3e4417cfba0447d62f /httemplate/view/attachment.html | |
parent | c183de0b7e942672cafdc1c14a203e389ffd2c43 (diff) |
Add cust_attachment stuff
Diffstat (limited to 'httemplate/view/attachment.html')
-rw-r--r-- | httemplate/view/attachment.html | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/httemplate/view/attachment.html b/httemplate/view/attachment.html new file mode 100644 index 000000000..c85b1375f --- /dev/null +++ b/httemplate/view/attachment.html @@ -0,0 +1,16 @@ +<%init> +my ($query) = $cgi->keywords; +$query =~ /^(\d+)$/; +my $attachnum = $1 or die 'Invalid attachment number'; +$FS::CurrentUser::CurrentUser->access_right('Download attachment') or die 'access denied'; + +my $attach = qsearchs('cust_attachment', { attachnum => $attachnum }) or die 'Attachment not found: $attachnum'; + +$m->clear_buffer; +$r->content_type($attach->mime_type || 'text/plain'); +$r->headers_out->add('Content-Disposition' => 'attachment;filename=' . $attach->filename); + +binmode STDOUT; +print STDOUT $attach->body; + +</%init> |