This commit was generated by cvs2svn to compensate for changes in r11022,
[freeside.git] / FS / FS / part_event / Action / cust_bill_send_agent.pm
1 package FS::part_event::Action::cust_bill_send_agent;
2
3 use strict;
4 use base qw( FS::part_event::Action );
5
6 sub description {
7   'Send invoice (email/print/fax) with alternate template, for specific agents';
8 }
9
10 sub eventtable_hashref {
11   { 'cust_bill' => 1 };
12 }
13
14 sub option_fields {
15   (
16     'agentnum'           => { label    => 'Only for agent(s)',
17                               type     => 'select-agent',
18                               multiple => 1
19                             },
20     'agent_templatename' => { label    => 'Template',
21                               type     => 'select-invoice_template',
22                             },
23     'agent_invoice_from' => 'Invoice email From: address',
24   );
25 }
26
27 sub default_weight { 50; }
28
29 sub do_action {
30   my( $self, $cust_bill ) = @_;
31
32   #my $cust_main = $self->cust_main($cust_bill);
33   my $cust_main = $cust_bill->cust_main;
34
35   $cust_bill->send(
36     $self->option('agent_templatename'),
37     [ split(/\s*,\s*/, $self->option('agentnum') ) ],
38     $self->option('agent_invoice_from'),
39   );
40 }
41
42 1;