-% if($magic eq 'download') {
-% $m->clear_buffer;
-% $r->content_type('application/pdf');
-% $r->headers_out->add('Content-Disposition' => 'attachment;filename="invoice_batch_'.$batchnum.'.pdf"');
-<% $batch->pdf %>
-% $batch->pdf('');
-% my $error = $batch->replace;
-% warn "error deleting cached PDF: '$error'\n" if $error;
-% }
-%
-% elsif ($magic eq 'download_popup') {
-%
-<& /elements/header-popup.html,
- { 'etc' => 'BGCOLOR="#ccccff"' } &>
-<SCRIPT type="text/javascript">
-function start() {
-window.open('<% $cgi->self_url . ';magic=download' %>');
-parent.nd(1);
-}
-</SCRIPT>
-<TABLE WIDTH="100%"><TR><TD STYLE="text-align:center;vertical-align:middle">
-<FONT SIZE="+1">
-<A HREF="javascript:start()">Download batch #<% $batchnum %></A>
-</FONT>
-</TD></TR></TABLE>
-<& /elements/footer.html &>
-%
-% }
-%
-% else {