#!/usr/bin/perl -Tw
#
-# $Id: signup.cgi,v 1.21 2002-04-16 00:02:26 ivan Exp $
+# $Id: signup.cgi,v 1.25 2002-04-19 23:50:37 ivan Exp $
use strict;
use vars qw( @payby $cgi $locales $packages $pops $init_data $error
$ieak_file $ieak_template $cck_file $cck_template
$signup_html $signup_template $success_html $success_template
$ac $exch $loc
+ $email_name $pkg
$self_url
);
use subs qw( print_form print_okay expselect signup_default success_default );
$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)
$cck_template = '';
}
+$agentnum = '';
if ( -e $signup_html ) {
my $signup_txt = Text::Template::_load_text($signup_html)
or die $Text::Template::ERROR;
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,
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;
'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'),
} );
}
my $password = $1;
( $cgi->param('first'). ' '. $cgi->param('last') ) =~ /^(.*)$/
or die "fatal: invalid email_name got past FS::SignupClient::new_customer";
- my $email_name = $1;
+ $email_name = $1; #global for template
- 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'};
+ #global for template
+ $pkg = ( grep { $_->{'pkgpart'} eq $pkgpart } @$packages )[0]->{'pkg'};
if ( $ieak_template
&& $user_agent->platform eq 'ia32'