summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2011-01-19 19:12:25 +0000
committerivan <ivan>2011-01-19 19:12:25 +0000
commite88bf2f5af9cdb6091e6ceacec606868a9067934 (patch)
tree21951151deaf850417029017bc1ae9b7e3d21723
parent581d4b07156ba59e7445235305872c74aa97c6d9 (diff)
add cust_bill-no_recipients-error config, RT#11276
-rw-r--r--FS/FS/Conf.pm7
-rw-r--r--FS/FS/cust_bill.pm10
2 files changed, 15 insertions, 2 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index ad44f9f48..fe81887b9 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -4263,6 +4263,13 @@ and customer address. Include units.',
'agentonly' => 1,
},
+ {
+ 'key' => 'cust_bill-no_recipients-error',
+ 'section' => 'invoicing',
+ 'description' => 'For customers with no invoice recipients, throw a job queue error rather than the default behavior of emailing the invoice to the invoice_from address.'.
+ 'type' => 'checkbox',
+ },
+
{ key => "apacheroot", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
{ key => "apachemachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
{ key => "apachemachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm
index 6581578f5..f07834297 100644
--- a/FS/FS/cust_bill.pm
+++ b/FS/FS/cust_bill.pm
@@ -1241,8 +1241,14 @@ sub email {
my @invoicing_list = grep { $_ !~ /^(POST|FAX)$/ }
$self->cust_main->invoicing_list;
- #better to notify this person than silence
- @invoicing_list = ($invoice_from) unless @invoicing_list;
+ if ( ! @invoicing_list ) { #no recipients
+ if ( $conf->exists('cust_bill-no_recipients-error') ) {
+ die 'No recipients for customer #'. $self->custnum;
+ } else {
+ #default: better to notify this person than silence
+ @invoicing_list = ($invoice_from);
+ }
+ }
my $subject = $self->email_subject($template);