combine ticket notification scrips, #15353
[freeside.git] / httemplate / view / attachment.html
1 <%init>
2 my ($query) = $cgi->keywords;
3 $query =~ /^(\d+)$/;
4 my $attachnum = $1 or die 'Invalid attachment number';
5 $FS::CurrentUser::CurrentUser->access_right('Download attachment') or die 'access denied';
6
7 my $attach = qsearchs('cust_attachment', { attachnum => $attachnum }) or die "Attachment not found: $attachnum";
8 die 'access denied' if $attach->disabled;
9
10 $r->subprocess_env('no-gzip' => 1); # disable mod_deflate
11 $m->clear_buffer;
12 $r->content_type($attach->mime_type || 'text/plain');
13 $r->headers_out->add('Content-Disposition' => 'attachment;filename=' . $attach->filename);
14 $m->print($attach->body);
15 </%init>