combine ticket notification scrips, #15353
[freeside.git] / httemplate / view / attachment.html
index c85b137..5827e3d 100644 (file)
@@ -4,13 +4,12 @@ $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';
+my $attach = qsearchs('cust_attachment', { attachnum => $attachnum }) or die "Attachment not found: $attachnum";
+die 'access denied' if $attach->disabled;
 
+$r->subprocess_env('no-gzip' => 1); # disable mod_deflate
 $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;
-
+$m->print($attach->body);
 </%init>