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 ## declaring that this action will send out an invoice
14 sub will_send_invoice { 1; }
16 sub eventtable_hashref {
22 'agentnum' => { label => 'Only for agent(s)',
23 type => 'select-agent',
26 'modenum' => { label => 'Invoice mode',
27 type => 'select-invoice_mode',
29 'agent_templatename' => { label => 'Template',
30 type => 'select-invoice_template',
32 'agent_invoice_from' => 'Invoice email From: address',
36 sub default_weight { 50; }
39 my( $self, $cust_bill ) = @_;
41 #my $cust_main = $self->cust_main($cust_bill);
42 my $cust_main = $cust_bill->cust_main;
44 my %agentnums = map { $_=>1 } split(/\s*,\s*/, $self->option('agentnum'));
45 if (keys(%agentnums) and !exists($agentnums{$cust_main->agentnum})) {
49 $cust_bill->set('mode' => $self->option('modenum'));
51 'template' => $self->option('agent_templatename'),
52 'from' => $self->option('agent_invoice_from'),