add (unfinished) credit card surcharge, part 1
[freeside.git] / FS / FS / cust_bill.pm
index 6581578..62ab87f 100644 (file)
@@ -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);
 
@@ -1952,7 +1958,8 @@ sub realtime_lec {
 }
 
 sub realtime_bop {
-  my( $self, $method ) = @_;
+  my( $self, $method ) = (shift,shift);
+  my %opt = @_;
 
   my $cust_main = $self->cust_main;
   my $balance = $cust_main->balance;
@@ -1981,6 +1988,7 @@ sub realtime_bop {
 #this didn't do what we want, it just calls apply_payments_and_credits
 #    'apply'       => 1,
     'apply_to_invoice' => 1,
+    %opt,
  #what we want:
  #this changes application behavior: auto payments
                         #triggered against a specific invoice are now applied