X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fbill_batch.cgi;h=a181aab570510779ed0fdf20e28bf4360562d5fb;hb=873ec8e0528b7a944aec88936538fe9a04cd0b3f;hp=72e5d3a8b0e3cc56e0d4c63a178fcfa6bf7c2aaf;hpb=b1c1559dec0570bc401ccd0e29e66a9bf6f151e1;p=freeside.git diff --git a/httemplate/search/bill_batch.cgi b/httemplate/search/bill_batch.cgi index 72e5d3a8b..a181aab57 100755 --- a/httemplate/search/bill_batch.cgi +++ b/httemplate/search/bill_batch.cgi @@ -1,3 +1,18 @@ +% my $batchnum = $cgi->param('download'); +% if ( $batchnum =~ /^\d+$/ ) { +% $cgi->delete('download'); + +Starting download... + + +<& /elements/footer.html &> +% } +% else { <% include( 'elements/search.html', 'title' => 'Invoice Batches', 'name_singular' => 'batch', @@ -25,26 +40,19 @@ sub { $statusmap{shift->status}; }, - sub { shift->status eq 'O' ? - 'Download and close' : 'Download' - }, + \&download_link, ], 'links' => [ $link, $link, $link, - $dlink, - ], - 'style' => [ - '', - '', '', - sub { shift->status eq 'O' ? "b" : '' }, - ], + ], 'really_disable_download' => 1, ) %> +%} <%init> die "access denied" @@ -56,10 +64,28 @@ my $count_query = 'SELECT COUNT(*) FROM bill_batch'; my $extra_sql = ''; # may add something here later my $link = [ "${p}view/bill_batch.cgi?batchnum=", 'batchnum' ]; -my $dlink = sub { - [ "${p}view/bill_batch.cgi?start_download=1;". - (shift->status eq 'O' ? 'close=1;' : ''). - 'batchnum=', - 'batchnum'] -}; + +my $download_id = int(rand(1000000)); + +sub download_link { + my $batch = shift; + my $batchnum = $batch->batchnum; + my $close = ($batch->status eq 'O' ? ';close=1' : ''); + my $html = qq!
+ + + !; + $html .= include('/elements/progress-init.html', + "Download$batchnum", + [ 'batchnum', 'close' ], + $p.'misc/process/bill_batch-print.html', + { url => $p."search/bill_batch.cgi?download=$batchnum" }, + "batch$batchnum" #key + ); + $html .= '' . + ($batch->status eq 'O' ? 'Download and close' : 'Download'); + $html .= '
'; + return $html; +} +