zip email CDRs, RT#40112
authorIvan Kohler <ivan@freeside.biz>
Fri, 5 Feb 2016 13:30:08 +0000 (05:30 -0800)
committerIvan Kohler <ivan@freeside.biz>
Fri, 5 Feb 2016 13:30:08 +0000 (05:30 -0800)
FS/FS/Template_Mixin.pm
httemplate/edit/cust_main/billing.html
httemplate/view/cust_main/billing.html

index 6d661f1..1f67792 100644 (file)
@@ -2257,7 +2257,7 @@ sub generate_email {
   my @otherparts = ();
   if ( ref($self) eq 'FS::cust_bill' && $cust_main->email_csv_cdr ) {
 
-    if ( $conf->exists('voip-cust_email_csv_cdr_zip') ) {
+    if ( $conf->config('voip-cdr_email_attach') eq 'zip' ) {
 
       my $data = join('', map "$_\n",
                    $self->call_details(prepend_billed_number=>1)
@@ -2273,13 +2273,14 @@ sub generate_email {
       die "Error zipping CDR attachment: $!" unless $status == AZ_OK;
 
       push @otherparts, build MIME::Entity
-        'Type'       => 'application/zip',
-        'Encoding'   => 'base64',
-        'Data'       => $zipdata,
+        'Type'        => 'application/zip',
+        'Encoding'    => 'base64',
+        'Data'        => $zipdata,
+        'Disposition' => 'attachment',
         'Filename'    => 'usage-'. $self->invnum. '.zip',
       ;
 
-    } else {
+    } else { # } elsif ( $conf->config('voip-cdr_email_attach') eq 'csv' ) {
  
       push @otherparts, build MIME::Entity
         'Type'        => 'text/csv',
index fcb44a5..50262e8 100644 (file)
@@ -234,9 +234,9 @@ function toggle(obj) {
       <INPUT TYPE="hidden" NAME="squelch_cdr" VALUE="<% $cust_main->squelch_cdr %>">
 % }
 
-% if ( $conf->config('voip-cdr_email_attach') ) { 
+% if ( my $attach = $conf->config('voip-cdr_email_attach') ) {
       <TR>
-       <TD COLSPAN="2"><INPUT TYPE="checkbox" NAME="email_csv_cdr" VALUE="Y" <% $cust_main->email_csv_cdr eq "Y" ? 'CHECKED' : '' %>> <% mt('Attach CDRs as CSV to emailed invoices') |h %></TD>
+       <TD COLSPAN="2"><INPUT TYPE="checkbox" NAME="email_csv_cdr" VALUE="Y" <% $cust_main->email_csv_cdr eq "Y" ? 'CHECKED' : '' %>> <% mt('Attach CDRs as '. uc($attach). ' to emailed invoices') |h %></TD>
       </TR>
 % } else { 
       <INPUT TYPE="hidden" NAME="email_csv_cdr" VALUE="<% $cust_main->email_csv_cdr %>">
index cca140b..08b4323 100644 (file)
    </TR>
 % }
 
-% if ( $conf->config('voip-cdr_email_attach') ) { 
+% if ( my $attach = $conf->config('voip-cdr_email_attach') ) { 
   <TR>
-    <TH ALIGN="right"><% mt('Email CDRs as CSV') |h %></TH>
+    <TH ALIGN="right"><% mt('Email CDRs as '.uc($attach)) |h %></TH>
     <TD><% $cust_main->email_csv_cdr ? $yes : $no %></TD>
   </TR>
 % }