FCC from 477 improvements #4912
[freeside.git] / httemplate / edit / cust_main / billing.html
index 4c4be23..3f3d801 100644 (file)
@@ -477,10 +477,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>