stray closing /TABLE in the no-ticket case
[freeside.git] / FS / FS / svc_acct_pop.pm
index fa4f5c6..de41f5b 100644 (file)
@@ -93,6 +93,7 @@ sub check {
       or $self->ut_number('ac')
       or $self->ut_number('exch')
       or $self->ut_numbern('loc')
+      or $self->SUPER::check
   ;
 
 }
@@ -121,6 +122,8 @@ sub text {
 
 =cut
 
+#horrible false laziness with signup.cgi (pull special-case for 0 & 1
+# pop code out from signup.cgi??)
 sub popselector {
   my( $popnum, $state ) = @_;
 
@@ -140,8 +143,7 @@ sub popselector {
     
     function popstate_changed(what) {
       state = what.options[what.selectedIndex].text;
-      for (var i = what.form.popnum.length;i > 0;i--)
-                what.form.popnum.options[i] = null;
+      what.form.popnum.options.length = 0
       what.form.popnum.options[0] = new Option("", "", false, true);
 END
 
@@ -165,7 +167,13 @@ END
   $text .= '</SELECT>'; #callback? return 3 html pieces?  #'</TD><TD>';
 
   $text .= qq!<SELECT NAME="popnum" SIZE=1><OPTION> !;
-  foreach my $pop ( @svc_acct_pop ) {
+  my @initial_select;
+  if ( scalar(@svc_acct_pop) > 100 ) {
+    @initial_select = qsearchs( 'svc_acct_pop', { 'popnum' => $popnum } );
+  } else {
+    @initial_select = @svc_acct_pop;
+  }
+  foreach my $pop ( @initial_select ) {
     $text .= qq!<OPTION VALUE="!. $pop->popnum. '"'.
              ( ( $popnum && $pop->popnum == $popnum ) ? ' SELECTED' : '' ). ">".
              $pop->text;
@@ -178,16 +186,14 @@ END
 
 =back
 
-=head1 VERSION
-
-$Id: svc_acct_pop.pm,v 1.6 2001-12-18 06:29:30 ivan Exp $
-
 =head1 BUGS
 
 It should be renamed to part_pop.
 
 popselector?  putting web ui components in here?  they should probably live
-somewhere else...
+somewhere else...  
+
+popselector: pull special-case for 0 & 1 pop code out from signup.cgi
 
 =head1 SEE ALSO