X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2FClientAPI%2FSignup.pm;h=174883a003edab1b228f977b219a54558c60c1b5;hp=ebf56936381041ddb83c9cfec97e57e73b10b165;hb=6a89c38f9f9894e2f963b2dc08d587b83fd3350f;hpb=b0dcfb17045dca111b177084ecb857ae2ee6c670 diff --git a/FS/FS/ClientAPI/Signup.pm b/FS/FS/ClientAPI/Signup.pm index ebf569363..174883a00 100644 --- a/FS/FS/ClientAPI/Signup.pm +++ b/FS/FS/ClientAPI/Signup.pm @@ -24,6 +24,7 @@ use FS::queue; use FS::reg_code; use FS::payby; use FS::banned_pay; +use FS::part_tag; $DEBUG = 1; $me = '[FS::ClientAPI::Signup]'; @@ -476,7 +477,6 @@ sub domain_select_hash { sub new_customer { my $packet = shift; -warn Dumper($packet); my $conf = new FS::Conf; my $svc_x = $conf->config('signup_server-service') || 'svc_acct'; @@ -522,6 +522,28 @@ warn Dumper($packet); #shares some stuff with htdocs/edit/process/cust_main.cgi... take any # common that are still here and library them. + + my %cust_main = ( + 'agentnum' => $agentnum, + 'refnum' => $packet->{refnum} + || $conf->config('signup_server-default_refnum'), + 'tagnum' => [ FS::part_tag->default_tags ], + + ( map { $_ => $packet->{$_} } qw( + salesnum + ss stateid stateid_state + + payby + payinfo paycvv paydate payname paystate paytype + paystart_month paystart_year payissue + payip + + referral_custnum comments + ) + ), + + ); + my $template_custnum = $conf->config('signup_server-prepaid-template-custnum'); my $cust_main; if ( $template_custnum && $packet->{prepaid_shortform} ) { @@ -529,27 +551,10 @@ warn Dumper($packet); my $template_cust = qsearchs('cust_main', { 'custnum' => $template_custnum } ); return { 'error' => 'Configuration error' } unless $template_cust; $cust_main = new FS::cust_main ( { - 'agentnum' => $agentnum, - 'refnum' => $packet->{refnum} - || $conf->config('signup_server-default_refnum'), - - ( map { $_ => $template_cust->$_ } qw( - last first company daytime night fax mobile - ) - ), - - ( map { $_ => $packet->{$_} } qw( - ss stateid stateid_state - - payby - payinfo paycvv paydate payname paystate paytype - paystart_month paystart_year payissue - payip - - referral_custnum comments - ) + %cust_main, + map { $_ => $template_cust->$_ } qw( + last first company daytime night fax mobile ), - } ); $bill_hash = { $template_cust->bill_location->location_hash }; @@ -558,23 +563,11 @@ warn Dumper($packet); } else { $cust_main = new FS::cust_main ( { - #'custnum' => '', - 'agentnum' => $agentnum, - 'refnum' => $packet->{refnum} - || $conf->config('signup_server-default_refnum'), - + %cust_main, map { $_ => $packet->{$_} } qw( - last first ss company - daytime night fax mobile - stateid stateid_state - payby - payinfo paycvv paydate payname paystate paytype - paystart_month paystart_year payissue - payip + last first company daytime night fax mobile override_ban_warn - referral_custnum comments ), - } ); } @@ -632,7 +625,7 @@ warn Dumper($packet); ); } - $cust_main->payby('BILL') # MCRD better? + $cust_main->payby('BILL') # MCRD better? no, that's for something else if $gw && $gw->gateway_namespace eq 'Business::OnlineThirdPartyPayment'; } @@ -934,19 +927,30 @@ sub new_customer_minimal { # common that are still here and library them. my $cust_main = new FS::cust_main ( { - #'custnum' => '', - 'agentnum' => $agentnum, - 'refnum' => $packet->{refnum} - || $conf->config('signup_server-default_refnum'), - 'payby' => 'BILL', + 'agentnum' => $agentnum, + 'refnum' => $packet->{refnum} + || $conf->config('signup_server-default_refnum'), + 'tagnum' => [ FS::part_tag->default_tags ], + 'payby' => 'BILL', map { $_ => $packet->{$_} } qw( - last first ss company - daytime night fax mobile + salesnum + last first company daytime night fax mobile + ss ), } ); + if ( grep length($packet->{$_}), FS::cust_main->location_fields ) { + my $bill_hash; + foreach my $f (FS::cust_main->location_fields) { + $bill_hash->{$f} = $packet->{$f}; + } + my $bill_location = FS::cust_location->new($bill_hash); + $cust_main->set('bill_location' => $bill_location); + $cust_main->set('ship_location' => $bill_location); + } + my @invoicing_list = $packet->{'invoicing_list'} ? split( /\s*\,\s*/, $packet->{'invoicing_list'} ) : ();