signup server: FS::part_pkg->payby kludge & example template which uses
[freeside.git] / fs_signup / FS-SignupClient / cgi / signup-alternate.html
diff --git a/fs_signup/FS-SignupClient/cgi/signup-alternate.html b/fs_signup/FS-SignupClient/cgi/signup-alternate.html
new file mode 100755 (executable)
index 0000000..668f124
--- /dev/null
@@ -0,0 +1,202 @@
+<HTML><HEAD><TITLE>ISP Signup form</TITLE></HEAD>
+<BODY BGCOLOR="#e8e8e8"><FONT SIZE=7>ISP Signup form</FONT><BR><BR>
+<FONT SIZE="+1" COLOR="#ff0000"><%= $error %></FONT>
+<FORM NAME="dummy">
+<INPUT TYPE="hidden" NAME="magic" VALUE="process">
+<INPUT TYPE="hidden" NAME="ref" VALUE="<%= $referral_custnum %>">
+<INPUT TYPE="hidden" NAME="ss" VALUE="">
+<INPUT TYPE="hidden" NAME="agentnum" VALUE="3">
+Contact Information
+<TABLE BGCOLOR="#c0c0c0" BORDER=0 CELLSPACING=0 WIDTH="100%">
+<TR>
+  <TH ALIGN="right"><font color="#ff0000">*</font>Contact name<BR>(last, first)</TH>
+  <TD COLSPAN=5><INPUT TYPE="text" NAME="last" VALUE="<%= $last %>">,
+                <INPUT TYPE="text" NAME="first" VALUE="<%= $first %>"></TD>
+</TR>
+<TR>
+  <TD ALIGN="right">Company</TD>
+  <TD COLSPAN=5><INPUT TYPE="text" NAME="company" SIZE=70 VALUE="<%= $company %>"></TD>
+</TR>
+<TR>
+  <TH ALIGN="right"><font color="#ff0000">*</font>Address</TH>
+  <TD COLSPAN=5><INPUT TYPE="text" NAME="address1" SIZE=70 VALUE="<%= $address1 %>"></TD>
+</TR>
+<TR>
+  <TD ALIGN="right">&nbsp;</TD>
+  <TD COLSPAN=5><INPUT TYPE="text" NAME="address2" SIZE=70 VALUE="<%= $address2 %>"></TD>
+</TR>
+<TR>
+  <TH ALIGN="right"><font color="#ff0000">*</font>City</TH>
+  <TD><INPUT TYPE="text" NAME="city" VALUE="<%= $city %>"></TD>
+  <TH ALIGN="right"><font color="#ff0000">*</font>State/Country</TH>
+  <TD><SELECT NAME="state" SIZE="1">
+
+  <%=
+    foreach ( @{$locales} ) {
+      $OUT .= '<OPTION';
+      $OUT .= ' SELECTED' if ( $state eq $_->{'state'}
+                               && $county eq $_->{'county'}
+                               && $country eq $_->{'country'}
+                             );
+      $OUT .= '>'. $_->{'state'};
+      $OUT .= ' ('. $_->{'county'}. ')' if $_->{'county'};
+      $OUT .= ' / '. $_->{'country'};
+    }
+  %>
+
+  </SELECT></TD>
+  <TH><font color="#ff0000">*</font>Zip</TH>
+  <TD><INPUT TYPE="text" NAME="zip" SIZE=10 VALUE="<%= $zip %>"></TD>
+</TR>
+<TR>
+  <TD ALIGN="right">Day Phone</TD>
+  <TD COLSPAN=5><INPUT TYPE="text" NAME="daytime" VALUE="<%= $daytime %>" SIZE=18></TD>
+</TR>
+<TR>
+  <TD ALIGN="right">Night Phone</TD>
+  <TD COLSPAN=5><INPUT TYPE="text" NAME="night" VALUE="<%= $night %>" SIZE=18></TD>
+</TR>
+<TR>
+  <TD ALIGN="right">Fax</TD>
+  <TD COLSPAN=5><INPUT TYPE="text" NAME="fax" VALUE="<%= $fax %>" SIZE=12></TD>
+</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;
+      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 state zip daytime night fax )], #county country
+        layer_callback => sub {
+          my $layer = shift;
+          my $html = <<ENDOUT;
+<INPUT TYPE="hidden" NAME="pkgpart" VALUE="$layer">
+<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>
+</TR>
+<TR>
+  <TH ALIGN="right"><font color="#ff0000">*</font>Password</TH>
+  <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>
+</TR>
+ENDOUT
+          if ( $init_data->{'security_phrase'} ) {
+            $html .= <<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="">';
+          }
+
+          if ( scalar(@$pops) ) {
+            $html .= '<TR><TD ALIGN="right">Access number</TD><TD>'.
+                     popselector($popnum). '</TD></TR>';
+          } else {
+            $html .= popselector($popnum);
+          }
+
+          $html .= '</TABLE><font color="#ff0000">*</font> required fields';
+
+          if ( $pkgpart2payby{$layer} eq 'BILL' ) {
+            $html .= <<ENDOUT;
+<INPUT TYPE="hidden" NAME="payby" VALUE="BILL">
+<INPUT TYPE="hidden" NAME="invoicing_list_POST" VALUE="">
+<INPUT TYPE="hidden" NAME="BILL_payinfo" VALUE="">
+<INPUT TYPE="hidden" NAME="BILL_month" VALUE="12">
+<INPUT TYPE="hidden" NAME="BILL_year" VALUE="2037">
+<INPUT TYPE="hidden" NAME="BILL_payname" VALUE="">
+<BR><BR><INPUT TYPE="submit" VALUE="Signup">
+ENDOUT
+          } elsif ( $pkgpart2payby{$layer} eq 'CARD' ) {
+            my $postal_checked = '';
+            my @invoicing_list = split(', ', $invoicing_list );
+            $postal_checked = 'CHECKED'
+              if ! @invoicing_list || grep { $_ eq 'POST' } @invoicing_list;
+
+            $invoicing_list= join(', ', grep { $_ ne 'POST' } @invoicing_list );
+
+            my $expselect = expselect("CARD", $paydate);
+
+            my $cardselect = '<SELECT NAME="CARD_type"><OPTION></OPTION>';
+            my %types = (
+                          'VISA' => 'VISA card',
+                          'MasterCard' => 'MasterCard',
+                          'Discover' => 'Discover card',
+                          'American Express' => 'American Express card',
+                        );
+            foreach ( keys %types ) {
+              $selected =
+                $cgi->param('CARD_type') eq $types{$_} ? 'SELECTED' : '';
+              $cardselect .=
+                qq!<OPTION $selected VALUE="$types{$_}">$_</OPTION>!;
+            }
+            $cardselect .= '</SELECT>';
+
+            $html .= <<ENDOUT;
+<INPUT TYPE="hidden" NAME="payby" VALUE="CARD">
+<BR><BR>Billing information
+<TABLE BGCOLOR="#c0c0c0" BORDER=0 CELLSPACING=0>
+<INPUT TYPE="hidden" NAME="invoicing_list_POST" VALUE="">
+<TR>
+  <TD ALIGN="right">Email statement to </TD>
+  <TD><INPUT TYPE="text" NAME="invoicing_list" VALUE="$invoicing_list"></TD>
+</TR>
+<TR>
+  <TH ALIGN="right"><font color="#ff0000">*</font>Credit card type</TH>
+  <TD>$cardselect</TD>
+</TR>
+<TR>
+  <TH ALIGN="right"><font color="#ff0000">*</font>Card number</TH>
+  <TD><INPUT TYPE="text" NAME="CARD_payinfo" VALUE="$payinfo" MAXLENGTH=19></TD>
+</TR>
+<TR>
+  <TH ALIGN="right"><font color="#ff0000">*</font>*</font>Exp</TH>
+  <TD>$expselect</TD>
+</TR>
+<TR>
+  <TH ALIGN="right"><font color="#ff0000">*</font>Name on card</TH>
+  <TD><INPUT TYPE="text" NAME="CARD_payname" VALUE="$payname"></TD>
+</TR>
+</TABLE>
+<font color="#ff0000">*</font> required fields
+<BR><BR><INPUT TYPE="submit" VALUE="Signup">
+ENDOUT
+          } else {
+            $html = <<ENDOUT;
+<BR>Please select a package.<BR>
+ENDOUT
+
+          }
+
+          $html;
+
+        },
+      );
+
+      $widget->html;
+
+
+ %>
+</BODY></HTML>