fix big in RADIUS session viewing when using an ignored-accounting export
[freeside.git] / FS / FS / cust_bill.pm
index f31e455..2755be0 100644 (file)
@@ -683,7 +683,7 @@ sub _agent_invoice_from {
 sub _agent_plandata {
   my( $self, $option ) = @_;
 
-  my $cust_bill_event = qsearchs( 'part_bill_event',
+  my $part_bill_event = qsearchs( 'part_bill_event',
     {
       'payby'     => $self->cust_main->payby,
       'plan'      => 'send_agent',
@@ -697,12 +697,13 @@ sub _agent_plandata {
     'ORDER BY seconds LIMIT 1'
   );
 
-  return '' unless $cust_bill_event;
+  return '' unless $part_bill_event;
 
-  if ( $cust_bill_event->plandata =~ /^$option (.*)$/m ) {
+  if ( $part_bill_event->plandata =~ /^$option (.*)$/m ) {
     return $1;
   } else {
-    warn "can't parse plandata for $1";
+    warn "can't parse part_bill_event eventpart#". $part_bill_event->eventpart.
+         " plandata for $option";
     return '';
   }
 
@@ -719,14 +720,16 @@ L<Time::Local> and L<Date::Parse> for conversion functions.
 
 =cut
 
+#still some false laziness w/print_text
 sub print_text {
 
   my( $self, $today, $template ) = @_;
   $today ||= time;
+
 #  my $invnum = $self->invnum;
-  my $cust_main = qsearchs('cust_main', { 'custnum', $self->custnum } );
+  my $cust_main = $self->cust_main;
   $cust_main->payname( $cust_main->first. ' '. $cust_main->getfield('last') )
-    unless $cust_main->payname && $cust_main->payby ne 'CHEK';
+    unless $cust_main->payname && $cust_main->payby !~ /^(CHEK|DCHK)$/;
 
   my( $pr_total, @pr_cust_bill ) = $self->previous; #previous balance
 #  my( $cr_total, @cr_cust_credit ) = $self->cust_credit; #credits
@@ -966,7 +969,7 @@ sub print_latex {
 #  my $invnum = $self->invnum;
   my $cust_main = $self->cust_main;
   $cust_main->payname( $cust_main->first. ' '. $cust_main->getfield('last') )
-    unless $cust_main->payname && $cust_main->payby ne 'CHEK';
+    unless $cust_main->payname && $cust_main->payby !~ /^(CHEK|DCHK)$/;
 
   my( $pr_total, @pr_cust_bill ) = $self->previous; #previous balance
 #  my( $cr_total, @cr_cust_credit ) = $self->cust_credit; #credits