X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=fs_selfservice%2FFS-SelfService%2Fcgi%2Fsignup.cgi;h=47857f0a7e4e6eec1ef50452b33d33307960a2ff;hb=b023b9a96799ee2ad11abc0c23fcaf33a8bf12ca;hp=d2ad0d64b65f7e5c0914fdc20f996731a8cdf9c5;hpb=673b9a458d9138523026963df6fa3b4683e09bae;p=freeside.git diff --git a/fs_selfservice/FS-SelfService/cgi/signup.cgi b/fs_selfservice/FS-SelfService/cgi/signup.cgi index d2ad0d64b..47857f0a7 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.2 2005-03-12 14:35:12 ivan Exp $ use strict; use vars qw( @payby $cgi $init_data @@ -67,7 +65,7 @@ if ( -e $signup_html ) { ) or die $Text::Template::ERROR; if ( $signup_txt =~ - /<\s*INPUT TYPE="?hidden"?\s+NAME="?agentnum"?\s+VALUE="?(\d+)"?\s*>/si + /<\s*INPUT TYPE="?hidden"?\s+NAME="?agentnum"?\s+VALUE="?(\d+)"?\s*\/?\s*>/si ) { $agentnum = $1; } @@ -151,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') @@ -159,6 +165,7 @@ if ( ( defined($cgi->param('magic')) && $cgi->param('magic') eq 'process' ) $cgi->param('invoicing_list' => 'POST' ); } + #if ( $svc_x eq 'svc_acct' ) { if ( $cgi->param('_password') ne $cgi->param('_password2') ) { $error = $init_data->{msgcat}{passwords_dont_match}; #msgcat $cgi->param('_password', ''); @@ -178,24 +185,32 @@ 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}; + } + + my $rv = ''; 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 + $rv = new_customer( { + ( 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 refnum agentnum + username sec_phrase _password popnum + countrycode phonenum sip_password pin + ), + grep { /^snarf_/ } $cgi->param + ), + 'payip' => $cgi->remote_host(), } ); $error = $rv->{'error'}; } @@ -211,6 +226,7 @@ if ( ( defined($cgi->param('magic')) && $cgi->param('magic') eq 'process' ) } else { print_okay( 'pkgpart' => scalar($cgi->param('pkgpart')), + %$rv, ); } @@ -229,6 +245,8 @@ sub print_form { 'error' => $error, }; + $r->{pkgpart} ||= $r->{default_pkgpart}; + $r->{referral_custnum} = $r->{'ref'}; #$cgi->delete('ref'); #$cgi->delete('init_popstate'); @@ -249,12 +267,30 @@ sub print_okay { my %param = @_; my $user_agent = new HTTP::BrowserDetect $ENV{HTTP_USER_AGENT}; - $cgi->param('username') =~ /^(.+)$/ - or die "fatal: invalid username got past FS::SelfService::new_customer"; - my $username = $1; - $cgi->param('_password') =~ /^(.+)$/ - or die "fatal: invalid password got past FS::SelfService::new_customer"; - my $password = $1; + my( $username, $password ) = ( '', '' ); + my( $countrycode, $phonenum, $sip_password, $pin ) = ( '', '', '', '' ); + + my $svc_x = $param{signup_service} || 'svc_acct'; #just in case + if ( $svc_x eq 'svc_acct' ) { + + $cgi->param('username') =~ /^(.+)$/ + or die "fatal: invalid username got past FS::SelfService::new_customer"; + $username = $1; + $cgi->param('_password') =~ /^(.+)$/ + or die "fatal: invalid password got past FS::SelfService::new_customer"; + $password = $1; + + } elsif ( $svc_x eq 'svc_phone' ) { + + $countrycode = $param{countrycode}; + $phonenum = $param{phonenum}; + $sip_password = $param{sip_password}; + $pin = $param{pin}; + + } else { + die "unknown signup service $svc_x"; + } + ( $cgi->param('first'). ' '. $cgi->param('last') ) =~ /^(.*)$/ or die "fatal: invalid email_name got past FS::SelfService::new_customer"; my $email_name = $1; #global for template @@ -276,27 +312,45 @@ 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 print $cgi->header('application/x-Internet-signup'), $ieak_template->fill_in(); + } else { #send a simple confirmation + print $cgi->header( '-expires' => 'now' ), $success_template->fill_in( HASH => { - username => $username, - password => $password, - _password => $password, - email_name => $email_name, - ac => $ac, - exch => $exch, - loc => $loc, - pkg => $pkg, + + email_name => $email_name, + pkg => $pkg, + part_pkg => \$part_pkg, + + signup_service => $svc_x, + + #for svc_acct + username => $username, + password => $password, + _password => $password, + ac => $ac, #for dialup POP + exch => $exch, # + loc => $loc, # + + #for svc_phone + countrycode => $countrycode, + phonenum => $phonenum, + sip_password => $sip_password, + pin => $pin, + }); } + } sub success_default { #html to use if you don't specify a success file @@ -329,5 +383,5 @@ END package FS::SelfService::_signupcgi; use HTML::Entities; -use FS::SelfService qw(regionselector expselect popselector); +use FS::SelfService qw(regionselector expselect popselector didselector);