X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_bill_event.pm;h=4e7aa52f2358c484a7dac079db5d68e8c46b1a10;hb=3c54c844c665ed108c7892a154fd3972fab1f3e5;hp=683f48423fef44d47f414fbf5c310462754e5642;hpb=05686487551e26418c9b2d6b92ea0d89bb100082;p=freeside.git diff --git a/FS/FS/part_bill_event.pm b/FS/FS/part_bill_event.pm index 683f48423..4e7aa52f2 100644 --- a/FS/FS/part_bill_event.pm +++ b/FS/FS/part_bill_event.pm @@ -2,8 +2,11 @@ package FS::part_bill_event; use strict; use vars qw( @ISA $DEBUG @EXPORT_OK ); +use Carp qw(cluck confess); use FS::Record qw( dbh qsearch qsearchs ); use FS::Conf; +use FS::cust_main; +use FS::cust_bill; @ISA = qw( FS::Record ); @EXPORT_OK = qw( due_events ); @@ -37,10 +40,10 @@ FS::part_bill_event - Object methods for part_bill_event records =head1 DESCRIPTION -An FS::part_bill_event object represents an invoice event definition - -a callback which is triggered when an invoice is a certain amount of time -overdue. FS::part_bill_event inherits from -FS::Record. The following fields are currently supported: +An FS::part_bill_event object represents a deprecated, old-style invoice event +definition - a callback which is triggered when an invoice is a certain amount +of time overdue. FS::part_bill_event inherits from FS::Record. The following +fields are currently supported: =over 4 @@ -66,6 +69,11 @@ FS::Record. The following fields are currently supported: =back +=head1 NOTE + +Old-style invoice events are only useful for legacy migrations - if you are +looking for current events see L. + =head1 METHODS =over 4 @@ -226,6 +234,10 @@ Requires record and payby, but event_time and extra_sql are optional. sub due_events { my ($record, $payby, $event_time, $extra_sql) = @_; + + #cluck "DEPRECATED: FS::part_bill_event::due_events called on $record"; + confess "DEPRECATED: FS::part_bill_event::due_events called on $record"; + my $interval = 0; if ($record->_date){ $event_time = time unless $event_time; @@ -234,6 +246,9 @@ sub due_events { sort { $a->seconds <=> $b->seconds || $a->weight <=> $b->weight || $a->eventpart <=> $b->eventpart } + grep { ref($record) ne 'FS::cust_bill' || $_->eventcode !~ /honor_dundate/ + || $event_time > $record->cust_main->dundate + } grep { $_->seconds <= ( $interval ) && ! qsearch( 'cust_bill_event', { 'invnum' => $record->get($record->dbdef_table->primary_key), @@ -261,6 +276,10 @@ Should only be performed inside a transaction. sub do_event { my ($self, $object, %options) = @_; + + #cluck "DEPRECATED: FS::part_bill_event::do_event called on $self"; + confess "DEPRECATED: FS::part_bill_event::do_event called on $self"; + warn " calling event (". $self->eventcode. ") for " . $object->table . " " , $object->get($object->dbdef_table->primary_key) . "\n" if $DEBUG > 1; my $oldAutoCommit = $FS::UID::AutoCommit;