summaryrefslogtreecommitdiff
path: root/fs_signup/FS-SignupClient
diff options
context:
space:
mode:
authorivan <ivan>2003-07-04 01:37:46 +0000
committerivan <ivan>2003-07-04 01:37:46 +0000
commitf2098c54512150c098f28f59ffe4a62464ef630e (patch)
treed852359c37b4f47df2b866a89bd5a8eaa3d2283c /fs_signup/FS-SignupClient
parentaf213c494294f73750b6b5b07ca828782ff3a9e4 (diff)
don't populate the whole initial list if there are tons of POPs
Diffstat (limited to 'fs_signup/FS-SignupClient')
-rwxr-xr-xfs_signup/FS-SignupClient/cgi/signup.cgi41
1 files changed, 24 insertions, 17 deletions
diff --git a/fs_signup/FS-SignupClient/cgi/signup.cgi b/fs_signup/FS-SignupClient/cgi/signup.cgi
index 09bdd43..b400685 100755
--- a/fs_signup/FS-SignupClient/cgi/signup.cgi
+++ b/fs_signup/FS-SignupClient/cgi/signup.cgi
@@ -1,9 +1,11 @@
#!/usr/bin/perl -Tw
#
-# $Id: signup.cgi,v 1.38 2003-07-04 00:51:29 ivan Exp $
+# $Id: signup.cgi,v 1.39 2003-07-04 01:37:46 ivan Exp $
use strict;
-use vars qw( @payby $cgi $locales $packages $pops $init_data $error
+use vars qw( @payby $cgi $locales $packages
+ $pops %pop %popnum2pop
+ $init_data $error
$last $first $ss $company $address1 $address2 $city $state $county
$country $zip $daytime $night $fax $invoicing_list $payby $payinfo
$paydate $payname $referral_custnum
@@ -137,6 +139,12 @@ if ( -e $decline_html ) {
( $locales, $packages, $pops, $init_data ) = signup_info();
@payby = @{$init_data->{'payby'}} if @{$init_data->{'payby'}};
$packages = $init_data->{agentnum2part_pkg}{$agentnum} if $agentnum;
+%pop = ();
+%popnum2pop = ();
+foreach (@$pops) {
+ push @{ $pop{ $_->{state} }->{ $_->{ac} } }, $_;
+ $popnum2pop{$_->{popnum}} = $_;
+}
$cgi = new CGI;
@@ -328,7 +336,7 @@ sub print_okay {
or die "fatal: invalid email_name got past FS::SignupClient::new_customer";
$email_name = $1; #global for template
- my $pop = pop_info($cgi->param('popnum'));
+ my $pop = $popnum2pop{$cgi->param('popnum')};
#or die "fatal: invalid popnum got past FS::SignupClient::new_customer";
if ( $pop ) {
( $ac, $exch, $loc ) = ( $pop->{'ac'}, $pop->{'exch'}, $pop->{'loc'} );
@@ -366,15 +374,6 @@ sub print_okay {
}
}
-sub pop_info {
- my $popnum = shift;
- my $pop;
- foreach $pop ( @{$pops} ) {
- if ( $pop->{'popnum'} == $popnum ) { return $pop; }
- }
- '';
-}
-
#horrible false laziness with FS/FS/svc_acct_pop.pm::popselector
sub popselector {
@@ -386,10 +385,12 @@ sub popselector {
'<INPUT TYPE="hidden" NAME="popnum" VALUE="'. $pops->[0]{popnum}. '">'
if scalar(@$pops) == 1;
- my %pop = ();
- foreach (@$pops) {
- push @{ $pop{ $_->{state} }->{ $_->{ac} } }, $_;
- }
+ #my %pop = ();
+ #my %popnum2pop = ();
+ #foreach (@$pops) {
+ # push @{ $pop{ $_->{state} }->{ $_->{ac} } }, $_;
+ # $popnum2pop{$_->{popnum}} = $_;
+ #}
my $text = <<END;
<SCRIPT>
@@ -460,8 +461,14 @@ END
$text .= qq!<TR><TD><SELECT NAME="popnum" SIZE=1 STYLE="width: 20em"><OPTION>City!;
+
#comment this block to disable initial list polulation
- foreach my $pop ( sort { $a->{state} cmp $b->{state} } @$pops ) {
+ if ( scalar( @$pops ) > 100 ) {
+ @initial_select = ( $popnum2pop{$popnum} );
+ } else {
+ @initial_select = $@pops;
+ }
+ foreach my $pop ( sort { $a->{state} cmp $b->{state} } @initial_select ) {
$text .= qq!<OPTION VALUE="!. $pop->{popnum}. '"'.
( ( $popnum && $pop->{popnum} == $popnum ) ? ' SELECTED' : '' ). ">".
$pop->{city}. ', '. $pop->{state}.