From 1720200cdbbd73919d3b25e221f3d47cdd12032d Mon Sep 17 00:00:00 2001 From: lawrence Date: Fri, 1 Sep 2006 01:51:46 +0000 Subject: [PATCH] Progress checkpoint on improved signup stuff for additional services --- FS/FS/ClientAPI/Signup.pm | 18 +++++++++++++++++- FS/FS/Conf.pm | 21 +++++++++++++++++++++ fs_selfservice/FS-SelfService/cgi/signup.html | 23 +++++++++++++++++++++++ 3 files changed, 61 insertions(+), 1 deletion(-) diff --git a/FS/FS/ClientAPI/Signup.pm b/FS/FS/ClientAPI/Signup.pm index 5d6eb0e24..7589f16fc 100644 --- a/FS/FS/ClientAPI/Signup.pm +++ b/FS/FS/ClientAPI/Signup.pm @@ -83,9 +83,25 @@ sub signup_info { 'countrydefault' => $conf->config('countrydefault') || 'US', 'refnum' => $conf->config('signup_server-default_refnum'), - }; + + + if ($conf->exists('signup_server-classnum2') || $conf->exists('signup_server-classnum3')) { + $signup_info->{optional_packages} = []; + + if (my $classnum = $conf->config('signup_server-classnum2')) { + my @pkgs = map { $_->hashref } FS::Record::qsearch( 'part_pkg', { classnum => $classnum } ); + push @{$signup_info->{optional_packages}}, \@pkgs; + } + + if (my $classnum = $conf->config('signup_server-classnum3')) { + my @pkgs = map { $_->hashref } FS::Record::qsearch( 'part_pkg', { classnum => $classnum } ); + push @{$signup_info->{optional_packages}}, \@pkgs; + } + + } + my $agentnum = $conf->config('signup_server-default_agentnum'); my $session = ''; diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index f6495119e..ee1692a62 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -1201,6 +1201,26 @@ httemplate/docs/config.html 'description' => 'Run billing for signup server signups immediately, and do not provision accounts which subsequently have a balance.', 'type' => 'checkbox', }, + { + key => 'signup_server-classnum2', + section => '', + description => 'Package Class for first optional purchase', + type => 'select-sub', + options_sub => sub { my @o = map { $_->{classnum} => $_->{classname} } map { $_->hashref } FS::Record::qsearch('pkg_class',{}); + } , + option_sub => sub { return map { $_->hashref->{classname}} FS::Record::qsearchs('pkg_class', { classnum => shift } ); }, + + }, + + { + key => 'signup_server-classnum3', + section => '', + description => 'Package Class for second optional purchase', + type => 'select-sub', + options_sub => sub { my @o = map { $_->{classnum} => $_->{classname} } map { $_->hashref } FS::Record::qsearch('pkg_class',{}); + } , + option_sub => sub { return map { $_->hashref->{classname}} FS::Record::qsearchs('pkg_class', { classnum => shift } ); }, + }, { 'key' => 'backend-realtime', @@ -1752,6 +1772,7 @@ httemplate/docs/config.html 'type' => 'text', }, + ); 1; diff --git a/fs_selfservice/FS-SelfService/cgi/signup.html b/fs_selfservice/FS-SelfService/cgi/signup.html index 3e0f32749..1ba3d7702 100755 --- a/fs_selfservice/FS-SelfService/cgi/signup.html +++ b/fs_selfservice/FS-SelfService/cgi/signup.html @@ -257,6 +257,29 @@ ENDOUT } %> + +<%= +if ( @optional_packages ) { + my @html; + foreach my $ii ( 0 .. $#optional_packages) { + my $friendly_index = $ii + 1; + if ($optional_packages[$ii]) { + push @html, qq|Optional Package # $friendly_index
|,'
'; + + push @html, qq||; + + push @html, '
'; + } + $OUT = join("\n", @html); + } +} else { +$OUT = '' +} +%> +