diff options
author | Ivan Kohler <ivan@freeside.biz> | 2016-08-29 19:05:44 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2016-08-29 19:05:44 -0700 |
commit | c85feb8ed34e07182695757322dfe132f6485045 (patch) | |
tree | 21bb35ce0c16bc6709b7b91d68d6b6b7c34b9074 /FS/FS/cust_main.pm | |
parent | 54d0218255a59a5133668e6ae06ccf264c58c758 (diff) |
stop making spurious extra contacts
Diffstat (limited to 'FS/FS/cust_main.pm')
-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 1253ac3..25b3d08 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -597,17 +597,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; + } + } } |