summaryrefslogtreecommitdiff
path: root/fs_signup
diff options
context:
space:
mode:
authorivan <ivan>2002-04-10 13:42:49 +0000
committerivan <ivan>2002-04-10 13:42:49 +0000
commit0b65ce59c7d2ee712389c27954382274ddf718a5 (patch)
treeed8d8fb079faf656fe93e5f68d98e095500c03ef /fs_signup
parentfd597aef277c522889a849d78dc7dcae67d00d95 (diff)
bulk checkin from working on the road:
- use msgcat for more error messages - should be all things that would come3 back from the signup server normally now - signup server: don't display access number <SELECT> if there's none or one - signup_server-realtime config option to run billing for signup server signups immediately - signup server: pkg available to success templates, better documentation on success templates - httemplate/edit/msgcat.cgi fields are properly sticky on errors - httemplate/edit/process/msgcat.cgi - don't update identical fields
Diffstat (limited to 'fs_signup')
-rwxr-xr-xfs_signup/FS-SignupClient/cgi/signup.cgi39
-rwxr-xr-xfs_signup/FS-SignupClient/cgi/signup.html18
-rw-r--r--fs_signup/FS-SignupClient/cgi/success.html7
-rwxr-xr-xfs_signup/fs_signup_server55
4 files changed, 84 insertions, 35 deletions
diff --git a/fs_signup/FS-SignupClient/cgi/signup.cgi b/fs_signup/FS-SignupClient/cgi/signup.cgi
index 46621d1e8..284237dbc 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.19 2002-04-07 05:56:08 ivan Exp $
+# $Id: signup.cgi,v 1.20 2002-04-10 13:42:48 ivan Exp $
use strict;
use vars qw( @payby $cgi $locales $packages $pops $init_data $error
@@ -15,7 +15,7 @@ use vars qw( @payby $cgi $locales $packages $pops $init_data $error
);
use subs qw( print_form print_okay expselect signup_default success_default );
use CGI;
-use CGI::Carp qw(fatalsToBrowser);
+#use CGI::Carp qw(fatalsToBrowser);
use Text::Template;
use Business::CreditCard;
use HTTP::Headers::UserAgent 2.00;
@@ -230,13 +230,15 @@ sub print_okay {
or die "fatal: invalid password got past FS::SignupClient::new_customer";
my $password = $1;
( $cgi->param('first'). ' '. $cgi->param('last') ) =~ /^(.*)$/
- or die "fatal: invalid email_name got past FS::SignupCLient::new_customer";
+ or die "fatal: invalid email_name got past FS::SignupClient::new_customer";
my $email_name = $1;
my $pop = pop_info($cgi->param('popnum'))
or die "fatal: invalid popnum got past FS::SignupClient::new_customer";
( $ac, $exch, $loc ) = ( $pop->{'ac'}, $pop->{'exch'}, $pop->{'loc'} );
+ my $pkg = ( grep { $_->{'pkgpart'} eq $pkgpart } @$packages )[0]->{'pkg'};
+
if ( $ieak_template
&& $user_agent->platform eq 'ia32'
&& $user_agent->os =~ /^win/
@@ -277,6 +279,12 @@ sub pop_info {
sub popselector {
my( $popnum, $state ) = @_;
+ return '<INPUT TYPE="hidden" NAME="popnum" VALUE="">' unless @$pops;
+ return $pops->[0]{city}. ', '. $pops->[0]{state}.
+ ' ('. $pops->[0]{ac}. ')/'. $pops->[0]{exch}.
+ '<INPUT TYPE="hidden" NAME="popnum" VALUE="'. $pops->[0]{popnum}. '">'
+ if scalar(@$pops) == 1;
+
my %pop = ();
push @{ $pop{$_->{state}} }, $_ foreach @$pops;
@@ -359,6 +367,13 @@ sub success_default { #html to use if you don't specify a success file
<HTML><HEAD><TITLE>Signup successful</TITLE></HEAD>
<BODY BGCOLOR="#e8e8e8"><FONT SIZE=7>Signup successful</FONT><BR><BR>
Thanks for signing up!
+<BR><BR>
+Signup information for <%= $email_name %>:
+<BR><BR>
+Username: <%= $username %><BR>
+Password: <%= $password %><BR>
+Access number: (<%= $ac %>) / $exch - $local<BR>
+Package: <%= $pkg %><BR>
</BODY></HTML>
END
}
@@ -515,13 +530,11 @@ Contact Information
</TR>
<TR>
<TD ALIGN="right">Password</TD>
- <TD><INPUT TYPE="password" NAME="_password" VALUE="<%= $password %>">
- (blank to generate)</TD>
+ <TD><INPUT TYPE="password" NAME="_password" VALUE="<%= $password %>"></TD>
</TR>
<TR>
<TD ALIGN="right">Re-enter Password</TD>
- <TD><INPUT TYPE="password" NAME="_password2" VALUE="<%= $password2 %>">
- </TD>
+ <TD><INPUT TYPE="password" NAME="_password2" VALUE="<%= $password2 %>"></TD>
</TR>
<%=
if ( $init_data->{'security_phrase'} ) {
@@ -536,10 +549,14 @@ ENDOUT
$OUT .= '<INPUT TYPE="hidden" NAME="sec_phrase" VALUE="">';
}
%>
-<TR>
- <TD ALIGN="right">Access number</TD>
- <TD><%= popselector($popnum) %></TD>
-</TR>
+<%=
+ if ( scalar(@$pops) ) {
+ $OUT .= '<TR><TD ALIGN="right">Access number</TD><TD>'.
+ popselector($popnum). '</TD></TR>';
+ } else {
+ $OUT .= popselector($popnum);
+ }
+%>
</TABLE>
<BR><BR><INPUT TYPE="submit" VALUE="Signup">
</FORM></BODY></HTML>
diff --git a/fs_signup/FS-SignupClient/cgi/signup.html b/fs_signup/FS-SignupClient/cgi/signup.html
index 5d2f2d9c9..6c601410c 100755
--- a/fs_signup/FS-SignupClient/cgi/signup.html
+++ b/fs_signup/FS-SignupClient/cgi/signup.html
@@ -148,13 +148,11 @@ Contact Information
</TR>
<TR>
<TD ALIGN="right">Password</TD>
- <TD><INPUT TYPE="password" NAME="_password" VALUE="<%= $password %>">
- (blank to generate)</TD>
+ <TD><INPUT TYPE="password" NAME="_password" VALUE="<%= $password %>"></TD>
</TR>
<TR>
<TD ALIGN="right">Re-enter Password</TD>
- <TD><INPUT TYPE="password" NAME="_password2" VALUE="<%= $password2 %>">
- </TD>
+ <TD><INPUT TYPE="password" NAME="_password2" VALUE="<%= $password2 %>"></TD>
</TR>
<%=
if ( $init_data->{'security_phrase'} ) {
@@ -169,10 +167,14 @@ ENDOUT
$OUT .= '<INPUT TYPE="hidden" NAME="sec_phrase" VALUE="">';
}
%>
-<TR>
- <TD ALIGN="right">Access number</TD>
- <TD><%= popselector($popnum) %></TD>
-</TR>
+<%=
+ if ( scalar(@$pops) ) {
+ $OUT .= '<TR><TD ALIGN="right">Access number</TD><TD>'.
+ popselector($popnum). '</TD></TR>';
+ } else {
+ $OUT .= popselector($popnum);
+ }
+%>
</TABLE>
<BR><BR><INPUT TYPE="submit" VALUE="Signup">
</FORM></BODY></HTML>
diff --git a/fs_signup/FS-SignupClient/cgi/success.html b/fs_signup/FS-SignupClient/cgi/success.html
index 6bc2d1fd7..0119b3b5e 100644
--- a/fs_signup/FS-SignupClient/cgi/success.html
+++ b/fs_signup/FS-SignupClient/cgi/success.html
@@ -1,4 +1,11 @@
<HTML><HEAD><TITLE>Signup successful</TITLE></HEAD>
<BODY BGCOLOR="#e8e8e8"><FONT SIZE=7>Signup successful</FONT><BR><BR>
Thanks for signing up!
+<BR><BR>
+Signup information for <%= $email_name %>:
+<BR><BR>
+Username: <%= $username %><BR>
+Password: <%= $password %><BR>
+Access number: (<%= $ac %>) / $exch - $local<BR>
+Package: <%= $pkg %><BR>
</BODY></HTML>
diff --git a/fs_signup/fs_signup_server b/fs_signup/fs_signup_server
index 871bbdf1b..ebf424cd7 100755
--- a/fs_signup/fs_signup_server
+++ b/fs_signup/fs_signup_server
@@ -47,6 +47,7 @@ while (1) {
warn "[fs_signup_server] Connecting to $machine...\n" if $Debug;
sshopen2($machine,$reader,$writer,$fs_signupd);
+ my @pops = qsearch('svc_acct_pop',{} );
my $init_data = {
#'_protocol' => 'signup',
@@ -63,7 +64,7 @@ while (1) {
qsearch( 'part_pkg', { 'disabled' => '' } )
],
- 'svc_acct_pop' => [ map { $_->hashref } qsearch ('svc_acct_pop',{} ) ],
+ 'svc_acct_pop' => [ map { $_->hashref } @pops ],
'security_phrase' => $conf->exists('security_phrase'),
@@ -96,8 +97,9 @@ while (1) {
#things that aren't necessary in base class, but are for signup server
#return "Passwords don't match"
# if $hashref->{'_password'} ne $hashref->{'_password2'}
- $error ||= "Empty password" unless $signup_data->{'_password'};
- $error ||= "No POP selected" unless $signup_data->{'popnum'};
+ $error ||= gettext('empty_password') unless $signup_data->{'_password'};
+ $error ||= gettext('no_access_number_selected')
+ unless $signup_data->{'popnum'} || !scalar(@pops);
#shares some stuff with htdocs/edit/process/cust_main.cgi... take any
# common that are still here and library them.
@@ -150,11 +152,30 @@ while (1) {
use Tie::RefHash;
tie my %hash, 'Tie::RefHash';
%hash = ( $cust_pkg => [ $svc_acct ] );
- $error ||= $cust_main->insert( \%hash, \@invoicing_list );
+ $error ||= $cust_main->insert( \%hash, \@invoicing_list ); #msgcat
warn "[fs_signup_server] Sending results...\n" if $Debug;
print $writer $error, "\n";
+ if ( $conf->config('signup_server-realtime') ) {
+
+ my $bill_error = $cust_main->bill;
+ warn "[fs_signup_server] error billing new customer: $bill_error"
+ if $bill_error;
+
+ $cust_main->apply_payments;
+ $cust_main->apply_credits;
+
+ $bill_error = $cust_main->collect;
+ warn "[fs_signup_server] error collecting from new customer: $bill_error"
+ if $bill_error;
+
+ if ( $cust_main->balance ) {
+ #should check list for errors...
+ $cust_main->suspend;
+ }
+ }
+
if ( $error && $conf->config('signup_server-email') ) {
warn "[fs_signup_server] Sending email...\n" if $Debug;
@@ -171,18 +192,20 @@ while (1) {
"Date: ". time2str("%a, %d %b %Y %X %z", time),
"Subject: FREESIDE NOTIFICATION: Signup Server",
] );
- my $message = new Mail::Internet (
- 'Header' => $header,
- 'Body' => [
- "This is an automatic message from your Freeside installation\n",
- "informing you a customer has signed up via the signup server:\n",
- "\n",
- 'custnum: '. $cust_main->custnum. "\n",
- 'Name : '. $cust_main->last. ", ". $cust_main->first. "\n",
- 'Agent : '. $cust_main->agent->agent. "\n",
- "\n",
- ],
- );
+ my $body = [
+ "This is an automatic message from your Freeside installation\n",
+ "informing you a customer has signed up via the signup server:\n",
+ "\n",
+ 'custnum: '. $cust_main->custnum. "\n",
+ 'Name : '. $cust_main->last. ", ". $cust_main->first. "\n",
+ 'Agent : '. $cust_main->agent->agent. "\n",
+ "\n",
+ ];
+ if ( $cust_main->balance ) {
+ push @$body,
+ "This customer has an outstanding balance and has been suspended.\n";
+ }
+ my $message = new Mail::Internet ( 'Header' => $header, 'Body' => $body );
$!=0;
$message->smtpsend( Host => $smtpmachine )
or $message->smtpsend( Host => $smtpmachine, Debug => 1 )