X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_event%2FAction%2Fcust_bill_print.pm;h=e6a27a34e6403e0f1ab4ff1304513445097a0042;hb=d22baa4e71bfa9e153c1fe1152ff4c748f1d935c;hp=ea6e0aa8e7cb34867b8ec978f4ec5b3770468ed3;hpb=eb3bd392a89b8b666dc512951e78913c05b98810;p=freeside.git diff --git a/FS/FS/part_event/Action/cust_bill_print.pm b/FS/FS/part_event/Action/cust_bill_print.pm index ea6e0aa8e..e6a27a34e 100644 --- a/FS/FS/part_event/Action/cust_bill_print.pm +++ b/FS/FS/part_event/Action/cust_bill_print.pm @@ -14,19 +14,32 @@ sub option_fields { 'modenum' => { label => 'Invoice mode', type => 'select-invoice_mode', }, + 'skip_nopost' => { label => 'Skip customers without postal billing enabled', + type => 'checkbox', + value => 'Y', + }, ); } sub default_weight { 51; } sub do_action { - my( $self, $cust_bill ) = @_; + my( $self, $cust_bill, $cust_event ) = @_; #my $cust_main = $self->cust_main($cust_bill); my $cust_main = $cust_bill->cust_main; $cust_bill->set('mode' => $self->option('modenum')); - $cust_bill->print; + if ( $self->option('skip_nopost') + && ! grep { $_ eq 'POST' } $cust_main->invoicing_list + ) { + # then skip customers + $cust_event->set('no_action', 'Y'); + return "customer doesn't receive postal invoices"; # as statustext + + } else { + $cust_bill->print; + } } 1;