[freeside-commits] freeside/httemplate/view bill_batch.cgi, 1.4, 1.5

Mark Wells mark at wavetail.420.am
Sat Jul 30 16:13:42 PDT 2011


Update of /home/cvs/cvsroot/freeside/httemplate/view
In directory wavetail.420.am:/tmp/cvs-serv19526/httemplate/view

Modified Files:
	bill_batch.cgi 
Log Message:
rearrange flow of batch download, #947

Index: bill_batch.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/view/bill_batch.cgi,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -d -r1.4 -r1.5
--- bill_batch.cgi	13 Jul 2011 01:22:19 -0000	1.4
+++ bill_batch.cgi	30 Jul 2011 23:13:40 -0000	1.5
@@ -1,39 +1,8 @@
-% if($magic eq 'download') {
-%   my $content = $batch->pdf;
-%   $batch->pdf('');
-%   my $error = $batch->replace;
-%   warn "error deleting cached PDF: '$error'\n" if $error;
-%
-%   $m->clear_buffer;
-%   $r->content_type('application/pdf');
-%   $r->headers_out->add('Content-Disposition' => 'attachment;filename="invoice_batch_'.$batchnum.'.pdf"');
-<% $content %>
-% }
-%
-% 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 {
 <% include('/search/elements/search.html', 
               'title'     => $close ?
                               "Batch $batchnum closed." :
                               "Invoice Batch $batchnum",
+              'menubar'   => ['All batches' => $p.'search/bill_batch.cgi'],
               'name'      => 'invoices',
               'query'     => { 'table'   => 'cust_bill_batch',
                                'select'  => join(', ',
@@ -49,7 +18,6 @@
                              },
               'count_query' => "SELECT COUNT(*) FROM cust_bill_batch WHERE batchnum = $batchnum",
               'html_init' => $html_init,
-              'html_foot' => $html_foot,
               'header'    => [ 'Invoice #',
                                'Amount',
                                'Date',
@@ -67,7 +35,6 @@
                              ],
               'really_disable_download' => 1,
 ) %>
-% }
 <%init>
 
 die "access denied"
@@ -80,38 +47,23 @@
 $batch = FS::bill_batch->by_key($batchnum);
 die "Batch '$batchnum' not found!\n" if !$batch;
 
-my $magic = $cgi->param('magic');
-$cgi->delete('magic');
-
 my $close = $cgi->param('close');
 $batch->close if $close;
 
-my $html_init = '';
-my $html_foot = '';
-if ( !$magic ) {
-  $html_init .= qq!<FORM NAME="OneTrueForm">
-    <INPUT TYPE="hidden" NAME="batchnum" VALUE="$batchnum">!;
-  $html_init .= include('/elements/progress-init.html',
+my $html_init = qq!<FORM NAME="OneTrueForm">
+  <INPUT TYPE="hidden" NAME="batchnum" VALUE="$batchnum">! .
+  include('/elements/progress-init.html',
                   'OneTrueForm',
                   [ 'batchnum' ],
                   $p.'misc/process/bill_batch-print.html',
-                  {
-                    'popup_url' => $cgi->self_url . ';magic=download_popup',
-                  },
-                  '',
-  );
-  $html_init .= '</FORM>
-<A HREF="javascript:process()">Download this batch</A></BR>';
+    { url => $p.'misc/download-bill_batch.html?'.$batchnum }
+  ) .
+  '<A HREF="#" onclick="process();">Download this batch</A></FORM><BR>';
   if ( $batch->status eq 'O' ) {
     $cgi->param('close' => 1);
     $html_init .= '<A HREF="'.$cgi->self_url.'">Close this batch</A><BR>';
   }
   $html_init .= '<BR>';
-  if ( $cgi->param('start_download') ) {
-    $cgi->delete('start_download');
-    $html_foot = '<SCRIPT TYPE="text/javascript">process();</SCRIPT>';
-  }
-}
 
 my $link = [ "$p/view/cust_bill.cgi?", 'invnum' ];
 my $clink = [ "$p/view/cust_main.cgi?", 'custnum' ];



More information about the freeside-commits mailing list