From: Christopher Burger Date: Tue, 3 Apr 2018 16:04:43 +0000 (-0400) Subject: RT 37817 - created new billing event condition, invoice has not been sent. X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=6981e02e3ba3c08a39faffd09f4a93d680b916ee;ds=sidebyside RT 37817 - created new billing event condition, invoice has not been sent. --- diff --git a/FS/FS/part_event/Condition/invoice_has_not_been_sent.pm b/FS/FS/part_event/Condition/invoice_has_not_been_sent.pm new file mode 100644 index 000000000..882762dfe --- /dev/null +++ b/FS/FS/part_event/Condition/invoice_has_not_been_sent.pm @@ -0,0 +1,41 @@ +package FS::part_event::Condition::invoice_has_not_been_sent; + +use strict; +use FS::Record qw( qsearchs ); +use FS::cust_bill; +use Time::Local 'timelocal'; + +use base qw( FS::part_event::Condition ); + +sub description { + 'Invoice has not been sent previously'; +} + +sub eventtable_hashref { + { 'cust_main' => 0, + 'cust_bill' => 1, + 'cust_pkg' => 0, + }; +} + +sub condition { + my($self, $cust_bill, %opt) = @_; + + my $event = qsearchs( { + 'table' => 'cust_event', + 'addl_from' => 'LEFT JOIN part_event USING ( eventpart )', + 'hashref' => { + 'tablenum' => $cust_bill->{Hash}->{invnum}, + 'eventtable' => 'cust_bill', + 'status' => 'done', + }, + 'order_by' => " LIMIT 1", + } ); + + return 0 if $event; + + 1; + +} + +1; \ No newline at end of file