import rt 2.0.14
[freeside.git] / fs_signup / FS-SignupClient / cgi / signup-alternate.html
index 3535190..490cefa 100755 (executable)
@@ -33,14 +33,16 @@ Contact Information
 
   <%=
     foreach ( @{$locales} ) {
-      $OUT .= '<OPTION';
+      my $value = $_->{'state'};
+      $value .= ' ('. $_->{'county'}. ')' if $_->{'county'};
+      $value .= ' / '. $_->{'country'};
+
+      $OUT .= qq(<OPTION VALUE="$value");
       $OUT .= ' SELECTED' if ( $state eq $_->{'state'}
                                && $county eq $_->{'county'}
                                && $country eq $_->{'country'}
                              );
-      $OUT .= '>'. $_->{'state'};
-      $OUT .= ' ('. $_->{'county'}. ')' if $_->{'county'};
-      $OUT .= ' / '. $_->{'country'};
+      $OUT .= ">$value</OPTION>";
     }
   %>
 
@@ -62,63 +64,76 @@ Contact Information
 </TR>
 </TABLE><font color="#ff0000">*</font> required fields<BR>
 
-<BR><BR>First package
-
-  <%= use Tie::IxHash;
-      my %pkgpart2payby = map { $_->{pkgpart} => $_->{payby}[0] } @{$packages};
-      tie my %options, 'Tie::IxHash',
-        '' => '(none)',
-        map { $_->{pkgpart} => $_->{pkg} } @{$packages} 
-      ;
-
-      use HTML::Widgets::SelectLayers 0.02;
-      my $widget = new HTML::Widgets::SelectLayers(
-        options => \%options,
-        selected_layer => $pkgpart,
-        form_name => 'dummy',
-        form_action => $self_url,
-        form_text => [qw( magic ref ss agentnum
-                          last first company address1 address2
-                          city zip daytime night fax )],
-        form_select => [qw( state )], #county country
-        layer_callback => sub {
-          my $layer = shift;
-          my $html = <<ENDOUT;
-<INPUT TYPE="hidden" NAME="pkgpart" VALUE="$layer">
+<BR><BR>
 <TABLE BGCOLOR="#c0c0c0" BORDER=0 CELLSPACING=0>
 <TR>
   <TH ALIGN="right"><font color="#ff0000">*</font>Username</TH>
-  <TD><INPUT TYPE="text" NAME="username" VALUE="$username"></TD>
+  <TD><INPUT TYPE="text" NAME="username" VALUE="<%= $username %>"></TD>
 </TR>
 <TR>
   <TH ALIGN="right"><font color="#ff0000">*</font>Password</TH>
-  <TD><INPUT TYPE="password" NAME="_password" VALUE="$password"></TD>
+  <TD><INPUT TYPE="password" NAME="_password" VALUE="<%= $password %>"></TD>
 </TR>
 <TR>
   <TH ALIGN="right"><font color="#ff0000">*</font>Re-enter Password</TH>
-  <TD><INPUT TYPE="password" NAME="_password2" VALUE="$password2"></TD>
+  <TD><INPUT TYPE="password" NAME="_password2" VALUE="<%= $password2 %>"></TD>
 </TR>
-ENDOUT
-          if ( $init_data->{'security_phrase'} ) {
-            $html .= <<ENDOUT;
+
+<%= if ( $init_data->{'security_phrase'} ) {
+      <<ENDOUT;
 <TR>
   <TD ALIGN="right">Security Phrase</TD>
   <TD><INPUT TYPE="text" NAME="sec_phrase" VALUE="$sec_phrase">
   </TD>
 </TR>
 ENDOUT
-          } else {
-            $html .= '<INPUT TYPE="hidden" NAME="sec_phrase" VALUE="">';
-          }
+    } else {
+      '<INPUT TYPE="hidden" NAME="sec_phrase" VALUE="">';
+    }
+%>
 
-          if ( scalar(@$pops) ) {
-            $html .= '<TR><TD ALIGN="right">Access number</TD><TD>'.
-                     popselector($popnum). '</TD></TR>';
-          } else {
-            $html .= popselector($popnum);
-          }
+<%= if ( scalar(@$pops) ) {
+      '<TR><TD ALIGN="right">Access number</TD><TD>'.
+           popselector($popnum). '</TD></TR>';
+    } else {
+      popselector($popnum);
+    }
+%>
+
+</TABLE><font color="#ff0000">*</font> required fields
+
+<BR><BR>First package
+
+  <%= use Tie::IxHash;
+      my %pkgpart2payby = map { $_->{pkgpart} => $_->{payby}[0] } @{$packages};
+      tie my %options, 'Tie::IxHash',
+        '' => '(none)',
+        map { $_->{pkgpart} => $_->{pkg} }
+          sort { $a->{recur} <=> $b->{recur} }
+            @{$packages} 
+      ;
 
-          $html .= '</TABLE><font color="#ff0000">*</font> required fields';
+      use HTML::Widgets::SelectLayers 0.02;
+      my @form_text = qw( magic ref ss agentnum
+                          last first company address1 address2
+                          city zip daytime night fax
+                          username _password _password2 sec_phrase );
+      my @form_select = qw( state ); #county country
+      if ( scalar(@$pops) == 0 or scalar(@$pops) == 1 ) {
+        push @form_text, 'popnum',
+      } else {
+        push @form_select, 'popnum',
+      }
+      my $widget = new HTML::Widgets::SelectLayers(
+        options => \%options,
+        selected_layer => $pkgpart,
+        form_name => 'dummy',
+        form_action => $self_url,
+        form_text => \@form_text,
+        form_select => \@form_select,
+        layer_callback => sub {
+          my $layer = shift;
+          my $html = qq( <INPUT TYPE="hidden" NAME="pkgpart" VALUE="$layer">);
 
           if ( $pkgpart2payby{$layer} eq 'BILL' ) {
             $html .= <<ENDOUT;