diff options
author | Ivan Kohler <ivan@freeside.biz> | 2016-08-29 19:05:42 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2016-08-29 19:05:42 -0700 |
commit | c348008de567bbede345c2fa861c4d3694f8b1d3 (patch) | |
tree | 846fd9ae170fed6121b426be3a8c94cc219d5ed2 /FS | |
parent | 1d76bfaa881079e4c44109698277525082a95733 (diff) |
stop making spurious extra contacts
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/cust_main.pm | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 2af6a1f01..7bbed1bc2 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -598,17 +598,21 @@ sub insert { } } - my $contact = FS::contact->new({ - 'custnum' => $self->get('custnum'), - 'last' => $self->get('last'), - 'first' => $self->get('first'), - 'emailaddress' => $email, - 'invoice_dest' => 'Y', # yes, you can set this via the contact - }); - my $error = $contact->insert; - if ( $error ) { - $dbh->rollback if $oldAutoCommit; - return $error; + if ( $email ) { + + my $contact = FS::contact->new({ + 'custnum' => $self->get('custnum'), + 'last' => $self->get('last'), + 'first' => $self->get('first'), + 'emailaddress' => $email, + 'invoice_dest' => 'Y', # yes, you can set this via the contact + }); + my $error = $contact->insert; + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return $error; + } + } } |