summaryrefslogtreecommitdiff
path: root/FS/FS/cust_main.pm
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2016-08-29 19:05:44 -0700
committerIvan Kohler <ivan@freeside.biz>2016-08-29 19:05:44 -0700
commitc85feb8ed34e07182695757322dfe132f6485045 (patch)
tree21bb35ce0c16bc6709b7b91d68d6b6b7c34b9074 /FS/FS/cust_main.pm
parent54d0218255a59a5133668e6ae06ccf264c58c758 (diff)
stop making spurious extra contacts
Diffstat (limited to 'FS/FS/cust_main.pm')
-rw-r--r--FS/FS/cust_main.pm26
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;
+ }
+
}
}