X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=fs_selfservice%2FFS-SelfService%2Fcgi%2Fsignup.cgi;h=e07b6ee5ae4b119807e7c2b4ab8a2a1c50ed12b0;hb=9509e5bfb7f9331303153cac24d7bfecbe2ea9f1;hp=afae1f16781de520c800c7c85ed13138c2a7c466;hpb=b5fbaadb1cb2893660e460a1d4a3cabe02774de7;p=freeside.git diff --git a/fs_selfservice/FS-SelfService/cgi/signup.cgi b/fs_selfservice/FS-SelfService/cgi/signup.cgi index afae1f167..e07b6ee5a 100755 --- a/fs_selfservice/FS-SelfService/cgi/signup.cgi +++ b/fs_selfservice/FS-SelfService/cgi/signup.cgi @@ -1,7 +1,5 @@ #!/usr/bin/perl -T #!/usr/bin/perl -Tw -# -# $Id: signup.cgi,v 1.1 2005-03-12 14:31:50 ivan Exp $ use strict; use vars qw( @payby $cgi $init_data @@ -12,24 +10,7 @@ use vars qw( @payby $cgi $init_data $success_html $success_template $decline_html $decline_template ); - #$locales $packages - #$pops %pop %popnum2pop - - #$last $first $ss $company $address1 - #$address2 $city $state $county - #$country $zip $daytime $night $fax - - #$ship_last $ship_first $ship_ss $ship_company $ship_address1 - #$ship_address2 $ship_city $ship_state $ship_county - #$ship_country $ship_zip $ship_daytime $ship_night $ship_fax - #$invoicing_list $payby $payinfo - #$paycvv $paydate $payname $referral_custnum $init_popstate - #$pkgpart $username $_password $_password2 $sec_phrase $popnum - #$refnum - - #$ac $exch $loc - #$email_name $pkg use subs qw( print_form print_okay print_decline success_default decline_default ); @@ -140,49 +121,11 @@ $init_data = signup_info( 'agentnum' => $agentnum, 'promo_code' => scalar($cgi->param('promo_code')), 'reg_code' => uc(scalar($cgi->param('reg_code'))), ); -#$error = $init_data->{'error'}; -#$locales = $init_data->{'cust_main_county'}; -#$packages = $init_data->{'part_pkg'}; -#$pops = $init_data->{'svc_acct_pop'}; -#@payby = @{$init_data->{'payby'}} if @{$init_data->{'payby'}}; -#$packages = $init_data->{agentnum2part_pkg}{$agentnum} if $agentnum; if ( ( defined($cgi->param('magic')) && $cgi->param('magic') eq 'process' ) || ( defined($cgi->param('action')) && $cgi->param('action') eq 'process_signup' ) ) { -# if ( $cgi->param('state') =~ /^(\w*)( \(([\w ]+)\))? ?\/ ?(\w+)$/ ) { -# $state = $1; -# $county = $3 || ''; -# $country = $4; -# } elsif ( $cgi->param('state') =~ /^(\w*)$/ ) { -# $state = $1; -# $cgi->param('county') =~ /^([\w ]*)$/ -# or die "illegal county: ". $cgi->param('county'); -# $county = $1; -# $cgi->param('country') =~ /^(\w+)$/ -# or die "illegal country: ". $cgi->param('country'); -# $country = $1; -# } else { -# die "illegal state: ". $cgi->param('state'); -# } -# if ( $cgi->param('ship_state') =~ /^(\w*)( \(([\w ]+)\))? ?\/ ?(\w+)$/ ) { -# $ship_state = $1; -# $ship_county = $3 || ''; -# $ship_country = $4; -# } elsif ( $cgi->param('ship_state') =~ /^(\w*)$/ ) { -# $ship_state = $1; -# $cgi->param('ship_county') =~ /^([\w ]*)$/ -# or die "illegal county: ". $cgi->param('ship_county'); -# $ship_county = $1; -# #$cgi->param('ship_country') =~ /^(\w+)$/ -# $cgi->param('ship_country') =~ /^(\w*)$/ -# or die "illegal ship_country: ". $cgi->param('ship_country'); -# $ship_country = $1; -# #} else { -# # die "illegal ship_state: ". $cgi->param('ship_state'); -# } - $error = ''; $cgi->param('agentnum', $agentnum) if $agentnum; @@ -206,6 +149,14 @@ if ( ( defined($cgi->param('magic')) && $cgi->param('magic') eq 'process' ) ? $cgi->param( $payby. '_paycvv' ) : '' ); + $cgi->param('paytype' => defined $cgi->param( $payby. '_paytype' ) + ? $cgi->param( $payby. '_paytype' ) + : '' + ); + $cgi->param('paystate' => defined $cgi->param( $payby. '_paystate' ) + ? $cgi->param( $payby. '_paystate' ) + : '' + ); if ( $cgi->param('invoicing_list') ) { $cgi->param('invoicing_list' => $cgi->param('invoicing_list'). ', POST') @@ -233,24 +184,30 @@ if ( ( defined($cgi->param('magic')) && $cgi->param('magic') eq 'process' ) or $error ||= $init_data->{msgcat}{not_a}. $cgi->param('CARD_type'); } + if ($init_data->{emailinvoiceonly} && (length $cgi->param('invoicing_list') < 1)) { + $error ||= $init_data->{msgcat}{illegal_or_empty_text}; + } + unless ( $error ) { my $rv = new_customer( { - map { $_ => scalar($cgi->param($_)) } - qw( last first ss company - address1 address2 city county state zip country - daytime night fax - - ship_last ship_first ship_company - ship_address1 ship_address2 ship_city ship_county ship_state - ship_zip ship_country - ship_daytime ship_night ship_fax - - payby payinfo paycvv paydate payname invoicing_list - referral_custnum promo_code reg_code - pkgpart username sec_phrase _password popnum refnum - agentnum - ), - grep { /^snarf_/ } $cgi->param + ( map { $_ => scalar($cgi->param($_)) } + qw( last first ss company + address1 address2 city county state zip country + daytime night fax stateid stateid_state + + ship_last ship_first ship_company + ship_address1 ship_address2 ship_city ship_county ship_state + ship_zip ship_country + ship_daytime ship_night ship_fax + + payby payinfo paycvv paydate payname paystate paytype + invoicing_list referral_custnum promo_code reg_code + pkgpart username sec_phrase _password popnum refnum + agentnum + ), + grep { /^snarf_/ } $cgi->param + ), + 'payip' => $cgi->remote_host(), } ); $error = $rv->{'error'}; } @@ -271,47 +228,6 @@ if ( ( defined($cgi->param('magic')) && $cgi->param('magic') eq 'process' ) } else { $error = ''; -# $last = ''; -# $first = ''; -# $ss = ''; -# $company = ''; -# $address1 = ''; -# $address2 = ''; -# $city = ''; -# $state = $init_data->{statedefault}; -# $county = ''; -# $country = $init_data->{countrydefault}; -# $zip = ''; -# $daytime = ''; -# $night = ''; -# $fax = ''; -# $ship_last = ''; -# $ship_first = ''; -# $ship_company = ''; -# $ship_address1 = ''; -# $ship_address2 = ''; -# $ship_city = ''; -# $ship_state = $init_data->{statedefault}; -# $ship_county = ''; -# $ship_country = $init_data->{countrydefault}; -# $ship_zip = ''; -# $ship_daytime = ''; -# $ship_night = ''; -# $ship_fax = ''; -# $invoicing_list = ''; -# $payby = ''; -# $payinfo = ''; -# $paydate = ''; -# $payname = ''; -# $pkgpart = ''; -# $username = ''; -# $_password = ''; -# $_password2 = ''; -# $sec_phrase = ''; -# $popnum = ''; -# $referral_custnum = $cgi->param('ref') || ''; -# $init_popstate = $cgi->param('init_popstate') || ''; -# $refnum = $init_data->{'refnum'}; print_form; } @@ -325,6 +241,8 @@ sub print_form { 'error' => $error, }; + $r->{pkgpart} ||= $r->{default_pkgpart}; + $r->{referral_custnum} = $r->{'ref'}; #$cgi->delete('ref'); #$cgi->delete('init_popstate'); @@ -372,9 +290,10 @@ sub print_okay { } #global for template - my $pkg = ( grep { $_->{'pkgpart'} eq $param{'pkgpart'} } - @{ $init_data->{'part_pkg'} } - )[0]->{'pkg'}; + my $part_pkg = ( grep { $_->{'pkgpart'} eq $param{'pkgpart'} } + @{ $init_data->{'part_pkg'} } + )[0]; + my $pkg = $part_pkg->{'pkg'}; if ( $ieak_template && $user_agent->windows && $user_agent->ie ) { #send an IEAK config @@ -391,6 +310,7 @@ sub print_okay { exch => $exch, loc => $loc, pkg => $pkg, + part_pkg => \$part_pkg, }); } }