summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
a0d7306)
overwriting existing invoice destinations
{
'key' => 'emailinvoiceauto',
'section' => 'billing',
{
'key' => 'emailinvoiceauto',
'section' => 'billing',
- 'description' => 'Automatically adds new accounts to the email invoice list upon customer creation',
+ 'description' => 'Automatically adds new accounts to the email invoice list',
my @invoicing_list = grep { $_ ne 'POST' } $cust_main->invoicing_list;
if ( $conf->exists('emailinvoiceauto')
|| ( $conf->exists('emailinvoiceonly') && ! @invoicing_list ) ) {
my @invoicing_list = grep { $_ ne 'POST' } $cust_main->invoicing_list;
if ( $conf->exists('emailinvoiceauto')
|| ( $conf->exists('emailinvoiceonly') && ! @invoicing_list ) ) {
- push @invoicing_list, $cust_main->default_invoicing_list;
+ push @invoicing_list, $cust_main->all_emails;
}
my $email = $invoicing_list[0];
}
my $email = $invoicing_list[0];
-$Id: cust_bill.pm,v 1.41.2.1 2002-09-10 03:31:08 ivan Exp $
+$Id: cust_bill.pm,v 1.41.2.2 2002-09-17 00:33:14 ivan Exp $
}
my %seen = map { $_->address => 1 } @cust_main_invoice;
foreach my $address ( @{$arrayref} ) {
}
my %seen = map { $_->address => 1 } @cust_main_invoice;
foreach my $address ( @{$arrayref} ) {
- #unless ( grep { $address eq $_->address } @cust_main_invoice ) {
next if exists $seen{$address} && $seen{$address};
$seen{$address} = 1;
my $cust_main_invoice = new FS::cust_main_invoice ( {
next if exists $seen{$address} && $seen{$address};
$seen{$address} = 1;
my $cust_main_invoice = new FS::cust_main_invoice ( {
-=item default_invoicing_list
+=item set_default_invoicing_list
-Sets the invoicing list to all accounts associated with this customer.
+Sets the invoicing list to all accounts associated with this customer,
+overwriting any previous invoicing list.
-sub default_invoicing_list {
+sub set_default_invoicing_list {
+ $self->invoicing_list($self->all_emails);
+}
+
+=item all_emails
+
+Returns the email addresses of all accounts provisioned for this customer.
+
+=cut
+
+sub all_emails {
+ 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;
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;
+ $list{$_}=1 foreach map { $_->email } @svc_acct;
- $self->invoicing_list(\@list);
}
=item invoicing_list_addpost
}
=item invoicing_list_addpost
return "queueing job (transaction rolled back): $error";
}
return "queueing job (transaction rolled back): $error";
}
my $cust_pkg = $self->cust_svc->cust_pkg;
my $cust_pkg = $self->cust_svc->cust_pkg;
- my( $cust_main, $to ) = ( '', '' );
+ my $cust_main = $cust_pkg->cust_main;
+
+ my $cust_pkg = $self->cust_svc->cust_pkg;
+
+ if ( $conf->exists('emailinvoiceauto') ) {
+ my @invoicing_list = $cust_main->invoicing_list;
+ push @invoicing_list, $self->email;
+ $cust_main->invoicing_list(@invoicing_list);
+ }
+
+ #welcome email
+ my $to = '';
if ( $welcome_template && $cust_pkg ) {
if ( $welcome_template && $cust_pkg ) {
- my $cust_main = $cust_pkg->cust_main;
my $to = join(', ', grep { $_ ne 'POST' } $cust_main->invoicing_list );
if ( $to ) {
my $wqueue = new FS::queue {
my $to = join(', ', grep { $_ ne 'POST' } $cust_main->invoicing_list );
if ( $to ) {
my $wqueue = new FS::queue {