X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=fs_signup%2FFS-SignupClient%2Fcgi%2Fsignup.cgi;h=4f9efff987dcec732f989a2b0d1acf6b5b09254d;hp=0a9a510088d0c3cbe5f8b8593f180ac3e63a5d4d;hb=c6a602884ff9823a1b673de8f7d7d8c045377f52;hpb=c57a4fc790d9ba9eaec58021ef9ee56b8649b6f1 diff --git a/fs_signup/FS-SignupClient/cgi/signup.cgi b/fs_signup/FS-SignupClient/cgi/signup.cgi index 0a9a51008..4f9efff98 100755 --- a/fs_signup/FS-SignupClient/cgi/signup.cgi +++ b/fs_signup/FS-SignupClient/cgi/signup.cgi @@ -1,6 +1,7 @@ +#!/usr/bin/perl -T #!/usr/bin/perl -Tw # -# $Id: signup.cgi,v 1.50 2004-01-04 03:52:54 ivan Exp $ +# $Id: signup.cgi,v 1.52 2004-10-01 01:38:02 ivan Exp $ use strict; use vars qw( @payby $cgi $locales $packages @@ -20,14 +21,14 @@ use vars qw( @payby $cgi $locales $packages $self_url ); use subs qw( print_form print_okay print_decline - success_default decline_default - expselect ); + success_default decline_default ); use CGI; #use CGI::Carp qw(fatalsToBrowser); use Text::Template; use Business::CreditCard; use HTTP::BrowserDetect; -use FS::SignupClient 0.03 qw( signup_info new_customer ); +use FS::SignupClient 0.03 qw( signup_info new_customer + regionselector expselect popselector); #acceptable payment methods # @@ -360,265 +361,6 @@ sub print_okay { } } -#horrible false laziness with FS/FS/svc_acct_pop.pm::popselector -sub popselector { - - my( $popnum ) = @_; - - return '' unless @$pops; - return $pops->[0]{city}. ', '. $pops->[0]{state}. - ' ('. $pops->[0]{ac}. ')/'. $pops->[0]{exch}. '-'. $pops->[0]{loc}. - '' - if scalar(@$pops) == 1; - - #my %pop = (); - #my %popnum2pop = (); - #foreach (@$pops) { - # push @{ $pop{ $_->{state} }->{ $_->{ac} } }, $_; - # $popnum2pop{$_->{popnum}} = $_; - #} - - my $text = < - function opt(what,href,text) { - var optionName = new Option(text, href, false, false) - var length = what.length; - what.options[length] = optionName; - } -END - - if ( $init_popstate ) { - $text .= ''; - } else { - $text .= <param('popac')) { - $text .= "what.form.popac.options[what.form.popac.length-1].selected = true;\n"; - } - } - $text .= "}\n" unless $init_popstate; - } - $text .= "popac_changed(what.form.popac)}\n"; - - $text .= <{$popac}}) { - my $o_popnum = $pop->{popnum}; - my $poptext = $pop->{city}. ', '. $pop->{state}. - ' ('. $pop->{ac}. ')/'. $pop->{exch}. '-'. $pop->{loc}; - - $text .= "opt(what.form.popnum, \"$o_popnum\", \"$poptext\");\n"; - if ($popnum == $o_popnum) { - $text .= "what.form.popnum.options[what.form.popnum.length-1].selected = true;\n"; - } - } - $text .= "}\n"; - } - } - - - $text .= "}\n\n"; - - $text .= - qq!'; - - $text .= - qq!!; - - $text .= qq!
'; #callback? return 3 html pieces? #'
!; - - $text; - -} - -sub expselect { - my $prefix = shift; - my $date = shift || ''; - my( $m, $y ) = ( 0, 0 ); - if ( $date =~ /^(\d{4})-(\d{2})-\d{2}$/ ) { #PostgreSQL date format - ( $m, $y ) = ( $2, $1 ); - } elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) { - ( $m, $y ) = ( $1, $3 ); - } - my $return = qq!!; - for ( 2001 .. 2037 ) { - $return .= "county; - $countyflag=1 if $c->{county}; - #push @{$cust_main_county{$c->country}{$c->state}}, $c->county; - #$cust_main_county{$c->country}{$c->state}{$c->county} = 1; - $cust_main_county{$c->{country}}{$c->{state}}{$c->{county}} = 1; - } -# } - $countyflag=1 if $selected_county; - - my $script_html = < - function opt(what,value,text) { - var optionName = new Option(text, value, false, false); - var length = what.length; - what.options[length] = optionName; - } - function ${prefix}country_changed(what) { - country = what.options[what.selectedIndex].text; - for ( var i = what.form.${prefix}state.length; i >= 0; i-- ) - what.form.${prefix}state.options[i] = null; -END - #what.form.${prefix}state.options[0] = new Option('', '', false, true); - - foreach my $country ( sort keys %cust_main_county ) { - $script_html .= "\nif ( country == \"$country\" ) {\n"; - foreach my $state ( sort keys %{$cust_main_county{$country}} ) { - my $text = $state || '(n/a)'; - $script_html .= qq!opt(what.form.${prefix}state, "$state", "$text");\n!; - } - $script_html .= "}\n"; - } - - $script_html .= <= 0; i-- ) - what.form.${prefix}county.options[i] = null; -END - - foreach my $country ( sort keys %cust_main_county ) { - $script_html .= "\nif ( country == \"$country\" ) {\n"; - foreach my $state ( sort keys %{$cust_main_county{$country}} ) { - $script_html .= "\nif ( state == \"$state\" ) {\n"; - #foreach my $county ( sort @{$cust_main_county{$country}{$state}} ) { - foreach my $county ( sort keys %{$cust_main_county{$country}{$state}} ) { - my $text = $county || '(n/a)'; - $script_html .= - qq!opt(what.form.${prefix}county, "$county", "$text");\n!; - } - $script_html .= "}\n"; - } - $script_html .= "}\n"; - } - } - - $script_html .= < -END - - my $county_html = $script_html; - if ( $countyflag ) { - $county_html .= qq!'; - } else { - $county_html .= - qq!!; - } - - my $state_html = qq!'; - - $state_html .= ''; - - my $country_html = qq!'; - - ($county_html, $state_html, $country_html); - -} - sub success_default { #html to use if you don't specify a success file <<'END'; Signup successful