1 package FS::part_event::Action::cust_bill_send_agent;
4 use base qw( FS::part_event::Action );
7 'Send invoice (email/print/fax) with alternate template, for specific agents';
10 # this event is just cust_bill_send_alternate + an implicit (and inefficient)
13 sub eventtable_hashref {
19 'agentnum' => { label => 'Only for agent(s)',
20 type => 'select-agent',
23 'modenum' => { label => 'Invoice mode',
24 type => 'select-invoice_mode',
26 'agent_templatename' => { label => 'Template',
27 type => 'select-invoice_template',
29 'agent_invoice_from' => 'Invoice email From: address',
33 sub default_weight { 50; }
36 my( $self, $cust_bill ) = @_;
38 #my $cust_main = $self->cust_main($cust_bill);
39 my $cust_main = $cust_bill->cust_main;
41 my %agentnums = map { $_=>1 } split(/\s*,\s*/, $self->option('agentnum'));
42 if (keys(%agentnums) and !exists($agentnums{$cust_main->agentnum})) {
46 $cust_bill->set('mode' => $self->option('modenum'));
48 'template' => $self->option('agent_templatename'),
49 'from' => $self->option('agent_invoice_from'),