X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fbill_batch.cgi;h=b740bdc68ac9517e3c856b7f9a79cd725efff352;hb=06fd3d9f3ca53b2d2f7595e55be4b129ca69511c;hp=6d7e18fee8cf0f0001722be85267f772ddb34658;hpb=982ded2d929bdcdfa72efa810273f3bc753bf036;p=freeside.git
diff --git a/httemplate/search/bill_batch.cgi b/httemplate/search/bill_batch.cgi
index 6d7e18fee..b740bdc68 100755
--- a/httemplate/search/bill_batch.cgi
+++ b/httemplate/search/bill_batch.cgi
@@ -1,4 +1,32 @@
-<% include( 'elements/search.html',
+% my $batchnum = $cgi->param('download');
+% if ( $batchnum =~ /^\d+$/ ) {
+% my $download = $p."misc/download-bill_batch.html?$batchnum";
+
+
Starting download...
+
+
+
+
+
+<& /elements/footer.html &>
+% }
+% else {
+%# delete existing download cookie
+% my $cookie = CGI::Cookie->new(
+% -name => 'bill_batch_download',
+% -value => 0,
+% -expires => '-1d',
+% );
+% $r->headers_out->add( 'Set-Cookie' => $cookie->as_string );
+<& elements/search.html,
'title' => 'Invoice Batches',
'name_singular' => 'batch',
'query' => { 'table' => 'bill_batch',
@@ -25,30 +53,40 @@
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,
'agent_virt' => 1,
'agent_null_right' => [ 'Process global invoice batches', 'Configuration' ],
'agent_pos' => 1,
+ 'html_foot' => include('.foot'),
- )
-
-%>
+&>
+%}
+<%def .foot>
+
+%def>
<%init>
my $curuser = $FS::CurrentUser::CurrentUser;
@@ -67,10 +105,26 @@ my $count_query = "SELECT COUNT(*) FROM bill_batch WHERE". # $extra_sql AND "
#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']
-};
+
+sub download_link {
+ my $batch = shift;
+ my $batchnum = $batch->batchnum;
+ my $close = ($batch->status eq 'O' ? ';close=1' : '');
+ my $html = qq!';
+ return $html;
+}
+
%init>