use signup.html and success.html from current dir...
[freeside.git] / fs_signup / FS-SignupClient / cgi / signup.cgi
index 284237d..a7118ed 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -Tw
 #
-# $Id: signup.cgi,v 1.20 2002-04-10 13:42:48 ivan Exp $
+# $Id: signup.cgi,v 1.23 2002-04-17 12:14:37 ivan Exp $
 
 use strict;
 use vars qw( @payby $cgi $locales $packages $pops $init_data $error
@@ -8,6 +8,7 @@ use vars qw( @payby $cgi $locales $packages $pops $init_data $error
              $country $zip $daytime $night $fax $invoicing_list $payby $payinfo
              $paydate $payname $referral_custnum
              $pkgpart $username $password $password2 $sec_phrase $popnum
+             $agentnum
              $ieak_file $ieak_template $cck_file $cck_template
              $signup_html $signup_template $success_html $success_template
              $ac $exch $loc
@@ -30,8 +31,12 @@ use FS::SignupClient 0.03 qw( signup_info new_customer );
 
 $ieak_file = '/usr/local/freeside/ieak.template';
 $cck_file = '/usr/local/freeside/cck.template';
-$signup_html = '/usr/local/freeside/signup.html';
-$success_html = '/usr/local/freeside/success.html';
+$signup_html = -e 'signup.html'
+                 ? 'signup.html'
+                 : '/usr/local/freeside/signup.html';
+$success_html = -e 'success.html'
+                  ? 'success.html'
+                  : '/usr/local/freeside/success.html';
 
 if ( -e $ieak_file ) {
   my $ieak_txt = Text::Template::_load_text($ieak_file)
@@ -164,6 +169,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'),
       } );
 
     }
@@ -233,9 +239,13 @@ sub print_okay {
     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 $pop = pop_info($cgi->param('popnum'));
+    #or die "fatal: invalid popnum got past FS::SignupClient::new_customer";
+  if ( $pop ) {
+    ( $ac, $exch, $loc ) = ( $pop->{'ac'}, $pop->{'exch'}, $pop->{'loc'} );
+  } else {
+    ( $ac, $exch, $loc ) = ( '', '', ''); #presumably you're not using them.
+  }
 
   my $pkg = ( grep { $_->{'pkgpart'} eq $pkgpart } @$packages )[0]->{'pkg'};