X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_event%2FAction%2Fcust_bill_spool_csv.pm;h=0d84e77c47d5f5aefd6d706452a99670472faded;hb=88dbd0c961480b879faa6e8a0556202f41e8202f;hp=1504a4fa99ceb208d9fe955730751d48cdb2b74c;hpb=998dcad2d8f4b8e22b9a2f042f006b9167b8cdf3;p=freeside.git diff --git a/FS/FS/part_event/Action/cust_bill_spool_csv.pm b/FS/FS/part_event/Action/cust_bill_spool_csv.pm index 1504a4fa9..0d84e77c4 100644 --- a/FS/FS/part_event/Action/cust_bill_spool_csv.pm +++ b/FS/FS/part_event/Action/cust_bill_spool_csv.pm @@ -2,6 +2,7 @@ package FS::part_event::Action::cust_bill_spool_csv; use strict; use base qw( FS::part_event::Action ); +use FS::Misc::Invoicing qw( spool_formats ); sub description { 'Spool CSV invoice data'; } @@ -15,11 +16,7 @@ sub option_fields { ( 'spoolformat' => { label => 'Format', type => 'select', - options => ['default', 'billco', 'oneline'], - option_labels => { 'default' => 'Default', - 'billco' => 'Billco', - 'oneline' => 'One line', - }, + options => [ spool_formats() ], }, 'spoolbalanceover' => { label => 'If balance (this invoice and previous) over', @@ -29,21 +26,37 @@ sub option_fields { type => 'checkbox', value => '1', }, + 'upload_targetnum' => { label => 'Upload spool to target', + type => 'select-table', + table => 'upload_target', + name_col => 'label', + empty_label => '(do not upload)', + order_by => 'targetnum', + }, + 'skip_nopost' => { label => 'Skip customers without postal billing enabled', + type => 'checkbox', + value => 'Y', + }, ); } sub default_weight { 50; } 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; + return if $self->option('skip_nopost') + && ! grep { $_ eq 'POST' } $cust_main->invoicing_list; + $cust_bill->spool_csv( + 'time' => $cust_event->_date, 'format' => $self->option('spoolformat'), 'balanceover' => $self->option('spoolbalanceover'), 'agent_spools' => $self->option('spoolagent_spools'), + 'upload_targetnum'=> $self->option('upload_targetnum'), ); }