X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FClientAPI%2FSignup.pm;h=375958b9cb4f9b8409468bf2ad6ecaaa96337d02;hb=23c97b258b9b60d558af333166940f11c229f71c;hp=36045d9e240802fc91ac52d00e7de01f66aaf2ae;hpb=b3a9e3fb3497230b2c752fb888f1234cde90c785;p=freeside.git diff --git a/FS/FS/ClientAPI/Signup.pm b/FS/FS/ClientAPI/Signup.pm index 36045d9e2..375958b9c 100644 --- a/FS/FS/ClientAPI/Signup.pm +++ b/FS/FS/ClientAPI/Signup.pm @@ -3,13 +3,15 @@ package FS::ClientAPI::Signup; use strict; use Tie::RefHash; use FS::Conf; -use FS::Record qw(qsearch qsearchs); +use FS::Record qw(qsearch qsearchs dbdef); use FS::agent; use FS::cust_main_county; use FS::part_pkg; use FS::svc_acct_pop; use FS::cust_main; use FS::cust_pkg; +use FS::svc_acct; +use FS::acct_snarf; use FS::Msgcat qw(gettext); use FS::ClientAPI; #hmm @@ -29,6 +31,25 @@ sub signup_info { 'cust_main_county' => [ map { $_->hashref } qsearch('cust_main_county', {}) ], + 'agent' => + [ + map { $_->hashref } + qsearch('agent', dbdef->table('agent')->column('disabled') + ? { 'disabled' => '' } + : {} + ) + ], + + 'part_referral' => + [ + map { $_->hashref } + qsearch('part_referral', + dbdef->table('part_referral')->column('disabled') + ? { 'disabled' => '' } + : {} + ) + ], + 'agentnum2part_pkg' => { map { @@ -39,7 +60,10 @@ sub signup_info { grep { $_->svcpart('svc_acct') && $href->{ $_->pkgpart } } qsearch( 'part_pkg', { 'disabled' => '' } ) ]; - } qsearch('agent', {} ) + } qsearch('agent', dbdef->table('agent')->column('disabled') + ? { 'disabled' => '' } + : {} + ) }, 'svc_acct_pop' => [ map { $_->hashref } qsearch('svc_acct_pop',{} ) ], @@ -48,6 +72,8 @@ sub signup_info { 'payby' => [ $conf->config('signup_server-payby') ], + 'cvv_enabled' => defined dbdef->table('cust_main')->column('paycvv'), + 'msgcat' => { map { $_=>gettext($_) } qw( passwords_dont_match invalid_card unknown_card_type not_a ) }, @@ -56,6 +82,8 @@ sub signup_info { 'countrydefault' => $conf->config('countrydefault') || 'US', + 'refnum' => $conf->config('signup_server-default_refnum'), + }; if ( @@ -104,7 +132,8 @@ sub new_customer { map { $_ => $packet->{$_} } qw( last first ss company address1 address2 city county state zip country - daytime night fax payby payinfo paydate payname referral_custnum comments + daytime night fax payby payinfo paycvv paydate payname referral_custnum + comments ), } ); @@ -140,6 +169,20 @@ sub new_customer { qw( username _password sec_phrase popnum ), } ); + my @acct_snarf; + my $snarfnum = 1; + while ( length($packet->{"snarf_machine$snarfnum"}) ) { + my $acct_snarf = new FS::acct_snarf ( { + 'machine' => $packet->{"snarf_machine$snarfnum"}, + 'protocol' => $packet->{"snarf_protocol$snarfnum"}, + 'username' => $packet->{"snarf_username$snarfnum"}, + '_password' => $packet->{"snarf_password$snarfnum"}, + } ); + $snarfnum++; + push @acct_snarf, $acct_snarf; + } + $svc_acct->child_objects( \@acct_snarf ); + my $y = $svc_acct->setdefault; # arguably should be in new method return { 'error' => $y } if $y && !ref($y);