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);
=item _date - specified as a UNIX timestamp; see L<perlfunc/"time">. Also see
L<Time::Local> and L<Date::Parse> for conversion functions.
+=item status - event status: B<done> or B<failed>
+
+=item statustext - additional status detail (i.e. error message)
+
=back
=head1 METHODS
|| $self->ut_number('invnum')
|| $self->ut_number('eventpart')
|| $self->ut_number('_date')
- || $self->ut_enum('status', [qw( done failed )]
+ || $self->ut_enum('status', [qw( done failed )])
|| $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
qsearchs( 'part_bill_event', { 'eventpart' => $self->eventpart } );
}
+=item cust_bill
+
+Returns the invoice (see L<FS::cust_bill>) 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<done> to B<failed>, 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