From 0e8a3725a0843c6e38fd5c430d6f1bc4a67d1419 Mon Sep 17 00:00:00 2001 From: lawrence Date: Tue, 29 Aug 2006 17:50:06 +0000 Subject: [PATCH] Signup Enhancements --- FS/FS/ClientAPI/Signup.pm | 5 +- fs_selfservice/FS-SelfService/cgi/signup.cgi | 6 +- fs_selfservice/FS-SelfService/cgi/signup.html | 122 ++++++++++++++++++++++---- 3 files changed, 111 insertions(+), 22 deletions(-) diff --git a/FS/FS/ClientAPI/Signup.pm b/FS/FS/ClientAPI/Signup.pm index 765ce404e..5d6eb0e24 100644 --- a/FS/FS/ClientAPI/Signup.pm +++ b/FS/FS/ClientAPI/Signup.pm @@ -24,7 +24,6 @@ sub signup_info { use vars qw($signup_info); #cache for performance; $signup_info ||= { - 'cust_main_county' => [ map { $_->hashref } qsearch('cust_main_county', {}) ], @@ -65,6 +64,8 @@ sub signup_info { 'svc_acct_pop' => [ map { $_->hashref } qsearch('svc_acct_pop',{} ) ], + 'emailinvoiceonly' => $conf->exists('emailinvoiceonly'), + 'security_phrase' => $conf->exists('security_phrase'), 'payby' => [ $conf->config('signup_server-payby') ], @@ -74,7 +75,7 @@ sub signup_info { 'ship_enabled' => defined dbdef->table('cust_main')->column('ship_last'), 'msgcat' => { map { $_=>gettext($_) } qw( - passwords_dont_match invalid_card unknown_card_type not_a empty_password + passwords_dont_match invalid_card unknown_card_type not_a empty_password illegal_or_empty_text ) }, 'statedefault' => $conf->config('statedefault') || 'CA', diff --git a/fs_selfservice/FS-SelfService/cgi/signup.cgi b/fs_selfservice/FS-SelfService/cgi/signup.cgi index d2ad0d64b..a09189270 100755 --- a/fs_selfservice/FS-SelfService/cgi/signup.cgi +++ b/fs_selfservice/FS-SelfService/cgi/signup.cgi @@ -1,7 +1,7 @@ #!/usr/bin/perl -T #!/usr/bin/perl -Tw # -# $Id: signup.cgi,v 1.2 2005-03-12 14:35:12 ivan Exp $ +# $Id: signup.cgi,v 1.3 2006-08-29 17:50:06 lawrence Exp $ use strict; use vars qw( @payby $cgi $init_data @@ -178,6 +178,10 @@ if ( ( defined($cgi->param('magic')) && $cgi->param('magic') eq 'process' ) or $error ||= $init_data->{msgcat}{not_a}. $cgi->param('CARD_type'); } + if ($init_data->{emailinvoiceonly} && (length $cgi->param('invoicing_list') < 1)) { + $error ||= $init_data->{msgcat}{illegal_or_empty_text}; + } + unless ( $error ) { my $rv = new_customer( { map { $_ => scalar($cgi->param($_)) } diff --git a/fs_selfservice/FS-SelfService/cgi/signup.html b/fs_selfservice/FS-SelfService/cgi/signup.html index 2ab07b37e..3e0f32749 100755 --- a/fs_selfservice/FS-SelfService/cgi/signup.html +++ b/fs_selfservice/FS-SelfService/cgi/signup.html @@ -19,6 +19,15 @@ + +<%= + $OUT = join("\n",map { my $method = $_ ; map { qq|| } qw / payinfo payinfo1 payinfo2 payname paycvv month year type / } @payby); +%> + +<%= + $OUT = join("\n", map { qq|| } qw / promo_code reg_code pkgpart username _password _password2 sec_phrase popnum / ); +%> + Where did you hear about our service? - Postal mail invoice + -Email invoice +<%= $OUT = ( $emailinvoiceonly ? q|*| : q|| ) %> Email invoice <%= scalar(@payby) > 1 ? 'Billing type' : '' %> @@ -126,7 +137,7 @@ Contact Information 'DCRD' => qq!Credit card
*$cardselect
*Exp !. expselect("DCRD"). qq!
*Name on card
!, 'CHEK' => qq!Electronic check
${r}Account number
${r}ABA/Routing code
${r}Bank name !, 'DCHK' => qq!Electronic check
${r}Account number
${r}ABA/Routing code
${r}Bank name !, - 'LECB' => qq!Phone bill billing
${r}Phone number !, + 'LECB' => qq!Phone bill billing
${r}Phone number !, 'BILL' => qq!Billing
P.O.
*Exp !. expselect("BILL", "12-2037"). qq!
*Attention
!, 'COMP' => qq!Complimentary
*Approved by
*Exp !. expselect("COMP"), 'PREPAY' => qq!Prepaid card
*!, @@ -155,26 +166,40 @@ Contact Information $paybychecked{$payby} .= qq!
CVV2 (help!; } } +use Tie::IxHash; +use HTML::Widgets::SelectLayers; + + my %payby_index = ( 'CARD' => qq/Credit Card/, + 'DCRD' => qq/Credit Card/, + 'CHEK' => qq/Check/, + 'DCHK' => qq/Check/, + 'LECB' => qq/Phone Bill Billing/, + 'BILL' => qq/Billing/, + 'COMP' => qq/Complimentary/, + 'PREPAY' => qq/Prepaid Card/, + ); + + +tie my %options, 'Tie::IxHash', (); + +foreach my $payby_option ( @payby ) { + $options{$payby_option} = $payby_index{$payby_option}; +} + +HTML::Widgets::SelectLayers->new( + options => \%options, + selected_layer => 'CARD', + form_name => 'dummy', + html_between => '', + form_action => 'dummy.cgi', + layer_callback => sub { my $layer = shift; return $paybychecked{$layer}; }, +)->html; - for (@payby) { - if ( scalar(@payby) == 1) { - $OUT .= ''. - qq!!. - "$paybychecked{$_}"; - } else { - $OUT .= qq! $paybychecked{$_}!; - } else { - $OUT .= qq!> $payby{$_}!; - } - } - } %> * required fields for each billing type -

First package +


First package @@ -233,4 +258,63 @@ ENDOUT %>


+
-- 2.11.0