X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=fs_selfservice%2FFS-SelfService%2Fcgi%2Fselfservice.cgi;h=2337fb51eb21c9f80ac2a665cf6c09c932a89396;hb=ec7e8155fce544f19f2b6734476ed6db8c200aa9;hp=c232c4584b289af22751d1575cfef2ab3390aee8;hpb=554764806458d61d12b2a0077d4b6a8b5c5492c5;p=freeside.git diff --git a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi index c232c4584..2337fb51e 100755 --- a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi +++ b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi @@ -1,7 +1,7 @@ #!/usr/bin/perl -w use strict; -use vars qw($DEBUG $cgi $session_id $form_max $template_dir); +use vars qw($DEBUG $cgi $session_id $pw_session_id $form_max $template_dir); use subs qw(do_template); use CGI; use CGI::Carp qw(fatalsToBrowser); @@ -81,6 +81,7 @@ my @actions = ( qw( process_change_password customer_suspend_pkg process_suspend_pkg + switch_cust )); my @nologin_actions = (qw( @@ -97,7 +98,7 @@ my $action = 'myaccount'; # sensible default if ( $cgi->param('action') =~ /^process_forgot_password_session_(\w+)$/ ) { $action = 'process_forgot_password_session'; - $session_id = $1; + $pw_session_id = $1; } elsif ( $cgi->param('action') =~ /^(\w+)$/ ) { if (grep {$_ eq $1} @actions) { $action = $1; @@ -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 ); } @@ -1059,7 +1073,7 @@ sub process_forgot_password { sub process_forgot_password_session { $action = 'process_forgot_password'; check_reset_passwd( - 'session_id' => $session_id, + 'session_id' => $pw_session_id, ); }