}
$actions{$mod} = {
( map { $_ => "FS::part_event::Action::$mod"->$_() }
- qw( description eventtable_hashref default_weight deprecated )
+ qw( description eventtable_hashref default_weight deprecated will_send_invoice )
#option_fields_hashref
),
'option_fields' => [ "FS::part_event::Action::$mod"->option_fields() ],
keys %actions
}
+=item invoice_send_actions
+
+Returns a list of action names that send invoices
+
+=cut
+
+sub invoice_send_actions {
+ my ( $class ) = @_;
+
+ grep { $actions{$_}->{'will_send_invoice'} }
+ keys %actions
+
+}
+
=item process_initialize 'eventpart' => EVENTPART
Job queue wrapper for "initialize". EVENTPART identifies the
0;
}
+=item will_send_invoice
+
+Action classes may define a will_send_invoice method that returns true, indicating
+that this action is sending out an invoice.
+
+=cut
+
+#default
+sub will_send_invoice {
+ 0;
+}
+
=item do_action CUSTOMER_EVENT_OBJECT
Action classes must define an action method. This method is triggered if
sub description { 'Send invoice (email only)'; }
+## declaring that this action will send out an invoice
+sub will_send_invoice { 1; }
+
sub eventtable_hashref {
{ 'cust_bill' => 1 };
}
sub description { 'Send invoice to Freeside Inc. for printing and mailing'; }
+## declaring that this action will send out an invoice
+sub will_send_invoice { 1; }
+
sub eventtable_hashref {
{ 'cust_bill' => 1 };
}
sub description { 'Send invoice (print only)'; }
+## declaring that this action will send out an invoice
+sub will_send_invoice { 1; }
+
sub eventtable_hashref {
{ 'cust_bill' => 1 };
}
sub description { 'Send invoice (spool PDF only)'; }
+## declaring that this action will send out an invoice
+sub will_send_invoice { 1; }
+
sub eventtable_hashref {
{ 'cust_bill' => 1 };
}
sub description { 'Send invoice (email/print/fax)'; }
+## declaring that this action will send out an invoice
+sub will_send_invoice { 1; }
+
sub eventtable_hashref {
{ 'cust_bill' => 1 };
}
# this event is just cust_bill_send_alternate + an implicit (and inefficient)
# 'agent' condition
+## declaring that this action will send out an invoice
+sub will_send_invoice { 1; }
+
sub eventtable_hashref {
{ 'cust_bill' => 1 };
}
sub description { 'Send invoice (email/print/fax) with alternate template'; }
+## declaring that this action will send out an invoice
+sub will_send_invoice { 1; }
+
sub eventtable_hashref {
{ 'cust_bill' => 1 };
}
sub deprecated { 1; }
+## declaring that this action will send out an invoice
+sub will_send_invoice { 1; }
+
sub eventtable_hashref {
{ 'cust_bill' => 1 };
}
# 1;
#}
+## declaring that this action will send out an invoice
+sub will_send_invoice { 1; }
+
sub eventtable_hashref {
{ 'cust_bill' => 1 };
}
sub description { 'Send invoice (email/print/fax) reminder'; }
+## declaring that this action will send out an invoice
+sub will_send_invoice { 1; }
+
sub eventtable_hashref {
{ 'cust_bill' => 1 };
}
sub description { 'Email a notice to the customer with invoice attached'; }
+## declaring that this action will send out an invoice
+sub will_send_invoice { 1; }
+
sub eventtable_hashref {
{
'cust_main' => 1,
sub condition {
my($self, $cust_bill, %opt) = @_;
- ## search actions for invoice send events.
- my @send_actions = (
- "action LIKE 'cust_bill_send%'",
- "action LIKE 'cust_bill_email%'",
- "action LIKE 'cust_bill_print%'",
- "action LIKE 'cust_bill_fsinc_print%'",
- );
- my $actions = join ' OR ', @send_actions;
- my $extra_sql = " AND ($actions)";
+ my $invoice_send_actions = join "', '", (FS::part_event::invoice_send_actions());
+ my $extra_sql = " AND action in ('".$invoice_send_actions."')";
my $event = qsearchs( {
'table' => 'cust_event',