summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2011-01-19 19:12:26 +0000
committerivan <ivan>2011-01-19 19:12:26 +0000
commit9a88505be6e1f0cbd158cfdafce5786d7c65c9a5 (patch)
tree9b6f4b30716a39193a784c320942525c2e182774
parentaa45a5e16479da41a4fe93d3cd6c21d92fd19a28 (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 ae88629c7..f979b0532 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -4221,6 +4221,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 2a5082109..aef0b91df 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);