support 2009 - a better way?
[freeside.git] / httemplate / edit / cust_main / billing.html
index 4c4be23..363dd04 100644 (file)
       <INPUT TYPE="hidden" NAME="squelch_cdr" VALUE="<% $cust_main->squelch_cdr %>">
 % }
 
+% if ( $conf->exists('voip-cust_email_csv_cdr') ) { 
+      <TR>
+       <TD COLSPAN="2"><INPUT TYPE="checkbox" NAME="email_csv_cdr" VALUE="Y" <% $cust_main->email_csv_cdr eq "Y" ? 'CHECKED' : '' %>> Attach CDRs as CSV to emailed invoices</TD>
+      </TR>
+% } else { 
+      <INPUT TYPE="hidden" NAME="email_csv_cdr" VALUE="<% $cust_main->email_csv_cdr %>">
+% }
 
 % if ( $show_term || $cust_main->cdr_termination_percentage ) {
       <TR>
@@ -477,10 +484,13 @@ my @payby = grep /\w/, $conf->config('payby');
 @payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP ))
   unless @payby;
 
-#false laziness w/view/cust_main/billing.html
-my $term_sql = "SELECT COUNT(*) FROM cust_pkg LEFT JOIN part_pkg USING ( pkgpart ) WHERE custnum = ? AND plan = 'cdr_termination' LIMIT 1";
-my $term_sth = dbh->prepare($term_sql)  or die dbh->errstr;
-$term_sth->execute($cust_main->custnum) or die $term_sth->errstr;
-my $show_term = $term_sth->fetchrow_arrayref->[0];
+my $show_term = '';
+if ( $cust_main->custnum ) {
+  #false laziness w/view/cust_main/billing.html
+  my $term_sql = "SELECT COUNT(*) FROM cust_pkg LEFT JOIN part_pkg USING ( pkgpart ) WHERE custnum = ? AND plan = 'cdr_termination' LIMIT 1";
+  my $term_sth = dbh->prepare($term_sql)  or die dbh->errstr;
+  $term_sth->execute($cust_main->custnum) or die $term_sth->errstr;
+  $show_term = $term_sth->fetchrow_arrayref->[0];
+}
 
 </%init>