diff options
Diffstat (limited to 'fs_selfservice')
-rw-r--r-- | fs_selfservice/FS-SelfService/SelfService.pm | 1 | ||||
-rw-r--r-- | fs_selfservice/FS-SelfService/cgi/select_cust.html | 38 | ||||
-rwxr-xr-x | fs_selfservice/FS-SelfService/cgi/selfservice.cgi | 16 |
3 files changed, 54 insertions, 1 deletions
diff --git a/fs_selfservice/FS-SelfService/SelfService.pm b/fs_selfservice/FS-SelfService/SelfService.pm index f54a1571e..3aa60a0c0 100644 --- a/fs_selfservice/FS-SelfService/SelfService.pm +++ b/fs_selfservice/FS-SelfService/SelfService.pm @@ -30,6 +30,7 @@ $socket .= '.'.$tag if defined $tag && length($tag); 'login' => 'MyAccount/login', 'logout' => 'MyAccount/logout', 'switch_acct' => 'MyAccount/switch_acct', + 'switch_cust' => 'MyAccount/switch_cust', 'customer_info' => 'MyAccount/customer_info', 'customer_info_short' => 'MyAccount/customer_info_short', 'billing_history' => 'MyAccount/billing_history', diff --git a/fs_selfservice/FS-SelfService/cgi/select_cust.html b/fs_selfservice/FS-SelfService/cgi/select_cust.html new file mode 100644 index 000000000..7ab55db45 --- /dev/null +++ b/fs_selfservice/FS-SelfService/cgi/select_cust.html @@ -0,0 +1,38 @@ +<HTML> + <HEAD> + <TITLE>Select customer</TITLE> + <%= $head %> + </HEAD> + <BODY BGCOLOR="<%= $body_bgcolor || '#eeeeee' %>"> + <%= $body_header %> + +<FONT SIZE=5>Select customer</FONT><BR><BR> +<FONT SIZE="+1" COLOR="#ff0000"><%= $error %></FONT> + +<%= $selfurl =~ s/\?.*//; ''; %> +<FORM ACTION="<%= $selfurl %>" METHOD=POST> +<INPUT TYPE="hidden" NAME="action" VALUE="switch_cust"> +<INPUT TYPE="hidden" NAME="agentnum" VALUE="<%= $agentnum %>"> + +<TABLE BGCOLOR="<%= $box_bgcolor || '#c0c0c0' %>" BORDER=0 CELLSPACING=2 CELLPADDING=0> + + <TR> + <TH ALIGN="right">Customer </TH> + <TD> + <SELECT NAME="custnum"> + <OPTION VALUE="">Select a customer +<%= $OUT .= qq(<OPTION VALUE="$_">). encode_entities( $customers{$_} ) + foreach keys %customers; +%> + </SELECT> + </TD> + </TR> + + <TR> + <TD COLSPAN=2 ALIGN="center"><INPUT TYPE="submit" VALUE="Select customer"></TD> + </TR> + +</TABLE> +</FORM> + +<%= $body_footer %> diff --git a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi index 9443a7de7..2337fb51e 100755 --- a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi +++ b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi @@ -81,6 +81,7 @@ my @actions = ( qw( process_change_password customer_suspend_pkg process_suspend_pkg + switch_cust )); my @nologin_actions = (qw( @@ -204,6 +205,12 @@ unless ( $nologin_actions{$action} ) { # at this point $session_id is a real session + if ( ! $login_rv->{'custnum'} && ! $login_rv->{'svcnum'} && $login_rv->{'customers'} ) { + #select a customer if we're a multi-contact customer + do_template('select_cust', { %$login_rv } ); + exit; + } + } warn "calling $action sub\n" @@ -212,6 +219,7 @@ $FS::SelfService::DEBUG = $DEBUG; my $result = eval "&$action();"; die $@ if $@; +use Data::Dumper; warn Dumper($result) if $DEBUG; if ( $result->{error} && ( $result->{error} eq "Can't resume session" @@ -237,7 +245,13 @@ do_template($action, { #-- -use Data::Dumper; +sub switch_cust { + $action = 'myaccount'; + FS::SelfService::switch_cust( 'session_id' => $session_id, + 'custnum' => scalar($cgi->param('custnum')), + ); +} + sub myaccount { customer_info( 'session_id' => $session_id ); } |