diff options
author | Christopher Burger <burgerc@freeside.biz> | 2019-01-15 14:08:36 -0500 |
---|---|---|
committer | Christopher Burger <burgerc@freeside.biz> | 2019-01-15 20:49:41 -0500 |
commit | 338485d75b27ea0e5ab561856720633f890374c4 (patch) | |
tree | 632e3b37cce33d691257f0cfdfb08703a2a5bf14 /FS/FS/part_event | |
parent | d5d62e40593d5153afd64527accad35b7f4fda2e (diff) |
RT# 37817 - added a declaration to cust bill event actions that send out invoices
Diffstat (limited to 'FS/FS/part_event')
-rw-r--r-- | FS/FS/part_event/Action.pm | 12 | ||||
-rw-r--r-- | FS/FS/part_event/Action/cust_bill_email.pm | 3 | ||||
-rw-r--r-- | FS/FS/part_event/Action/cust_bill_fsinc_print.pm | 3 | ||||
-rw-r--r-- | FS/FS/part_event/Action/cust_bill_print.pm | 3 | ||||
-rw-r--r-- | FS/FS/part_event/Action/cust_bill_print_pdf.pm | 3 | ||||
-rw-r--r-- | FS/FS/part_event/Action/cust_bill_send.pm | 3 | ||||
-rw-r--r-- | FS/FS/part_event/Action/cust_bill_send_agent.pm | 3 | ||||
-rw-r--r-- | FS/FS/part_event/Action/cust_bill_send_alternate.pm | 3 | ||||
-rw-r--r-- | FS/FS/part_event/Action/cust_bill_send_csv_ftp.pm | 3 | ||||
-rw-r--r-- | FS/FS/part_event/Action/cust_bill_send_if_newest.pm | 3 | ||||
-rw-r--r-- | FS/FS/part_event/Action/cust_bill_send_reminder.pm | 3 | ||||
-rw-r--r-- | FS/FS/part_event/Action/cust_bill_send_with_notice.pm | 3 | ||||
-rw-r--r-- | FS/FS/part_event/Condition/invoice_has_not_been_sent.pm | 11 |
13 files changed, 47 insertions, 9 deletions
diff --git a/FS/FS/part_event/Action.pm b/FS/FS/part_event/Action.pm index 1916e40..fb63ffe 100644 --- a/FS/FS/part_event/Action.pm +++ b/FS/FS/part_event/Action.pm @@ -152,6 +152,18 @@ sub deprecated { 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 diff --git a/FS/FS/part_event/Action/cust_bill_email.pm b/FS/FS/part_event/Action/cust_bill_email.pm index 80bcaa1..0f833af 100644 --- a/FS/FS/part_event/Action/cust_bill_email.pm +++ b/FS/FS/part_event/Action/cust_bill_email.pm @@ -5,6 +5,9 @@ use base qw( FS::part_event::Action ); 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 }; } diff --git a/FS/FS/part_event/Action/cust_bill_fsinc_print.pm b/FS/FS/part_event/Action/cust_bill_fsinc_print.pm index e1e25bf..ea98137 100644 --- a/FS/FS/part_event/Action/cust_bill_fsinc_print.pm +++ b/FS/FS/part_event/Action/cust_bill_fsinc_print.pm @@ -5,6 +5,9 @@ use base qw( FS::part_event::Action ); 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 }; } diff --git a/FS/FS/part_event/Action/cust_bill_print.pm b/FS/FS/part_event/Action/cust_bill_print.pm index e6a27a3..4c1311f 100644 --- a/FS/FS/part_event/Action/cust_bill_print.pm +++ b/FS/FS/part_event/Action/cust_bill_print.pm @@ -5,6 +5,9 @@ use base qw( FS::part_event::Action ); 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 }; } diff --git a/FS/FS/part_event/Action/cust_bill_print_pdf.pm b/FS/FS/part_event/Action/cust_bill_print_pdf.pm index 6c01d42..38257b1 100644 --- a/FS/FS/part_event/Action/cust_bill_print_pdf.pm +++ b/FS/FS/part_event/Action/cust_bill_print_pdf.pm @@ -5,6 +5,9 @@ use base qw( FS::part_event::Action ); 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 }; } diff --git a/FS/FS/part_event/Action/cust_bill_send.pm b/FS/FS/part_event/Action/cust_bill_send.pm index c6928dc..d3dc4b7 100644 --- a/FS/FS/part_event/Action/cust_bill_send.pm +++ b/FS/FS/part_event/Action/cust_bill_send.pm @@ -5,6 +5,9 @@ use base qw( FS::part_event::Action ); 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 }; } diff --git a/FS/FS/part_event/Action/cust_bill_send_agent.pm b/FS/FS/part_event/Action/cust_bill_send_agent.pm index cb13b1f..fcd1613 100644 --- a/FS/FS/part_event/Action/cust_bill_send_agent.pm +++ b/FS/FS/part_event/Action/cust_bill_send_agent.pm @@ -10,6 +10,9 @@ sub description { # 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 }; } diff --git a/FS/FS/part_event/Action/cust_bill_send_alternate.pm b/FS/FS/part_event/Action/cust_bill_send_alternate.pm index fb71a5a..ef8e4c0 100644 --- a/FS/FS/part_event/Action/cust_bill_send_alternate.pm +++ b/FS/FS/part_event/Action/cust_bill_send_alternate.pm @@ -5,6 +5,9 @@ use base qw( FS::part_event::Action ); 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 }; } diff --git a/FS/FS/part_event/Action/cust_bill_send_csv_ftp.pm b/FS/FS/part_event/Action/cust_bill_send_csv_ftp.pm index 56ba680..9db8e02 100644 --- a/FS/FS/part_event/Action/cust_bill_send_csv_ftp.pm +++ b/FS/FS/part_event/Action/cust_bill_send_csv_ftp.pm @@ -8,6 +8,9 @@ sub description { 'Upload CSV invoice data to an FTP server'; } sub deprecated { 1; } +## declaring that this action will send out an invoice +sub will_send_invoice { 1; } + sub eventtable_hashref { { 'cust_bill' => 1 }; } diff --git a/FS/FS/part_event/Action/cust_bill_send_if_newest.pm b/FS/FS/part_event/Action/cust_bill_send_if_newest.pm index c744362..f946f7e 100644 --- a/FS/FS/part_event/Action/cust_bill_send_if_newest.pm +++ b/FS/FS/part_event/Action/cust_bill_send_if_newest.pm @@ -12,6 +12,9 @@ sub description { # 1; #} +## declaring that this action will send out an invoice +sub will_send_invoice { 1; } + sub eventtable_hashref { { 'cust_bill' => 1 }; } diff --git a/FS/FS/part_event/Action/cust_bill_send_reminder.pm b/FS/FS/part_event/Action/cust_bill_send_reminder.pm index 354f969..f3326d5 100644 --- a/FS/FS/part_event/Action/cust_bill_send_reminder.pm +++ b/FS/FS/part_event/Action/cust_bill_send_reminder.pm @@ -5,6 +5,9 @@ use base qw( FS::part_event::Action ); 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 }; } diff --git a/FS/FS/part_event/Action/cust_bill_send_with_notice.pm b/FS/FS/part_event/Action/cust_bill_send_with_notice.pm index efaa035..d015940 100644 --- a/FS/FS/part_event/Action/cust_bill_send_with_notice.pm +++ b/FS/FS/part_event/Action/cust_bill_send_with_notice.pm @@ -7,6 +7,9 @@ use MIME::Entity; 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, diff --git a/FS/FS/part_event/Condition/invoice_has_not_been_sent.pm b/FS/FS/part_event/Condition/invoice_has_not_been_sent.pm index 4868f66..df78bf7 100644 --- a/FS/FS/part_event/Condition/invoice_has_not_been_sent.pm +++ b/FS/FS/part_event/Condition/invoice_has_not_been_sent.pm @@ -21,15 +21,8 @@ sub eventtable_hashref { 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', |