From: Ivan Kohler Date: Wed, 22 Apr 2015 21:33:22 +0000 (-0700) Subject: fix contact addition in v3 new_customer_minimal, RT#34084 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=4e3d17eefa30165031b551ddaed03007a7579ceb fix contact addition in v3 new_customer_minimal, RT#34084 --- diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 7c26d8960..6aaeac64b 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -541,6 +541,33 @@ sub insert { } + warn " setting contacts\n" + if $DEBUG > 1; + + if ( my $contact = delete $options{'contact'} ) { + + foreach my $c ( @$contact ) { + $c->custnum($self->custnum); + my $error = $c->insert; + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return $error; + } + + } + + } elsif ( my $contact_params = delete $options{'contact_params'} ) { + + my $error = $self->process_o2m( 'table' => 'contact', + 'fields' => FS::contact->cgi_contact_fields, + 'params' => $contact_params, + ); + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return $error; + } + } + warn " setting cust_main_exemption\n" if $DEBUG > 1;