only add first user to invoicing_list (ticket 1424)
authorjeff <jeff>
Tue, 30 Jan 2007 19:40:09 +0000 (19:40 +0000)
committerjeff <jeff>
Tue, 30 Jan 2007 19:40:09 +0000 (19:40 +0000)
FS/FS/Conf.pm
FS/FS/cust_main.pm
FS/FS/svc_acct.pm

index 3d1289d..156aed3 100644 (file)
@@ -559,6 +559,13 @@ httemplate/docs/config.html
   },
 
   {
+    'key'         => 'emailinvoiceautoalways',
+    'section'     => 'billing',
+    'description' => 'Automatically adds new accounts to the email invoice list even when the list contains email addresses',
+    'type'       => 'checkbox',
+  },
+
+  {
     'key'         => 'exclude_ip_addr',
     'section'     => '',
     'description' => 'Exclude these from the list of available broadband service IP addresses. (One per line)',
index a0ad0de..e1fe4c6 100644 (file)
@@ -2531,8 +2531,10 @@ sub realtime_bop {
     $payname =  "$payfirst $paylast";
   }
 
+  # invoicing_list_emailonly instead? push one?  which one?
   my @invoicing_list = grep { $_ ne 'POST' } $self->invoicing_list;
-  if ( $conf->exists('emailinvoiceauto')
+  if ( $conf->exists('emailinvoiceautoalways')
+       || $conf->exists('emailinvoiceauto') && ! @invoicing_list
        || ( $conf->exists('emailinvoiceonly') && ! @invoicing_list ) ) {
     push @invoicing_list, $self->all_emails;
   }
@@ -3017,8 +3019,10 @@ sub realtime_refund_bop {
     $payname =  "$payfirst $paylast";
   }
 
+  # invoicing_list_emailonly instead? push one?  which one?
   my @invoicing_list = grep { $_ ne 'POST' } $self->invoicing_list;
-  if ( $conf->exists('emailinvoiceauto')
+  if ( $conf->exists('emailinvoiceautoalways')
+       || $conf->exists('emailinvoiceauto') && ! @invoicing_list
        || ( $conf->exists('emailinvoiceonly') && ! @invoicing_list ) ) {
     push @invoicing_list, $self->all_emails;
   }
index ba95778..402d729 100644 (file)
@@ -453,7 +453,10 @@ sub insert {
   if ( $cust_pkg ) {
     my $cust_main = $cust_pkg->cust_main;
 
-    if ( $conf->exists('emailinvoiceauto') ) {
+    if (   $conf->exists('emailinvoiceautoalways')
+        || $conf->exists('emailinvoiceauto')
+        && $cust_main->invoicing_list_emailonly
+       ) {
       my @invoicing_list = $cust_main->invoicing_list;
       push @invoicing_list, $self->email;
       $cust_main->invoicing_list(\@invoicing_list);