From a28e2731a7febc2a96bb11ed4ce165808bd8b8d9 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 19 Apr 2002 13:17:56 +0000 Subject: [PATCH] signup server: FS::part_pkg->payby kludge & example template which uses H:W:SelectLayers --- .../FS-SignupClient/cgi/signup-alternate.html | 202 +++++++++++++++++++++ fs_signup/FS-SignupClient/cgi/signup.cgi | 12 +- fs_signup/fs_signup_server | 13 ++ 3 files changed, 225 insertions(+), 2 deletions(-) create mode 100755 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 index 000000000..668f124df --- /dev/null +++ b/fs_signup/FS-SignupClient/cgi/signup-alternate.html @@ -0,0 +1,202 @@ +ISP Signup form +ISP Signup form

+<%= $error %> +
+ + + + +Contact Information + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
*Contact name
(last, first)
, +
Company
*Address
 
*City*State/Country*Zip
Day Phone
Night Phone
Fax
* required fields
+ +

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 + if ( $init_data->{'security_phrase'} ) { + $html .= < + + + +ENDOUT + } else { + $html .= ''; + } + + if ( scalar(@$pops) ) { + $html .= ''; + } else { + $html .= popselector($popnum); + } + + $html .= '
*Username
*Password
*Re-enter Password
Security Phrase +
Access number'. + popselector($popnum). '
* required fields'; + + if ( $pkgpart2payby{$layer} eq 'BILL' ) { + $html .= < + + + + + +

+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 = ''; + + $html .= < +

Billing information + + + + + + + + + + + + + + + + + + + + + + +
Email statement to
*Credit card type$cardselect
*Card number
**Exp$expselect
*Name on card
+* required fields +

+ENDOUT + } else { + $html = <Please select a package.
+ENDOUT + + } + + $html; + + }, + ); + + $widget->html; + + + %> + diff --git a/fs_signup/FS-SignupClient/cgi/signup.cgi b/fs_signup/FS-SignupClient/cgi/signup.cgi index a7118ed2b..839d80421 100755 --- a/fs_signup/FS-SignupClient/cgi/signup.cgi +++ b/fs_signup/FS-SignupClient/cgi/signup.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: signup.cgi,v 1.23 2002-04-17 12:14:37 ivan Exp $ +# $Id: signup.cgi,v 1.24 2002-04-19 13:17:56 ivan Exp $ use strict; use vars qw( @payby $cgi $locales $packages $pops $init_data $error @@ -60,6 +60,7 @@ if ( -e $cck_file ) { $cck_template = ''; } +$agentnum = ''; if ( -e $signup_html ) { my $signup_txt = Text::Template::_load_text($signup_html) or die $Text::Template::ERROR; @@ -70,6 +71,11 @@ if ( -e $signup_html ) { DELIMITERS => [ '<%=', '%>' ] ) or die $Text::Template::ERROR; + if ( $signup_txt =~ + /<\s*INPUT TYPE="?hidden"?\s+NAME="?agentnum"?\s+VALUE="?(\d+)"?\s*>/si + ) { + $agentnum = $1; + } } else { $signup_template = new Text::Template ( TYPE => 'STRING', SOURCE => &signup_default, @@ -96,8 +102,10 @@ if ( -e $success_html ) { or die $Text::Template::ERROR; } + ( $locales, $packages, $pops, $init_data ) = signup_info(); @payby = @{$init_data->{'payby'}} if @{$init_data->{'payby'}}; +$packages = $init_data->{agentnum2part_pkg}{$agentnum} if $agentnum; $cgi = new CGI; @@ -169,7 +177,7 @@ if ( defined $cgi->param('magic') ) { 'sec_phrase' => $sec_phrase = $cgi->param('sec_phrase'), '_password' => $password = $cgi->param('_password'), 'popnum' => $popnum = $cgi->param('popnum'), - 'agentnum' => $agentnum = $cgi->param('agentnum'), + 'agentnum' => $agentnum, # = $cgi->param('agentnum'), } ); } diff --git a/fs_signup/fs_signup_server b/fs_signup/fs_signup_server index 1618cf1fe..38ad5583f 100755 --- a/fs_signup/fs_signup_server +++ b/fs_signup/fs_signup_server @@ -73,6 +73,19 @@ while (1) { qsearch( 'part_pkg', { 'disabled' => '' } ) ], + 'agentnum2part_pkg' => + { + map { + my $href = $_->pkgpart_hashref; + $_->agentnum => + [ + map { { 'payby' => [ $_->payby ], %{$_->hashref} } } + grep { $_->svcpart('svc_acct') && $href->{ $_->pkgpart } } + qsearch( 'part_pkg', { 'disabled' => '' } ) + ]; + } qsearch('agent', {} ) + }, + 'svc_acct_pop' => [ map { $_->hashref } @pops ], 'security_phrase' => $conf->exists('security_phrase'), -- 2.11.0