X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_bill_event.pm;h=ddd676281015e0d3b9803f306979889ed495b231;hp=146a30e024ff32f92c80a224e53c1108be86eae0;hb=b563ce9b834e4b8c3b2f0508f6c528d8b881e08d;hpb=e78d63847de9fbcb78d22188a25b77b7678f1cee diff --git a/FS/FS/cust_bill_event.pm b/FS/FS/cust_bill_event.pm index 146a30e02..ddd676281 100644 --- a/FS/FS/cust_bill_event.pm +++ b/FS/FS/cust_bill_event.pm @@ -3,6 +3,7 @@ package FS::cust_bill_event; use strict; use vars qw( @ISA ); use FS::Record qw( qsearch qsearchs ); +use FS::cust_bill; use FS::part_bill_event; @ISA = qw(FS::Record); @@ -43,6 +44,10 @@ currently supported: =item _date - specified as a UNIX timestamp; see L. Also see L and L for conversion functions. +=item status - event status: B or B + +=item statustext - additional status detail (i.e. error message) + =back =head1 METHODS @@ -111,13 +116,13 @@ sub check { || $self->ut_textn('statustext') ; - return "Unknown invnum" + return "Unknown invnum ". $self->invnum unless qsearchs( 'cust_bill' ,{ 'invnum' => $self->invnum } ); - return "Unknown eventpart" + return "Unknown eventpart ". $self->eventpart unless qsearchs( 'part_bill_event' ,{ 'eventpart' => $self->eventpart } ); - ''; #no error + $self->SUPER::check; } =item part_bill_event @@ -132,6 +137,32 @@ sub part_bill_event { qsearchs( 'part_bill_event', { 'eventpart' => $self->eventpart } ); } +=item cust_bill + +Returns the invoice (see L) for this completed invoice event. + +=cut + +sub cust_bill { + my $self = shift; + qsearchs( 'cust_bill', { 'invnum' => $self->invnum } ); +} + +=item retry + +Changes the status of this event from B to B, allowing it to be +retried. + +=cut + +sub retry { + my $self = shift; + return '' unless $self->status eq 'done'; + my $old = ref($self)->new( { $self->hash } ); + $self->status('failed'); + $self->replace($old); +} + =back =head1 BUGS