X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_bill_event.pm;h=4496bed655eb022c9fa616f2a65f1879229e792b;hb=dbb388836b7951a3db49deda05a1ff9ba5125c17;hp=7b981391e4777cefc12f5d6cc6674c58ec71cd2e;hpb=684a478c0f88e5bf6d1d3f32f4618089146b5709;p=freeside.git diff --git a/FS/FS/cust_bill_event.pm b/FS/FS/cust_bill_event.pm index 7b981391e..4496bed65 100644 --- a/FS/FS/cust_bill_event.pm +++ b/FS/FS/cust_bill_event.pm @@ -3,10 +3,11 @@ package FS::cust_bill_event; use strict; use vars qw( @ISA $DEBUG ); use FS::Record qw( qsearch qsearchs ); +use FS::cust_main_Mixin; use FS::cust_bill; use FS::part_bill_event; -@ISA = qw(FS::Record); +@ISA = qw(FS::cust_main_Mixin FS::Record); $DEBUG = 0; @@ -70,6 +71,13 @@ points to. You can ask the object for a copy with the I method. sub table { 'cust_bill_event'; } +sub cust_linked { $_[0]->cust_main_custnum; } +sub cust_unlinked_msg { + my $self = shift; + "WARNING: can't find cust_main.custnum ". $self->custnum. + ' (cust_bill.invnum '. $self->invnum. ')'; +} + =item insert Adds this record to the database. If there is an error, returns the error, @@ -118,12 +126,13 @@ sub check { || $self->ut_textn('statustext') ; + return "Unknown eventpart ". $self->eventpart + unless my $part_bill_event = + qsearchs( 'part_bill_event' ,{ 'eventpart' => $self->eventpart } ); + return "Unknown invnum ". $self->invnum unless qsearchs( 'cust_bill' ,{ 'invnum' => $self->invnum } ); - return "Unknown eventpart ". $self->eventpart - unless qsearchs( 'part_bill_event' ,{ 'eventpart' => $self->eventpart } ); - $self->SUPER::check; } @@ -165,6 +174,21 @@ sub retry { $self->replace($old); } +=item retryable + +Changes the statustext of this event to B, rendering it +retriable (should retry be called). + +=cut + +sub retriable { + my $self = shift; + return '' unless $self->status eq 'done'; + my $old = ref($self)->new( { $self->hash } ); + $self->statustext('retriable'); + $self->replace($old); +} + =back =head1 SUBROUTINES