diff options
author | ivan <ivan> | 2004-08-24 11:16:57 +0000 |
---|---|---|
committer | ivan <ivan> | 2004-08-24 11:16:57 +0000 |
commit | 0cbeb01df08457b056a7ae775b4924c266b4228b (patch) | |
tree | 24fb4d674874657d05512a48789715eb77c8c7c8 /fs_selfservice/FS-SelfService | |
parent | e64990633f433dc4e27f0509a2417aea29e0fdc8 (diff) |
big update for reseller interface
Diffstat (limited to 'fs_selfservice/FS-SelfService')
17 files changed, 520 insertions, 178 deletions
diff --git a/fs_selfservice/FS-SelfService/SelfService.pm b/fs_selfservice/FS-SelfService/SelfService.pm index ae6d37671..de33b75b1 100644 --- a/fs_selfservice/FS-SelfService/SelfService.pm +++ b/fs_selfservice/FS-SelfService/SelfService.pm @@ -40,6 +40,7 @@ $socket .= '.'.$tag if defined $tag && length($tag); 'signup_info' => 'Signup/signup_info', 'new_customer' => 'Signup/new_customer', 'agent_login' => 'Agent/agent_login', + 'agent_logout' => 'Agent/agent_logout', 'agent_info' => 'Agent/agent_info', 'agent_list_customers' => 'Agent/agent_list_customers', ); diff --git a/fs_selfservice/FS-SelfService/cgi/agent.cgi b/fs_selfservice/FS-SelfService/cgi/agent.cgi index 6d2fd5840..b88709862 100644 --- a/fs_selfservice/FS-SelfService/cgi/agent.cgi +++ b/fs_selfservice/FS-SelfService/cgi/agent.cgi @@ -9,10 +9,12 @@ use CGI; use CGI::Carp qw(fatalsToBrowser); use Business::CreditCard; use Text::Template; -use FS::SelfService qw( agent_login agent_info +#use HTML::Entities; +use FS::SelfService qw( agent_login agent_logout agent_info agent_list_customers signup_info new_customer - customer_info order_pkg + customer_info list_pkgs order_pkg + part_svc_info provision_acct unprovision_svc ); $DEBUG = 0; @@ -65,7 +67,7 @@ $session_id = $cgi->param('session'); warn "$me checking action\n" if $DEBUG; $cgi->param('action') =~ - /^(agent_main|signup|process_signup|list_customers|view_customer|process_order_pkg)$/ + /^(agent_main|signup|process_signup|list_customers|view_customer|agent_provision|provision_svc|process_svc_acct|delete_svc|agent_order_pkg|process_order_pkg|logout)$/ or die "unknown action ". $cgi->param('action'); my $action = $1; @@ -87,6 +89,11 @@ warn "$me done processing template $action\n" if $DEBUG; #-- +sub logout { + $action = 'agent_logout'; + agent_logout( 'session_id' => $session_id ); +} + sub agent_main { agent_info( 'session_id' => $session_id ); } sub signup { signup_info( 'session_id' => $session_id ); } @@ -184,15 +191,55 @@ sub process_signup { } sub list_customers { - agent_list_customers( 'session_id' => $session_id, - map { $_ => $cgi->param($_) } - grep defined($cgi->param($_)), - qw(prospect active susp cancel) - ); + + my $results = + agent_list_customers( 'session_id' => $session_id, + map { $_ => $cgi->param($_) } + grep defined($cgi->param($_)), + qw(prospect active susp cancel), + 'search', + ); + + if ( scalar( @{$results->{'customers'}} ) == 1 ) { + $action = 'view_customer'; + customer_info ( + 'agent_session_id' => $session_id, + 'custnum' => $results->{'customers'}[0]{'custnum'}, + ); + } else { + $results; + } + } sub view_customer { + #my $init_data = signup_info( 'session_id' => $session_id ); + #if ( $init_data->{'error'} ) { + # if ( $init_data->{'error'} eq "Can't resume session" ) { #ick + # do_template('agent_login',{}); + # exit; + # } else { #? + # die $init_data->{'error'}; + # } + #} + # + #my $customer_info = + customer_info ( + 'agent_session_id' => $session_id, + 'custnum' => $cgi->param('custnum'), + ); + # + #return { + # ( map { $_ => $init_data->{$_} } + # qw( part_pkg security_phrase svc_acct_pop ), + # ), + # %$customer_info, + #}; +} + +sub agent_order_pkg { + my $init_data = signup_info( 'session_id' => $session_id ); if ( $init_data->{'error'} ) { if ( $init_data->{'error'} eq "Can't resume session" ) { #ick @@ -205,16 +252,91 @@ sub view_customer { my $customer_info = customer_info ( 'agent_session_id' => $session_id, - 'custnum' => $cgi->param('custnum') + 'custnum' => $cgi->param('custnum'), ); - return { ( map { $_ => $init_data->{$_} } qw( part_pkg security_phrase svc_acct_pop ), ), %$customer_info, }; + +} + +sub agent_provision { + my $result = list_pkgs( + 'agent_session_id' => $session_id, + 'custnum' => $cgi->param('custnum'), + ); + die $result->{'error'} if exists $result->{'error'} && $result->{'error'}; + $result; +} + +sub provision_svc { + + my $result = part_svc_info( + 'agent_session_id' => $session_id, + map { $_ => $cgi->param($_) } qw( pkgnum svcpart custnum ), + ); + die $result->{'error'} if exists $result->{'error'} && $result->{'error'}; + + $result->{'svcdb'} =~ /^svc_(.*)$/ + #or return { 'error' => 'Unknown svcdb '. $result->{'svcdb'} }; + or die 'Unknown svcdb '. $result->{'svcdb'}; + $action .= "_$1"; + $action = "agent_$action"; + + $result; +} + +sub process_svc_acct { + + my $result = provision_acct ( + 'agent_session_id' => $session_id, + map { $_ => $cgi->param($_) } qw( + custnum pkgnum svcpart username _password _password2 sec_phrase popnum ) + ); + + if ( exists $result->{'error'} && $result->{'error'} ) { + #warn "$result $result->{'error'}"; + $action = 'provision_svc_acct'; + $action = "agent_$action"; + return { + $cgi->Vars, + %{ part_svc_info( 'agent_session_id' => $session_id, + map { $_ => $cgi->param($_) } qw(pkgnum svcpart custnum) + ) + }, + 'error' => $result->{'error'}, + }; + } else { + #warn "$result $result->{'error'}"; + $action = 'agent_provision'; + return { + %{agent_provision()}, + 'message' => $result->{'svc'}. ' setup sucessfully.', + }; + } + +} + +sub delete_svc { + my $result = unprovision_svc( + 'agent_session_id' => $session_id, + 'custnum' => $cgi->param('custnum'), + 'svcnum' => $cgi->param('svcnum'), + ); + + $action = 'agent_provision'; + + return { + %{agent_provision()}, + 'message' => $result->{'error'} + ? '<FONT COLOR="#FF0000">'. $result->{'error'}. '</FONT>' + : $result->{'svc'}. ' removed.' + }; + } sub process_order_pkg { @@ -223,11 +345,12 @@ sub process_order_pkg { unless ( length($cgi->param('_password')) ) { my $init_data = signup_info( 'session_id' => $session_id ); - $results = { 'error' => $init_data->{msgcat}{empty_password} } + #die $init_data->{'error'} if $init_data->{'error'}; + $results = { 'error' => $init_data->{msgcat}{empty_password} }; } if ( $cgi->param('_password') ne $cgi->param('_password2') ) { my $init_data = signup_info( 'session_id' => $session_id ); - $results = { error => $init_data->{msgcat}{passwords_dont_match} }; + $results = { 'error' => $init_data->{msgcat}{passwords_dont_match} }; $cgi->param('_password', ''); $cgi->param('_password2', ''); } @@ -238,17 +361,22 @@ sub process_order_pkg { qw( custnum pkgpart username _password _password2 sec_phrase popnum ) ); - $action = 'view_customer'; - $cgi->delete( grep { $_ ne 'custnum' } $cgi->param ) - unless $results->{'error'}; - - return { - $cgi->Vars, - %{view_customer()}, - 'message' => $results->{'error'} - ? '<FONT COLOR="#FF0000">'. $results->{'error'}. '</FONT>' - : 'Package order sucessful.' - }; + if ( $results->{'error'} ) { + $action = 'agent_order_pkg'; + return { + $cgi->Vars, + %{agent_order_pkg()}, + #'message' => '<FONT COLOR="#FF0000">'. $results->{'error'}. '</FONT>', + 'error' => '<FONT COLOR="#FF0000">'. $results->{'error'}. '</FONT>', + }; + } else { + $action = 'view_customer'; + #$cgi->delete( grep { $_ ne 'custnum' } $cgi->param ); + return { + %{view_customer()}, + 'message' => 'Package order sucessful.', + }; + } } @@ -277,5 +405,23 @@ sub do_template { } package FS::SelfService::_agentcgi; + +use HTML::Entities; use FS::SelfService qw(regionselector expselect popselector); +#false laziness w/selfservice.cgi +sub include { + my $name = shift; + my $template = new Text::Template( TYPE => 'FILE', + SOURCE => "$main::template_dir/$name.html", + DELIMITERS => [ '<%=', '%>' ], + UNTAINT => 1, + ) + or die $Text::Template::ERROR; + + $template->fill_in( PACKAGE => 'FS::SelfService::_agentcgi', + #HASH => $fill_in + ); + +} + diff --git a/fs_selfservice/FS-SelfService/cgi/agent_customer_menu.html b/fs_selfservice/FS-SelfService/cgi/agent_customer_menu.html new file mode 100644 index 000000000..603fc0bd2 --- /dev/null +++ b/fs_selfservice/FS-SelfService/cgi/agent_customer_menu.html @@ -0,0 +1,7 @@ +<%= $url = "$selfurl?session=$session_id;custnum=$custnum;action="; ''; %> +<TD VALIGN="top" HEIGHT=384 BGCOLOR="#dddddd"> +<A HREF="<%= $url %>agent_provision">Setup services</A><BR><BR> +<A HREF="<%= $url %>agent_order_pkg">Purchase additional package</A><BR><BR> + +</TD> + diff --git a/fs_selfservice/FS-SelfService/cgi/agent_delete_svc.html b/fs_selfservice/FS-SelfService/cgi/agent_delete_svc.html new file mode 100644 index 000000000..e8be07ed1 --- /dev/null +++ b/fs_selfservice/FS-SelfService/cgi/agent_delete_svc.html @@ -0,0 +1,20 @@ +<HTML><HEAD><TITLE>MyAccount</TITLE></HEAD> +<BODY BGCOLOR="#eeeeee"><FONT SIZE=5>MyAccount</FONT><BR><BR> +<%= $url = "$selfurl?session=$session_id;action="; ''; %> +<TABLE BORDER=0 CELLPADDING=4><TR> +<%= include('myaccount_menu') %> +<TD VALIGN="top"> +<%= $small_custview %> +<BR> +<%= if ( $error ) { + + $OUT .= qq!<FONT SIZE="+1" COLOR="#ff0000">Error: $error</FONT>!; +} else { + $OUT .= "<FONT SIZE=4>$svc removed.</FONT>"; +} %> + +</TD></TR></TABLE> +<HR> +<FONT SIZE="-2">powered by <a href="http://www.sisd.com/freeside">freeside</a></FONT> +</BODY></HTML> + diff --git a/fs_selfservice/FS-SelfService/cgi/agent_logout.html b/fs_selfservice/FS-SelfService/cgi/agent_logout.html new file mode 100644 index 000000000..98094679a --- /dev/null +++ b/fs_selfservice/FS-SelfService/cgi/agent_logout.html @@ -0,0 +1,5 @@ +<HTML><HEAD><TITLE>Reseller</TITLE></HEAD> +<BODY BGCOLOR="#eeeeee"><FONT SIZE=5>Reseller</FONT><BR><BR> +You have been logged out. +</BODY></HTML> + diff --git a/fs_selfservice/FS-SelfService/cgi/agent_main.html b/fs_selfservice/FS-SelfService/cgi/agent_main.html index 629734555..9dd338382 100644 --- a/fs_selfservice/FS-SelfService/cgi/agent_main.html +++ b/fs_selfservice/FS-SelfService/cgi/agent_main.html @@ -1,10 +1,9 @@ -<HTML><HEAD><TITLE>Reseller Main</TITLE></HEAD> -<BODY BGCOLOR="#eeeeee"><FONT SIZE=5>Reseller Main</FONT><BR><BR> +<HTML><HEAD><TITLE>Reseller</TITLE></HEAD> +<BODY BGCOLOR="#eeeeee"><FONT SIZE=5>Reseller</FONT><BR><BR> <%= $url = "$selfurl?session=$session_id;action="; ''; %> -<TABLE BORDER=0 CELLPADDING=4><TR><TD VALIGN="top" HEIGHT=384 BGCOLOR="#dddddd"> -<A HREF="<%= $url %>agent_main">Reseller Main</A><BR> -<!-- <A HREF="<%= $url %>other">SomethingElse</A><BR> --> -</TD><TD VALIGN="top"> +<TABLE BORDER=0 CELLPADDING=4><TR> +<%= include('agent_menu') %> +<TD VALIGN="top"> <%= $message ? "<FONT SIZE=\"+2\"><B>$message</B></FONT>" @@ -16,21 +15,19 @@ <TR><TD BGCOLOR="#dddddd"> <B><%= $num_prospect %></B> - <A HREF="<%= $url %>list_customers;prospect=1">prospects</A> + <%= $num_prospect ? qq!<A HREF="${url}list_customers;prospect=1">! : '' %>prospects</A> <BR><FONT COLOR="#00CC00"><B><%= $num_active %></B></FONT> - <A HREF="<%= $url %>list_customers;active=1">active</A> + <%= $num_active ? qq!<A HREF="${url}list_customers;active=1">! : '' %>active</A> <BR><FONT COLOR="#FF9900"><B><%= $num_susp %></B></FONT> - <A HREF="<%= $url %>list_customers;susp=1">suspended</A> + <%= $num_susp ? qq!<A HREF="${url}list_customers;susp=1">! : '' %>suspended</A> <BR><FONT COLOR="#FF0000"><B><%= $num_cancel %></B></FONT> - <A HREF="<%= $url %>list_customers;cancel=1">cancelled</A> + <%= $num_cancel ? qq!<A HREF="${url}list_customers;cancel=1">! : '' %>cancelled</A> </TD></TR></TABLE> -<BR><A HREF="<%= $url %>signup">New customer<!--/prospect--></A> - </TD></TR></TABLE> <HR> <FONT SIZE="-2">powered by <a href="http://www.sisd.com/freeside">freeside</a></FONT> diff --git a/fs_selfservice/FS-SelfService/cgi/agent_menu.html b/fs_selfservice/FS-SelfService/cgi/agent_menu.html new file mode 100644 index 000000000..84a295304 --- /dev/null +++ b/fs_selfservice/FS-SelfService/cgi/agent_menu.html @@ -0,0 +1,15 @@ +<%= $url = "$selfurl?session=$session_id;action="; ''; %> +<TD VALIGN="top" HEIGHT=384 BGCOLOR="#dddddd"> + +<A HREF="<%= $url %>agent_main">Overview</A><BR><BR> +<A HREF="<%= $url %>signup">New customer<!--/prospect--></A><BR><BR> +<FORM ACTION="<%= $selfurl %>"> +<INPUT TYPE="hidden" NAME="session" VALUE="<%= $session_id %>"> +<INPUT TYPE="hidden" NAME="action" VALUE="list_customers"> +<INPUT TYPE="text" NAME="search" SIZE=20><BR> +<SMALL><I>cust #, last name, or company</I></SMALL><BR> +<INPUT TYPE="submit" VALUE="Search customers"><BR> +</FORM> +<A HREF="<%= $url %>logout">Logout</A><BR><BR> + +</TD> diff --git a/fs_selfservice/FS-SelfService/cgi/agent_order_pkg.html b/fs_selfservice/FS-SelfService/cgi/agent_order_pkg.html new file mode 100644 index 000000000..0a665c99e --- /dev/null +++ b/fs_selfservice/FS-SelfService/cgi/agent_order_pkg.html @@ -0,0 +1,19 @@ +<HTML><HEAD><TITLE>Reseller</TITLE></HEAD> +<BODY BGCOLOR="#eeeeee"><FONT SIZE=5>Reseller</FONT><BR><BR> +<%= $url = "$selfurl?session=$session_id;custnum=$custnum;action="; ''; %> +<TABLE BORDER=0 CELLPADDING=4><TR> +<%= include('agent_menu') %> +<TD VALIGN="top"> +<%= $small_custview %> +<BR> + +<TABLE BORDER=0 CELLPADDING=4><TR> +<%= include('agent_customer_menu') %> +<TD VALIGN="top"> +<%= include('order_pkg') %> +</TD></TR></TABLE> + +</TD></TR></TABLE> +<HR> +<FONT SIZE="-2">powered by <a href="http://www.sisd.com/freeside">freeside</a></FONT> +</BODY></HTML> diff --git a/fs_selfservice/FS-SelfService/cgi/agent_provision.html b/fs_selfservice/FS-SelfService/cgi/agent_provision.html new file mode 100644 index 000000000..8770e2f9e --- /dev/null +++ b/fs_selfservice/FS-SelfService/cgi/agent_provision.html @@ -0,0 +1,25 @@ +<HTML><HEAD><TITLE>Reseller</TITLE></HEAD> +<BODY BGCOLOR="#eeeeee"><FONT SIZE=5>Reseller</FONT><BR><BR> +<%= $url = "$selfurl?session=$session_id;custnum=$custnum;action="; ''; %> +<TABLE BORDER=0 CELLPADDING=4><TR> +<%= include('agent_menu') %> +<TD VALIGN="top"> + +<%= $message + ? "<FONT SIZE=\"+2\"><B>$message</B></FONT><BR><BR>" + : '' +%> + +<%= $small_custview %> +<BR> + +<TABLE BORDER=0 CELLPADDING=4><TR> +<%= include('agent_customer_menu') %> +<TD VALIGN="top"> +<%= include('provision_list') %> +</TD></TR></TABLE> + +</TD></TR></TABLE> +<HR> +<FONT SIZE="-2">powered by <a href="http://www.sisd.com/freeside">freeside</a></FONT> +</BODY></HTML> diff --git a/fs_selfservice/FS-SelfService/cgi/agent_provision_svc_acct.html b/fs_selfservice/FS-SelfService/cgi/agent_provision_svc_acct.html new file mode 100644 index 000000000..8d299cdc5 --- /dev/null +++ b/fs_selfservice/FS-SelfService/cgi/agent_provision_svc_acct.html @@ -0,0 +1,19 @@ +<HTML><HEAD><TITLE>Reseller</TITLE></HEAD> +<BODY BGCOLOR="#eeeeee"><FONT SIZE=5>Reseller</FONT><BR><BR> +<%= $url = "$selfurl?session=$session_id;custnum=$custnum;action="; ''; %> +<TABLE BORDER=0 CELLPADDING=4><TR> +<%= include('agent_menu') %> +<TD VALIGN="top"> +<%= $small_custview %> +<BR> +<TABLE BORDER=0 CELLPADDING=4><TR> +<%= include('agent_customer_menu') %> +<TD VALIGN="top"> +<%= include('svc_acct') %> +</TD></TR></TABLE> + +</TD></TR></TABLE> +<HR> +<FONT SIZE="-2">powered by <a href="http://www.sisd.com/freeside">freeside</a></FONT> +</BODY></HTML> + diff --git a/fs_selfservice/FS-SelfService/cgi/list_customers.html b/fs_selfservice/FS-SelfService/cgi/list_customers.html index 6d4ba564e..858e5e9ba 100644 --- a/fs_selfservice/FS-SelfService/cgi/list_customers.html +++ b/fs_selfservice/FS-SelfService/cgi/list_customers.html @@ -1,10 +1,9 @@ -<HTML><HEAD><TITLE>Reseller Main</TITLE></HEAD> -<BODY BGCOLOR="#eeeeee"><FONT SIZE=5>Reseller Main</FONT><BR><BR> +<HTML><HEAD><TITLE>Reseller</TITLE></HEAD> +<BODY BGCOLOR="#eeeeee"><FONT SIZE=5>Reseller</FONT><BR><BR> <%= $url = "$selfurl?session=$session_id;action="; ''; %> -<TABLE BORDER=0 CELLPADDING=4><TR><TD VALIGN="top" HEIGHT=384 BGCOLOR="#dddddd"> -<A HREF="<%= $url %>agent_main">Reseller Main</A><BR> -<!-- <A HREF="<%= $url %>other">SomethingElse</A><BR> --> -</TD><TD VALIGN="top"> +<TABLE BORDER=0 CELLPADDING=4><TR> +<%= include('agent_menu') %> +<TD VALIGN="top"> <%= if ( @customers ) { @@ -38,4 +37,3 @@ <FONT SIZE="-2">powered by <a href="http://www.sisd.com/freeside">freeside</a></FONT> </BODY></HTML> - diff --git a/fs_selfservice/FS-SelfService/cgi/order_pkg.html b/fs_selfservice/FS-SelfService/cgi/order_pkg.html new file mode 100644 index 000000000..9cdd4cd6c --- /dev/null +++ b/fs_selfservice/FS-SelfService/cgi/order_pkg.html @@ -0,0 +1,75 @@ +<SCRIPT TYPE="text/javascript"> +function enable_order_pkg () { + if ( document.OrderPkgForm.pkgpart.selectedIndex > 0 ) { + document.OrderPkgForm.submit.disabled = false; + } else { + document.OrderPkgForm.submit.disabled = true; + } +} +</SCRIPT> +<FONT SIZE=4>Purchase additional package</FONT><BR><BR> +<%= if ( $error ) { + $OUT .= qq!<FONT SIZE="+1" COLOR="#ff0000">$error</FONT><BR><BR>!; +} ''; %> +<FORM NAME="OrderPkgForm" ACTION="<%= $selfurl %>" METHOD=POST> +<INPUT TYPE="hidden" NAME="session" VALUE="<%= $session_id %>"> +<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> +</TR> +ENDOUT + } else { + $OUT .= '<INPUT TYPE="hidden" NAME="sec_phrase" VALUE="">'; + } +%> +<%= + if ( @svc_acct_pop ) { + $OUT .= '<TR><TD ALIGN="right">Access number</TD><TD>'. + popselector( 'popnum' => $popnum, + 'pops' => \@svc_acct_pop, + 'init_popstate' => $init_popstate, + 'popac' => $popac, + 'acstate' => $acstate, + ). + '</TD></TR>'; + } else { + $OUT .= popselector(popnum=>$popnum, pops=>\@svc_acct_pop); + } +%> +</TABLE> +<INPUT NAME="submit" TYPE="submit" VALUE="Purchase" disabled> +</FORM> + diff --git a/fs_selfservice/FS-SelfService/cgi/provision.html b/fs_selfservice/FS-SelfService/cgi/provision.html index 326f90229..6d80e89db 100644 --- a/fs_selfservice/FS-SelfService/cgi/provision.html +++ b/fs_selfservice/FS-SelfService/cgi/provision.html @@ -4,73 +4,7 @@ <TABLE BORDER=0 CELLPADDING=4><TR> <%= include('myaccount_menu') %> <TD VALIGN="top"> -<FONT SIZE=4>Setup services</FONT><BR><BR> - -<SCRIPT> -function areyousure(href, message) { - if (confirm(message) == true) - window.location.href = href; -} -</SCRIPT> - -<%= foreach my $pkg ( - grep { scalar(@{$_->{part_svc}}) - || scalar(@{$_->{cust_svc}}) - } @cust_pkg - ) { - - $OUT .= '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#ffffff">'. - '<TR><TH BGCOLOR="#6666ff" COLSPAN=3>'. - $pkg->{'pkg'}. - '</TH></TR>'; - - my $col1 = "ffffff"; - my $col2 = "dddddd"; - my $col = $col1; - - foreach my $cust_svc ( @{ $pkg->{cust_svc} } ) { - my $td = qq!<TD BGCOLOR="#$col"!; - - $OUT .= '<TR>'. - "$td ALIGN=right>". $cust_svc->{label}[0]. ': </TD>'. - "$td><B>". $cust_svc->{label}[1]. '</B></TD>'. - "$td><FONT SIZE=-1>"; - - #if ( $cust_svc->{label}[2] eq 'svc_acct' ) { - # $OUT .= qq!(<A HREF="${url}changepw;svcnum=$cust_svc->{'svcnum'}">!. - # 'change pw) '; - #} - - unless ( $cust_svc->{'svcnum'} == $svcnum ) { - $OUT .= qq!(<A HREF="javascript:areyousure('${url}delete_svc;svcnum=$cust_svc->{svcnum}', 'This will perminantly delete the $cust_svc->{label}[1] $cust_svc->{label}[0]. Are you sure?')">!. - 'delete</A>)'; - - } - $OUT .= '</FONT></TD></TR>'; - $col = $col eq $col1 ? $col2 : $col1; - } - - $OUT .= '<TR><TD COLSPAN=3 BGCOLOR="#000000"></TD></TR>' - if scalar(@{$pkg->{part_svc}}) && scalar(@{$pkg->{cust_svc}}); - - my $col = $col1; - - foreach my $part_svc ( @{ $pkg->{part_svc} } ) { - - my $td = qq!<TD BGCOLOR="#$col"!; - - $OUT .= "<TR>$td COLSPAN=3>". - qq!<A HREF="${url}provision_svc;pkgnum=$pkg->{'pkgnum'};svcpart=$part_svc->{'svcpart'}">!. - 'Setup '. $part_svc->{'svc'}. '</A> '. - '('. $part_svc->{'num_avail'}. ' available)'. - '</TD></TR>'; - $col = $col eq $col1 ? $col2 : $col1; - } - - $OUT .= '</TABLE><BR>'; - -} %> - +<%= include('provision_list') %> </TD></TR></TABLE> <HR> <FONT SIZE="-2">powered by <a href="http://www.sisd.com/freeside">freeside</a></FONT> diff --git a/fs_selfservice/FS-SelfService/cgi/provision_list.html b/fs_selfservice/FS-SelfService/cgi/provision_list.html new file mode 100644 index 000000000..7e7059388 --- /dev/null +++ b/fs_selfservice/FS-SelfService/cgi/provision_list.html @@ -0,0 +1,74 @@ +<FONT SIZE=4>Setup services</FONT><BR><BR> + +<SCRIPT> +function areyousure(href, message) { + if (confirm(message) == true) + window.location.href = href; +} +</SCRIPT> + +<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#ffffff"> + +<%= foreach my $pkg ( + grep { scalar(@{$_->{part_svc}}) + || scalar(@{$_->{cust_svc}}) + } @cust_pkg + ) { + + $OUT .= #'<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#ffffff">'. + '<TR><TH BGCOLOR="#6666ff" COLSPAN=3>'. + $pkg->{'pkg'}. + '</TH></TR>'; + + my $col1 = "ffffff"; + my $col2 = "dddddd"; + my $col = $col1; + + foreach my $cust_svc ( @{ $pkg->{cust_svc} } ) { + my $td = qq!<TD BGCOLOR="#$col"!; + + $OUT .= '<TR>'. + "$td ALIGN=right>". $cust_svc->{label}[0]. ': </TD>'. + "$td><B>". $cust_svc->{label}[1]. '</B>'; + $OUT .= '<BR><I>password: '. encode_entities($cust_svc->{_password}). '</I>' + if exists($cust_svc->{_password}); + $OUT .= '</TD>'. + "$td><FONT SIZE=-1>"; + + #if ( $cust_svc->{label}[2] eq 'svc_acct' ) { + # $OUT .= qq!(<A HREF="${url}changepw;svcnum=$cust_svc->{'svcnum'}">!. + # 'change pw) '; + #} + + unless ( $cust_svc->{'svcnum'} == $svcnum ) { + $OUT .= qq!(<A HREF="javascript:areyousure('${url}delete_svc;svcnum=$cust_svc->{svcnum}', 'This will perminantly delete the $cust_svc->{label}[1] $cust_svc->{label}[0]. Are you sure?')">!. + 'delete</A>)'; + + } + $OUT .= '</FONT></TD></TR>'; + $col = $col eq $col1 ? $col2 : $col1; + } + + $OUT .= '<TR><TD COLSPAN=3 BGCOLOR="#000000"></TD></TR>' + if scalar(@{$pkg->{part_svc}}) && scalar(@{$pkg->{cust_svc}}); + + $col = $col1; + + foreach my $part_svc ( @{ $pkg->{part_svc} } ) { + + my $td = qq!<TD BGCOLOR="#$col"!; + + $OUT .= "<TR>$td COLSPAN=3 ALIGN=center>". + qq!<A HREF="${url}provision_svc;pkgnum=$pkg->{'pkgnum'};svcpart=$part_svc->{'svcpart'}">!. + 'Setup '. $part_svc->{'svc'}. '</A> '. + '('. $part_svc->{'num_avail'}. ' available)'. + '</TD></TR>'; + $col = $col eq $col1 ? $col2 : $col1; + } + + #$OUT .= '</TABLE><BR>'; + $OUT .= '<TR><TD BGCOLOR="#eeeeee" COLSPAN=3> </TD></TR>'; + +} %> + +</TABLE> diff --git a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi index d8e044a96..44dd8bb3a 100644 --- a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi +++ b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi @@ -6,6 +6,7 @@ use subs qw(do_template); use CGI; use CGI::Carp qw(fatalsToBrowser); use Text::Template; +use HTML::Entities; use FS::SelfService qw( login customer_info invoice payment_info process_payment list_pkgs @@ -176,7 +177,9 @@ sub logout { } sub provision { - list_pkgs( 'session_id' => $session_id ); + my $result = list_pkgs( 'session_id' => $session_id ); + die $result->{'error'} if exists $result->{'error'} && $result->{'error'}; + $result; } sub provision_svc { @@ -204,7 +207,7 @@ sub process_svc_acct { ); if ( exists $result->{'error'} && $result->{'error'} ) { - warn "$result $result->{'error'}"; + #warn "$result $result->{'error'}"; $action = 'provision_svc_acct'; return { $cgi->Vars, @@ -215,7 +218,7 @@ sub process_svc_acct { 'error' => $result->{'error'}, }; } else { - warn "$result $result->{'error'}"; + #warn "$result $result->{'error'}"; return $result; } @@ -255,8 +258,10 @@ sub do_template { package FS::SelfService::_selfservicecgi; #use FS::SelfService qw(regionselector expselect popselector); +use HTML::Entities; use FS::SelfService qw(popselector); +#false laziness w/agent.cgi sub include { my $name = shift; my $template = new Text::Template( TYPE => 'FILE', @@ -266,7 +271,9 @@ sub include { ) or die $Text::Template::ERROR; - $template->fill_in(); + $template->fill_in( PACKAGE => 'FS::SelfService::_selfservicecgi', + #HASH => $fill_in + ); } diff --git a/fs_selfservice/FS-SelfService/cgi/svc_acct.html b/fs_selfservice/FS-SelfService/cgi/svc_acct.html new file mode 100644 index 000000000..abed8786e --- /dev/null +++ b/fs_selfservice/FS-SelfService/cgi/svc_acct.html @@ -0,0 +1,55 @@ +<FONT SIZE=4>Setup <%= $svc %></FONT><BR><BR> + +<%= if ( $error ) { + $OUT .= qq!<FONT SIZE="+1" COLOR="#ff0000">Error setting up $svc: $error!. + '</FONT><BR><BR>'; +} ''; %> +<FORM ACTION="<%= $selfurl %>" METHOD=POST> +<INPUT TYPE="hidden" NAME="session" VALUE="<%= $session_id %>"> +<INPUT TYPE="hidden" NAME="action" VALUE="process_svc_acct"> +<INPUT TYPE="hidden" NAME="custnum" VALUE="<%= $custnum %>"> +<INPUT TYPE="hidden" NAME="pkgnum" VALUE="<%= $pkgnum %>"> +<INPUT TYPE="hidden" NAME="svcpart" VALUE="<%= $svcpart %>"> +<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#cccccc"> +<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> +</TR> +ENDOUT + } else { + $OUT .= '<INPUT TYPE="hidden" NAME="sec_phrase" VALUE="">'; + } +%> +<%= + if ( @svc_acct_pop ) { + $OUT .= '<TR><TD ALIGN="right">Access number</TD><TD>'. + popselector( 'popnum' => $popnum, + 'pops' => \@svc_acct_pop, + 'init_popstate' => $init_popstate, + 'popac' => $popac, + 'acstate' => $acstate, + ). + '</TD></TR>'; + } else { + $OUT .= popselector(popnum=>$popnum, pops=>\@svc_acct_pop); + } +%> +</TABLE> +<INPUT TYPE="submit" VALUE="Setup"> +</FORM> diff --git a/fs_selfservice/FS-SelfService/cgi/view_customer.html b/fs_selfservice/FS-SelfService/cgi/view_customer.html index e4e9be250..11e4432d0 100644 --- a/fs_selfservice/FS-SelfService/cgi/view_customer.html +++ b/fs_selfservice/FS-SelfService/cgi/view_customer.html @@ -1,10 +1,9 @@ -<HTML><HEAD><TITLE>View Customer</TITLE></HEAD> -<BODY BGCOLOR="#eeeeee"><FONT SIZE=5>View Customer</FONT><BR><BR> +<HTML><HEAD><TITLE>Reseller</TITLE></HEAD> +<BODY BGCOLOR="#eeeeee"><FONT SIZE=5>Reseller</FONT><BR><BR> <%= $url = "$selfurl?session=$session_id;action="; ''; %> -<TABLE BORDER=0 CELLPADDING=4><TR><TD VALIGN="top" HEIGHT=384 BGCOLOR="#dddddd"> -<A HREF="<%= $url %>agent_main">Reseller Main</A><BR> -<!-- <A HREF="<%= $url %>other">SomethingElse</A><BR> --> -</TD><TD VALIGN="top"> +<TABLE BORDER=0 CELLPADDING=4><TR> +<%= include('agent_menu') %> +<TD VALIGN="top"> <%= $message ? "<FONT SIZE=\"+2\"><B>$message</B></FONT><BR><BR>" @@ -13,67 +12,13 @@ <%= $small_custview %> -<BR>Purchase additional package -<FORM ACTION="<%= $selfurl %>" METHOD=POST> -<INPUT TYPE="hidden" NAME="session" VALUE="<%= $session_id %>"> -<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"><OPTION VALUE=""> +<BR> - <%= - foreach my $part_pkg ( @part_pkg ) { - $OUT .= '<OPTION VALUE="'. $part_pkg->{'pkgpart'}. '"'; - $OUT .= ' SELECTED' if $pkgpart && $part_pkg->{'pkgpart'} == $pkgpart; - $OUT .= '>'. $part_pkg->{'pkg'}; - } - %> +<TABLE BORDER=0 CELLPADDING=4><TR> +<%= include('agent_customer_menu') %> +<TD VALIGN="top"> - </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> -</TR> -ENDOUT - } else { - $OUT .= '<INPUT TYPE="hidden" NAME="sec_phrase" VALUE="">'; - } -%> -<%= - if ( @svc_acct_pop ) { - $OUT .= '<TR><TD ALIGN="right">Access number</TD><TD>'. - popselector( 'popnum' => $popnum, - 'pops' => \@svc_acct_pop, - 'init_popstate' => $init_popstate, - 'popac' => $popac, - 'acstate' => $acstate, - ). - '</TD></TR>'; - } else { - $OUT .= popselector(popnum=>$popnum, pops=>\@svc_acct_pop); - } -%> -</TABLE> -<INPUT TYPE="submit" VALUE="Purchase"> -</FORM> +</TD></TR></TABLE> </TD></TR></TABLE> <HR> |