X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fbill_batch.cgi;h=cfd44fe508ce1adaa67a0f33b1faf7166b942f8e;hb=d6ff3967df6ee08263023a4d35865b66bdb8a672;hp=72757568ebfd5e4b9c0574a5048370de0872009e;hpb=b7dbecfb82aea90a4289089927d0b17436b2ed5a;p=freeside.git diff --git a/httemplate/view/bill_batch.cgi b/httemplate/view/bill_batch.cgi index 72757568e..cfd44fe50 100644 --- a/httemplate/view/bill_batch.cgi +++ b/httemplate/view/bill_batch.cgi @@ -1,20 +1,4 @@ -% if($magic eq 'print') { -<% include('/elements/header.html', "Download Batch") %> -
- -% $cgi->delete('magic'); -<% include('/elements/progress-init.html', - 'OneTrueForm', - [ 'batchnum' ], - $p.'misc/process/bill_batch-print.html', - {'url' => $cgi->self_url . ';magic=download'}, - '', -) %>
- -<% include('/elements/footer.html') %> -% } -% -% elsif($magic eq 'download') { +% if($magic eq 'download') { % $m->clear_buffer; % $r->content_type('application/pdf'); % $r->headers_out->add('Content-Disposition' => 'attachment;filename="invoice_batch_'.$batchnum.'.pdf"'); @@ -23,6 +7,26 @@ % 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"' } &> + +
+ +Download batch #<% $batchnum %> + +
+<& /elements/footer.html &> +% +% } +% % else { <% include('/search/elements/search.html', 'title' => $close ? @@ -39,11 +43,11 @@ 'addl_from' => 'LEFT JOIN cust_bill USING ( invnum ) '. 'LEFT JOIN cust_main USING ( custnum )', - 'extra_sql' => '', - " WHERE batchnum = $batchnum", + 'extra_sql' => " WHERE batchnum = $batchnum", }, 'count_query' => "SELECT COUNT(*) FROM cust_bill_batch WHERE batchnum = $batchnum", 'html_init' => $html_init, + 'html_foot' => $html_foot, 'header' => [ 'Invoice #', 'Amount', 'Date', @@ -67,9 +71,6 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('View invoices'); -use Data::Dumper; -warn Dumper($cgi->Vars); - my $conf = new FS::Conf; my $batch; my $batchnum = $cgi->param('batchnum'); @@ -78,21 +79,36 @@ $batch = FS::bill_batch->by_key($batchnum); die "Batch '$batchnum' not found!\n" if !$batch; my $magic = $cgi->param('magic'); -my $html_init = ''; +$cgi->delete('magic'); my $close = $cgi->param('close'); $batch->close if $close; -if(!$magic) { - $cgi->param('magic' => 'print'); - $cgi->delete('close'); - $html_init = 'Download this batch
'; - if($batch->status eq 'O') { +my $html_init = ''; +my $html_foot = ''; +if ( !$magic ) { + $html_init .= qq!
+ !; + $html_init .= include('/elements/progress-init.html', + 'OneTrueForm', + [ 'batchnum' ], + $p.'misc/process/bill_batch-print.html', + { + 'popup_url' => $cgi->self_url . ';magic=download_popup', + }, + '', + ); + $html_init .= '
+Download this batch
'; + if ( $batch->status eq 'O' ) { $cgi->param('close' => 1); - $cgi->delete('magic'); $html_init .= 'Close this batch
'; } $html_init .= '
'; + if ( $cgi->param('start_download') ) { + $cgi->delete('start_download'); + $html_foot = ''; + } } my $link = [ "$p/view/cust_bill.cgi?", 'invnum' ];