correct last_bill problems with $0 invoice (non-existant) edge cases
[freeside.git] / FS / FS / cust_pkg.pm
index 5132abe..8529e08 100644 (file)
@@ -477,6 +477,10 @@ Useful for billing metered services.
 
 sub last_bill {
   my $self = shift;
+  if ( $self->dbdef_table->column('manual_flag') ) {
+    return $self->setfield('last_bill', $_[1]) if @_;
+    return $self->getfield('last_bill') if $self->getfield('last_bill');
+  }    
   my $cust_bill_pkg = qsearchs('cust_bill_pkg', { 'pkgnum' => $self->pkgnum,
                                                   'edate'  => $self->bill,  } );
   $cust_bill_pkg ? $cust_bill_pkg->sdate : $self->setup || 0;