1 package FS::part_event::Action::cust_bill_spool_csv;
4 use base qw( FS::part_event::Action );
5 use FS::Misc::Invoicing qw( spool_formats );
7 sub description { 'Spool CSV invoice data'; }
11 sub eventtable_hashref {
17 'spoolformat' => { label => 'Format',
19 options => [ spool_formats() ],
21 'spoolbalanceover' => { label =>
22 'If balance (this invoice and previous) over',
25 'spoolagent_spools' => { label => 'Individual per-agent spools',
29 'upload_targetnum' => { label => 'Upload spool to target',
30 type => 'select-table',
31 table => 'upload_target',
33 empty_label => '(do not upload)',
34 order_by => 'targetnum',
36 'skip_nopost' => { label => 'Skip customers without postal billing enabled',
43 sub default_weight { 50; }
46 my( $self, $cust_bill, $cust_event ) = @_;
48 #my $cust_main = $self->cust_main($cust_bill);
49 my $cust_main = $cust_bill->cust_main;
51 return if $self->option('skip_nopost')
52 && ! grep { $_ eq 'POST' } $cust_main->invoicing_list;
54 $cust_bill->spool_csv(
55 'time' => $cust_event->_date,
56 'format' => $self->option('spoolformat'),
57 'balanceover' => $self->option('spoolbalanceover'),
58 'agent_spools' => $self->option('spoolagent_spools'),
59 'upload_targetnum'=> $self->option('upload_targetnum'),