From 167dbdad01e2c1b62fd9be43cc05212e8c874a02 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Tue, 3 Feb 2015 07:14:45 -0800 Subject: contacts can be shared among customers / "duplicate contact emails", RT#27943 --- fs_selfservice/FS-SelfService/cgi/select_cust.html | 38 ++++++++++++++++++++++ fs_selfservice/FS-SelfService/cgi/selfservice.cgi | 16 ++++++++- 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 fs_selfservice/FS-SelfService/cgi/select_cust.html (limited to 'fs_selfservice/FS-SelfService/cgi') 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 @@ + + + Select customer + <%= $head %> + + + <%= $body_header %> + +Select customer

+<%= $error %> + +<%= $selfurl =~ s/\?.*//; ''; %> +
+ + + + + + + + + + + + + + +
Customer + +
+
+ +<%= $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 ); } -- cgit v1.2.1