add emailinvoiceonly config file and begin to use it
authorivan <ivan>
Tue, 25 Sep 2001 18:01:19 +0000 (18:01 +0000)
committerivan <ivan>
Tue, 25 Sep 2001 18:01:19 +0000 (18:01 +0000)
FS/FS/cust_main.pm
httemplate/docs/config.html

index d66d08c..2d94bbe 100644 (file)
@@ -1151,6 +1151,13 @@ sub collect {
             $payname =  "$payfirst $paylast";
           }
 
+          my @invoicing_list = grep { $_ ne 'POST' } $self->invoicing_list;
+          if ( $conf->config('emailinvoiceonly') ) {
+            @invoicing_list = $self->default_invoicing_list
+              unless @invoicing_list;
+          }
+          my $email = $invoicing_list[0];
+
           my( $action1, $action2 ) = split(/\s*\,\s*/, $bop_action );
         
           my $transaction =
@@ -1175,6 +1182,7 @@ sub collect {
             'card_number'    => $self->payinfo,
             'expiration'     => $exp,
             'referer'        => 'http://cleanwhisker.420.am/',
+            'email'          => $email,
           );
           $transaction->submit();
 
@@ -1529,6 +1537,24 @@ sub check_invoicing_list {
   '';
 }
 
+=item default_invoicing_list
+
+=cut
+
+sub default_invoicing_list {
+  my $self = shift;
+  my @list = ();
+  foreach my $cust_pkg ( $self->all_pkgs ) {
+    my @cust_svc = qsearch('cust_svc', { 'pkgnum' => $cust_pkg->pkgnum } );
+    my @svc_acct =
+      map { qsearchs('svc_acct', { 'svcnum' => $_->svcnum } ) }
+        grep { qsearchs('svc_acct', { 'svcnum' => $_->svcnum } ) }
+          @cust_svc;
+    push @list, map { $_->email } @svc_acct;
+  }
+  $self->invoicing_list(\@list);
+}
+
 =item referral_cust_main [ DEPTH [ EXCLUDE_HASHREF ] ]
 
 Returns an array of customers referred by this customer (referral_custnum set
@@ -1698,7 +1724,7 @@ sub append_fuzzyfiles {
 
 =head1 VERSION
 
-$Id: cust_main.pm,v 1.35 2001-09-25 15:55:48 ivan Exp $
+$Id: cust_main.pm,v 1.36 2001-09-25 18:01:19 ivan Exp $
 
 =head1 BUGS
 
index 0e085b0..2254b32 100644 (file)
@@ -53,6 +53,7 @@ All further configuration files and directories are located in
   <li><a name="disable_customer_referrals">disable_customer_referrals</a> - The existance of this file will disable new customer-to-customer referrals in the web interface.
   <li><a name="domain"><font color="#ff0000">domain</font></a> - Your domain name.
   <li><a name="editreferrals">editreferrals</a> - The existance of this file will allow you to change the referral of existing customers.
+  <li><a name="emailinvoiceonly">emailinvoiceonly</a>
   <li><a name="erpcdmachines">erpcdmachines</a> - Your ERPCD authenticaion machines, one per line.  This enables export of `/usr/annex/acp_passwd' and `/usr/annex/acp_dialup'.
   <li><a name="hidecancelledpackages">hidecancelledpackages</a> - The existance of this file will prevent cancelled packages from showing up in listings (though they will still be in the database)
   <li><a name="hidecancelledcustomers">hidecancelledcustomers</a> - The existance of this file will prevent customers with only cancelled packages from showing up in listings (though they will still be in the database)