diff options
author | ivan <ivan> | 2009-08-22 00:22:08 +0000 |
---|---|---|
committer | ivan <ivan> | 2009-08-22 00:22:08 +0000 |
commit | beb9681db0ee4c0912c82849267a82dd434784b3 (patch) | |
tree | d1ed900e3b2319d5bfa8e16006c082c2f83b1faf /fs_selfservice | |
parent | a22b55437cb9c2da2670c33b28dd521a1ef1a190 (diff) |
order svc_phone services from self-service too, RT#5085
Diffstat (limited to 'fs_selfservice')
4 files changed, 94 insertions, 49 deletions
diff --git a/fs_selfservice/FS-SelfService/cgi/misc/part_svc-columns.cgi b/fs_selfservice/FS-SelfService/cgi/misc/part_svc-columns.cgi new file mode 100755 index 000000000..4ee83ca96 --- /dev/null +++ b/fs_selfservice/FS-SelfService/cgi/misc/part_svc-columns.cgi @@ -0,0 +1,18 @@ +#!/usr/bin/perl -w + +use strict; +use CGI; +use FS::SelfService qw( mason_comp ); + +my $cgi = new CGI; + +my $rv = mason_comp( 'comp' => '/misc/part_svc-columns.cgi', + 'query_string' => $cgi->query_string, #pass CGI params... + ); + +#hmm. +my $output = $rv->{'error'} || $rv->{'output'}; + +print $cgi->header( '-expires' => 'now' ). + $output; + diff --git a/fs_selfservice/FS-SelfService/cgi/misc/svc_acct-domains.cgi b/fs_selfservice/FS-SelfService/cgi/misc/svc_acct-domains.cgi new file mode 100755 index 000000000..c5413bac6 --- /dev/null +++ b/fs_selfservice/FS-SelfService/cgi/misc/svc_acct-domains.cgi @@ -0,0 +1,18 @@ +#!/usr/bin/perl -w + +use strict; +use CGI; +use FS::SelfService qw( mason_comp ); + +my $cgi = new CGI; + +my $rv = mason_comp( 'comp' => '/misc/svc_acct-domains.cgi', + 'query_string' => $cgi->query_string, #pass CGI params... + ); + +#hmm. +my $output = $rv->{'error'} || $rv->{'output'}; + +print $cgi->header( '-expires' => 'now' ). + $output; + diff --git a/fs_selfservice/FS-SelfService/cgi/order_pkg.html b/fs_selfservice/FS-SelfService/cgi/order_pkg.html index 9cdd4cd6c..4abfd8440 100644 --- a/fs_selfservice/FS-SelfService/cgi/order_pkg.html +++ b/fs_selfservice/FS-SelfService/cgi/order_pkg.html @@ -1,6 +1,6 @@ <SCRIPT TYPE="text/javascript"> function enable_order_pkg () { - if ( document.OrderPkgForm.pkgpart.selectedIndex > 0 ) { + if ( document.OrderPkgForm.pkgpart_svcpart.selectedIndex > 0 ) { document.OrderPkgForm.submit.disabled = false; } else { document.OrderPkgForm.submit.disabled = true; @@ -16,46 +16,16 @@ function enable_order_pkg () { <INPUT TYPE="hidden" NAME="action" VALUE="process_order_pkg"> <INPUT TYPE="hidden" NAME="custnum" VALUE="<%= $custnum %>"> <TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0> -<TR> - <TD COLSPAN=2><SELECT NAME="pkgpart" onChange="enable_order_pkg()"> - <OPTION VALUE=""> - - <%= - foreach my $part_pkg ( @part_pkg ) { - $OUT .= '<OPTION VALUE="'. $part_pkg->{'pkgpart'}. '"'; - $OUT .= ' SELECTED' if $pkgpart && $part_pkg->{'pkgpart'} == $pkgpart; - $OUT .= '>'. $part_pkg->{'pkg'}; - } - %> - </SELECT></TD> -</TR> -<TR> - <TD ALIGN="right">Username</TD> - <TD><INPUT TYPE="text" NAME="username" VALUE="<%= $username %>"></TD> -</TR> -<TR> - <TD ALIGN="right">Password</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> -</TR> -<%= - if ( $security_phrase ) { - $OUT .= <<ENDOUT; <TR> - <TD ALIGN="right">Security Phrase</TD> - <TD><INPUT TYPE="text" NAME="sec_phrase" VALUE="$sec_phrase"> + <TD COLSPAN=2> + <TABLE><TR><TD> <%= $pkg_selector %> + </TD> </TR> -ENDOUT - } else { - $OUT .= '<INPUT TYPE="hidden" NAME="sec_phrase" VALUE="">'; - } -%> + <%= + if ( 0 ) { if ( @svc_acct_pop ) { $OUT .= '<TR><TD ALIGN="right">Access number</TD><TD>'. popselector( 'popnum' => $popnum, @@ -68,8 +38,10 @@ ENDOUT } else { $OUT .= popselector(popnum=>$popnum, pops=>\@svc_acct_pop); } + } + ''; %> </TABLE> -<INPUT NAME="submit" TYPE="submit" VALUE="Purchase" disabled> +<INPUT NAME="submit" TYPE="submit" VALUE="Purchase" DISABLED> </FORM> diff --git a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi index a5a7d1844..2ace027a4 100644 --- a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi +++ b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi @@ -17,6 +17,7 @@ use FS::SelfService qw( unprovision_svc change_pkg domainselector list_svcs list_svc_usage list_cdr_usage list_support_usage myaccount_passwd + mason_comp ); $template_dir = '.'; @@ -199,11 +200,24 @@ sub customer_order_pkg { my $customer_info = customer_info( 'session_id' => $session_id ); return $customer_info if ( $customer_info->{'error'} ); + my $pkgselect = mason_comp( + 'session_id' => $session_id, + 'comp' => '/edit/cust_main/first_pkg/select-part_pkg.html', + 'args' => [ 'password_verify' => 1, + 'onchange' => 'enable_order_pkg()', + 'relurls' => 1, + 'empty_label' => 'Select package', + ], + ); + + $pkgselect = $pkgselect->{'error'} || $pkgselect->{'output'}; + return { ( map { $_ => $init_data->{$_} } qw( part_pkg security_phrase svc_acct_pop ), ), %$customer_info, + 'pkg_selector' => $pkgselect, }; } @@ -229,23 +243,46 @@ sub process_order_pkg { my $results = ''; - unless ( length($cgi->param('_password')) ) { - my $init_data = signup_info( 'customer_session_id' => $session_id ); - $results = { 'error' => $init_data->{msgcat}{empty_password} }; - $results = { 'error' => $init_data->{error} } if($init_data->{error}); + my @params = (qw( custnum pkgpart )); + my $svcdb = ''; + if ( $cgi->param('pkgpart_svcpart') =~ /^(\d+)_(\d+)$/ ) { + $cgi->param('pkgpart', $1); + $cgi->param('svcpart', $2); + push @params, 'svcpart'; + $svcdb = $cgi->param('svcdb'); + push @params, 'domsvc' if $svcdb eq 'svc_acct'; + } else { + $svcdb = 'svc_acct'; } - if ( $cgi->param('_password') ne $cgi->param('_password2') ) { - my $init_data = signup_info( 'customer_session_id' => $session_id ); - $results = { 'error' => $init_data->{msgcat}{passwords_dont_match} }; - $results = { 'error' => $init_data->{error} } if($init_data->{error}); - $cgi->param('_password', ''); - $cgi->param('_password2', ''); + + if ( $svcdb eq 'svc_acct' ) { + + push @params, qw( username _password _password2 sec_phrase popnum ); + + unless ( length($cgi->param('_password')) ) { + my $init_data = signup_info( 'customer_session_id' => $session_id ); + $results = { 'error' => $init_data->{msgcat}{empty_password} }; + $results = { 'error' => $init_data->{error} } if($init_data->{error}); + } + if ( $cgi->param('_password') ne $cgi->param('_password2') ) { + my $init_data = signup_info( 'customer_session_id' => $session_id ); + $results = { 'error' => $init_data->{msgcat}{passwords_dont_match} }; + $results = { 'error' => $init_data->{error} } if($init_data->{error}); + $cgi->param('_password', ''); + $cgi->param('_password2', ''); + } + + } elsif ( $svcdb eq 'svc_phone' ) { + + push @params, qw( phonenum sip_password pin phone_name ); + + } else { + die "$svcdb not handled on process_order_pkg yet"; } $results ||= order_pkg ( 'session_id' => $session_id, - map { $_ => $cgi->param($_) } - qw( custnum pkgpart username _password _password2 sec_phrase popnum ) + map { $_ => $cgi->param($_) } @params ); |