1504a4fa99ceb208d9fe955730751d48cdb2b74c
[freeside.git] / FS / FS / part_event / Action / cust_bill_spool_csv.pm
1 package FS::part_event::Action::cust_bill_spool_csv;
2
3 use strict;
4 use base qw( FS::part_event::Action );
5
6 sub description { 'Spool CSV invoice data'; }
7
8 sub deprecated { 1; }
9
10 sub eventtable_hashref {
11   { 'cust_bill' => 1 };
12 }
13
14 sub option_fields {
15   (
16     'spoolformat'       => { label   => 'Format',
17                              type    => 'select',
18                              options => ['default', 'billco', 'oneline'],
19                              option_labels => { 'default' => 'Default',
20                                                 'billco'  => 'Billco',
21                                                 'oneline' => 'One line',
22                                               },
23                            },
24     'spoolbalanceover'  => { label =>
25                                'If balance (this invoice and previous) over',
26                              type  => 'money',
27                            },
28     'spoolagent_spools' => { label => 'Individual per-agent spools',
29                              type  => 'checkbox',
30                              value => '1',
31                            },
32   );
33 }
34
35 sub default_weight { 50; }
36
37 sub do_action {
38   my( $self, $cust_bill ) = @_;
39
40   #my $cust_main = $self->cust_main($cust_bill);
41   my $cust_main = $cust_bill->cust_main;
42
43   $cust_bill->spool_csv(
44     'format'       => $self->option('spoolformat'),
45     'balanceover'  => $self->option('spoolbalanceover'),
46     'agent_spools' => $self->option('spoolagent_spools'),
47   );
48 }
49
50 1;