freeside/fs_selfservice/FS-SelfService/cgi agent.cgi,NONE,1.1 agent_login.html,NONE,1.1 agent_main.html,NONE,1.1 signup.html,NONE,1.1 cvv2.html,NONE,1.1 cvv2.png,NONE,1.1 cvv2_amex.png,NONE,1.1 list_customers.html,NONE,1.1 view_customer.html,NONE,1.1
ivan
ivan at pouncequick.420.am
Thu Jun 10 05:31:34 PDT 2004
Update of /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi
In directory pouncequick:/tmp/cvs-serv23020/fs_selfservice/FS-SelfService/cgi
Added Files:
agent.cgi agent_login.html agent_main.html signup.html
cvv2.html cvv2.png cvv2_amex.png list_customers.html
view_customer.html
Log Message:
agent interface
--- NEW FILE: cvv2.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: cvv2_amex.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: signup.html ---
<HTML><HEAD><TITLE><%= $agent || 'ISP' %> Signup form</TITLE></HEAD>
<BODY BGCOLOR="#e8e8e8" onUnload="myclose()">
<script language="JavaScript"><!--
var mywindow = -1;
function myopen(filename,windowname,properties) {
myclose();
mywindow = window.open(filename,windowname,properties);
}
function myclose() {
if ( mywindow != -1 )
mywindow.close();
mywindow = -1
}
//--></script>
<FONT SIZE=7><%= $agent || 'ISP' %> Signup form</FONT><BR><BR>
<FONT SIZE="+1" COLOR="#ff0000"><%= $error %></FONT>
<FORM ACTION="<%= $selfurl %>" METHOD=POST>
<INPUT TYPE="hidden" NAME="session" VALUE="<%= $session_id %>">
<INPUT TYPE="hidden" NAME="action" VALUE="process_signup">
<INPUT TYPE="hidden" NAME="ref" VALUE="<%= $referral_custnum %>">
<INPUT TYPE="hidden" NAME="ss" VALUE="">
Where did you hear about our service? <SELECT NAME="refnum">
<%=
$OUT .= '<OPTION VALUE="">' unless $refnum;
foreach my $part_referral ( @part_referral ) {
$OUT .= '<OPTION VALUE="'. $part_referral->{'refnum'}. '"';
$OUT .= ' SELECTED' if $part_referral->{'refnum'} eq $refnum;
$OUT .= '>'. $part_referral->{'referral'};
}
%>
</SELECT><BR><BR>
Contact Information
<TABLE BGCOLOR="#c0c0c0" BORDER=0 CELLSPACING=0 WIDTH="100%">
<TR>
<TH ALIGN="right"><font color="#ff0000">*</font>Contact name<BR>(last, first)</TH>
<TD COLSPAN=5><INPUT TYPE="text" NAME="last" VALUE="<%= $last %>">,
<INPUT TYPE="text" NAME="first" VALUE="<%= $first %>"></TD>
</TR>
<TR>
<TD ALIGN="right">Company</TD>
<TD COLSPAN=5><INPUT TYPE="text" NAME="company" SIZE=70 VALUE="<%= $company %>"></TD>
</TR>
<TR>
<TH ALIGN="right"><font color="#ff0000">*</font>Address</TH>
<TD COLSPAN=5><INPUT TYPE="text" NAME="address1" SIZE=70 VALUE="<%= $address1 %>"></TD>
</TR>
<TR>
<TD ALIGN="right"> </TD>
<TD COLSPAN=5><INPUT TYPE="text" NAME="address2" SIZE=70 VALUE="<%= $address2 %>"></TD>
</TR>
<TR>
<TH ALIGN="right"><font color="#ff0000">*</font>City</TH>
<TD><INPUT TYPE="text" NAME="city" VALUE="<%= $city %>"></TD>
<TH ALIGN="right"><font color="#ff0000">*</font>State/Country</TH>
<TD>
<%=
($county_html, $state_html, $country_html) =
regionselector( {
selected_county => $county,
selected_state => $state,
selected_country => $country,
default_state => $statedefault,
default_country => $countrydefault,
locales => \@cust_main_county,
} );
"$county_html $state_html";
%>
</TD>
<TH><font color="#ff0000">*</font>Zip</TH>
<TD><INPUT TYPE="text" NAME="zip" SIZE=10 VALUE="<%= $zip %>"></TD>
</TR>
<TR>
<TH ALIGN="right"><font color="#ff0000">*</font>Country</TH>
<TD><%= $country_html %></TD>
<TR>
<TD ALIGN="right">Day Phone</TD>
<TD COLSPAN=5><INPUT TYPE="text" NAME="daytime" VALUE="<%= $daytime %>" SIZE=18></TD>
</TR>
<TR>
<TD ALIGN="right">Night Phone</TD>
<TD COLSPAN=5><INPUT TYPE="text" NAME="night" VALUE="<%= $night %>" SIZE=18></TD>
</TR>
<TR>
<TD ALIGN="right">Fax</TD>
<TD COLSPAN=5><INPUT TYPE="text" NAME="fax" VALUE="<%= $fax %>" SIZE=12></TD>
</TR>
</TABLE><font color="#ff0000">*</font> required fields<BR>
<BR>Billing information<TABLE BGCOLOR="#c0c0c0" BORDER=0 CELLSPACING=0 WIDTH="100%">
<TR><TD>
<%=
$OUT .= '<INPUT TYPE="checkbox" NAME="invoicing_list_POST" VALUE="POST"';
my @invoicing_list = split(', ', $invoicing_list );
$OUT .= ' CHECKED'
if ! @invoicing_list || grep { $_ eq 'POST' } @invoicing_list;
$OUT .= '>';
%>
Postal mail invoice
</TD></TR>
<TR><TD>Email invoice <INPUT TYPE="text" NAME="invoicing_list" VALUE="<%= join(', ', grep { $_ ne 'POST' } split(', ', $invoicing_list ) ) %>">
</TD></TR>
<%= scalar(@payby) > 1 ? '<TR><TD>Billing type</TD></TR>' : '' %>
</TABLE>
<TABLE BGCOLOR="#c0c0c0" BORDER=1 WIDTH="100%">
<TR>
<%=
my $cardselect = '<SELECT NAME="CARD_type"><OPTION></OPTION>';
my %types = (
'VISA' => 'VISA card',
'MasterCard' => 'MasterCard',
'Discover' => 'Discover card',
'American Express' => 'American Express card',
);
foreach ( keys %types ) {
$selected = $CARD_type eq $types{$_} ? 'SELECTED' : '';
$cardselect .= qq!<OPTION $selected VALUE="$types{$_}">$_</OPTION>!;
}
$cardselect .= '</SELECT>';
my %payby = (
'CARD' => qq!Credit card<BR><font color="#ff0000">*</font>$cardselect<INPUT TYPE="text" NAME="CARD_payinfo" VALUE="" MAXLENGTH=19><BR><font color="#ff0000">*</font>Exp !. expselect("CARD"). qq!<BR><font color="#ff0000">*</font>Name on card<BR><INPUT TYPE="text" NAME="CARD_payname" VALUE="">!,
'DCRD' => qq!Credit card<BR><font color="#ff0000">*</font>$cardselect<INPUT TYPE="text" NAME="DCRD_payinfo" VALUE="" MAXLENGTH=19><BR><font color="#ff0000">*</font>Exp !. expselect("DCRD"). qq!<BR><font color="#ff0000">*</font>Name on card<BR><INPUT TYPE="text" NAME="DCRD_payname" VALUE="">!,
'CHEK' => qq!Electronic check<BR>${r}Account number <INPUT TYPE="text" NAME="CHEK_payinfo1" VALUE="" MAXLENGTH=10><BR>${r}ABA/Routing code <INPUT TYPE="text" NAME="CHEK_payinfo2" VALUE="" SIZE=10 MAXLENGTH=9><INPUT TYPE="hidden" NAME="CHEK_month" VALUE="12"><INPUT TYPE="hidden" NAME="CHEK_year" VALUE="2037"><BR>${r}Bank name <INPUT TYPE="text" NAME="CHEK_payname" VALUE="">!,
'DCHK' => qq!Electronic check<BR>${r}Account number <INPUT TYPE="text" NAME="DCHK_payinfo1" VALUE="" MAXLENGTH=10><BR>${r}ABA/Routing code <INPUT TYPE="text" NAME="DCHK_payinfo2" VALUE="" SIZE=10 MAXLENGTH=9><INPUT TYPE="hidden" NAME="DCHK_month" VALUE="12"><INPUT TYPE="hidden" NAME="DCHK_year" VALUE="2037"><BR>${r}Bank name <INPUT TYPE="text" NAME="DCHK_payname" VALUE="">!,
'LECB' => qq!Phone bill billing<BR>${r}Phone number <INPUT TYPE="text" BANE="LECB_payinfo" VALUE="" MAXLENGTH=15 SIZE=16><INPUT TYPE="hidden" NAME="LECB_month" VALUE="12"><INPUT TYPE="hidden" NAME="LECB_year" VALUE="2037"><INPUT TYPE="hidden" NAME="LECB_payname" VALUE="">!,
'BILL' => qq!Billing<BR>P.O. <INPUT TYPE="text" NAME="BILL_payinfo" VALUE=""><BR><font color="#ff0000">*</font>Exp !. expselect("BILL", "12-2037"). qq!<BR><font color="#ff0000">*</font>Attention<BR><INPUT TYPE="text" NAME="BILL_payname" VALUE="Accounts Payable">!,
'COMP' => qq!Complimentary<BR><font color="#ff0000">*</font>Approved by<INPUT TYPE="text" NAME="COMP_payinfo" VALUE=""><BR><font color="#ff0000">*</font>Exp !. expselect("COMP"),
'PREPAY' => qq!Prepaid card<BR><font color="#ff0000">*</font><INPUT TYPE="text" NAME="PREPAY_payinfo" VALUE="" MAXLENGTH=80>!,
);
if ( $cvv_enabled ) {
foreach my $payby ( grep { exists $payby{$_} } qw(CARD DCRD) ) { #1.4/1.5
$payby{$payby} .= qq!<BR>CVV2 (<A HREF="javascript:myopen('cvv2.html','cvv2','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=480,height=288')">help</A>) <INPUT TYPE="text" NAME=${payby}_paycvv VALUE="" SIZE=4 MAXLENGTH=4>!;
}
}
my( $account, $aba ) = split('@', $payinfo);
my %paybychecked = (
'CARD' => qq!Credit card<BR><font color="#ff0000">*</font>$cardselect<INPUT TYPE="text" NAME="CARD_payinfo" VALUE="$payinfo" MAXLENGTH=19><BR><font color="#ff0000">*</font>Exp !. expselect("CARD", $paydate). qq!<BR><font color="#ff0000">*</font>Name on card<BR><INPUT TYPE="text" NAME="CARD_payname" VALUE="$payname">!,
'DCRD' => qq!Credit card<BR><font color="#ff0000">*</font>$cardselect<INPUT TYPE="text" NAME="DCRD_payinfo" VALUE="$payinfo" MAXLENGTH=19><BR><font color="#ff0000">*</font>Exp !. expselect("DCRD", $paydate). qq!<BR><font color="#ff0000">*</font>Name on card<BR><INPUT TYPE="text" NAME="DCRD_payname" VALUE="$payname">!,
'CHEK' => qq!Electronic check<BR>${r}Account number <INPUT TYPE="text" NAME="CHEK_payinfo1" VALUE="$account" MAXLENGTH=10><BR>${r}ABA/Routing code <INPUT TYPE="text" NAME="CHEK_payinfo2" VALUE="$aba" SIZE=10 MAXLENGTH=9><INPUT TYPE="hidden" NAME="CHEK_month" VALUE="12"><INPUT TYPE="hidden" NAME="CHEK_year" VALUE="2037"><BR>${r}Bank name <INPUT TYPE="text" NAME="CHEK_payname" VALUE="$payname">!,
'DCHK' => qq!Electronic check<BR>${r}Account number <INPUT TYPE="text" NAME="DCHK_payinfo1" VALUE="$account" MAXLENGTH=10><BR>${r}ABA/Routing code <INPUT TYPE="text" NAME="DCHK_payinfo2" VALUE="$aba" SIZE=10 MAXLENGTH=9><INPUT TYPE="hidden" NAME="DCHK_month" VALUE="12"><INPUT TYPE="hidden" NAME="DCHK_year" VALUE="2037"><BR>${r}Bank name <INPUT TYPE="text" NAME="DCHK_payname" VALUE="$payname">!,
'LECB' => qq!Phone bill billing<BR>${r}Phone number <INPUT TYPE="text" BANE="LECB_payinfo" VALUE="$payinfo" MAXLENGTH=15 SIZE=16><INPUT TYPE="hidden" NAME="LECB_month" VALUE="12"><INPUT TYPE="hidden" NAME="LECB_year" VALUE="2037"><INPUT TYPE="hidden" NAME="LECB_payname" VALUE="">!,
'BILL' => qq!Billing<BR>P.O. <INPUT TYPE="text" NAME="BILL_payinfo" VALUE="$payinfo"><BR><font color="#ff0000">*</font>Exp !. expselect("BILL", $paydate). qq!<BR><font color="#ff0000">*</font>Attention<BR><INPUT TYPE="text" NAME="BILL_payname" VALUE="$payname">!,
'COMP' => qq!Complimentary<BR><font color="#ff0000">*</font>Approved by<INPUT TYPE="text" NAME="COMP_payinfo" VALUE="$payinfo"><BR><font color="#ff0000">*</font>Exp !. expselect("COMP", $paydate),
'PREPAY' => qq!Prepaid card<BR><font color="#ff0000">*</font><INPUT TYPE="text" NAME="PREPAY_payinfo" VALUE="$payinfo" MAXLENGTH=80>!,
);
if ( $cvv_enabled ) {
foreach my $payby ( grep { exists $payby{$_} } qw(CARD DCRD) ) { #1.4/1.5
$paybychecked{$payby} .= qq!<BR>CVV2 (<A HREF="javascript:myopen('cvv2.html','cvv2','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=480,height=288')">help</A>) <INPUT TYPE="text" NAME=${payby}_paycvv VALUE="$paycvv" SIZE=4 MAXLENGTH=4>!;
}
}
for (@payby) {
if ( scalar(@payby) == 1) {
$OUT .= '<TD VALIGN=TOP>'.
qq!<INPUT TYPE="hidden" NAME="payby" VALUE="$_">!.
"$paybychecked{$_}</TD>";
} else {
$OUT .= qq!<TD VALIGN=TOP><INPUT TYPE="radio" NAME="payby" VALUE="$_"!;
if ($payby eq $_) {
$OUT .= qq! CHECKED> $paybychecked{$_}</TD>!;
} else {
$OUT .= qq!> $payby{$_}</TD>!;
}
}
}
%>
</TR></TABLE><font color="#ff0000">*</font> required fields for each billing type
<BR><BR>First package
<TABLE BGCOLOR="#c0c0c0" BORDER=0 CELLSPACING=0 WIDTH="100%">
<TR>
<TD COLSPAN=2><SELECT NAME="pkgpart"><OPTION VALUE="">(none)
<%=
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>
<BR><BR><INPUT TYPE="submit" VALUE="Signup">
</FORM></BODY></HTML>
--- NEW FILE: cvv2.html ---
<HTML>
<HEAD>
<TITLE>
CVV2 information
</TITLE>
</HEAD>
<BODY BGCOLOR="#e8e8e8">
The CVV2 number (also called CVC2 or CID) is a three- or four-digit
security code used to reduce credit card fraud.<BR><BR>
<TABLE BORDER=0 CELLSPACING=4>
<TR>
<TH>Visa / MasterCard / Discover</TH>
<TH>American Express</TH>
</TR>
<TR>
<TD>
<IMG BORDER=0 ALT="Visa/MasterCard/Discover" SRC="cvv2.png">
</TD>
<TD>
<IMG BORDER=0 ALT="American Express" SRC="cvv2_amex.png">
</TD>
</TABLE>
<CENTER><A HREF="javascript:close()">(close window)</A></CENTER>
</BODY>
</HTML>
--- NEW FILE: agent_login.html ---
<HTML><HEAD><TITLE>Reseller Login</TITLE></HEAD>
<BODY BGCOLOR="#e8e8e8"><FONT SIZE=5>Reseller Login</FONT><BR><BR>
<FONT SIZE="+1" COLOR="#ff0000"><%= $error %></FONT>
<FORM ACTION="<%= $self_url %>" METHOD=POST>
<INPUT TYPE="hidden" NAME="session" VALUE="login">
<TABLE BGCOLOR="#c0c0c0" BORDER=0 CELLSPACING=2 CELLPADDING=0>
<TR>
<TH ALIGN="right">Username </TH>
<TD>
<INPUT TYPE="text" NAME="username" VALUE="<%= $username %>">
</TD>
</TR>
<TR>
<TH ALIGN="right">Password </TH>
<TD>
<INPUT TYPE="password" NAME="password">
</TD>
</TR>
</TABLE>
<BR><BR><INPUT TYPE="submit" VALUE="Login">
</FORM></BODY></HTML>
--- NEW FILE: agent.cgi ---
#!/usr/bin/perl -Tw
#some false laziness w/selfservice.cgi
use strict;
use vars qw($cgi $session_id $form_max $template_dir);
use subs qw(do_template);
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use Business::CreditCard;
use Text::Template;
use FS::SelfService qw( agent_login agent_info
agent_list_customers
signup_info new_customer
customer_info order_pkg
);
$template_dir = '.';
$form_max = 255;
$cgi = new CGI;
unless ( defined $cgi->param('session') ) {
do_template('agent_login',{});
exit;
}
if ( $cgi->param('session') eq 'login' ) {
$cgi->param('username') =~ /^\s*([a-z0-9_\-\.\&]{0,$form_max})\s*$/i
or die "illegal username";
my $username = $1;
$cgi->param('password') =~ /^(.{0,$form_max})$/
or die "illegal password";
my $password = $1;
my $rv = agent_login(
'username' => $username,
'password' => $password,
);
if ( $rv->{error} ) {
do_template('agent_login', {
'error' => $rv->{error},
'username' => $username,
} );
exit;
} else {
$cgi->param('session' => $rv->{session_id} );
$cgi->param('action' => 'agent_main' );
}
}
$session_id = $cgi->param('session');
$cgi->param('action') =~
/^(agent_main|signup|process_signup|list_customers|view_customer|process_order_pkg)$/
or die "unknown action ". $cgi->param('action');
my $action = $1;
warn "running $action\n";
my $result = eval "&$action();";
die $@ if $@;
if ( $result->{error} eq "Can't resume session" ) { #ick
do_template('agent_login',{});
exit;
}
warn "processing template $action\n";
do_template($action, {
'session_id' => $session_id,
%{$result}
});
#--
sub agent_main { agent_info( 'session_id' => $session_id ); }
sub signup { signup_info( 'session_id' => $session_id ); }
sub process_signup {
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 $error = '';
#some false laziness w/signup.cgi
my $payby = $cgi->param('payby');
if ( $payby eq 'CHEK' || $payby eq 'DCHK' ) {
#$payinfo = join('@', map { $cgi->param( $payby. "_payinfo$_" ) } (1,2) );
$cgi->param('payinfo' => $cgi->param($payby. '_payinfo1'). '@'.
$cgi->param($payby. '_payinfo2')
);
} else {
$cgi->param('payinfo' => $cgi->param( $payby. '_payinfo' ) );
}
$cgi->param('paydate' => $cgi->param( $payby. '_month' ). '-'.
$cgi->param( $payby. '_year' )
);
$cgi->param('payname' => $cgi->param( $payby. '_payname' ) );
$cgi->param('paycvv' => defined $cgi->param( $payby. '_paycvv' )
? $cgi->param( $payby. '_paycvv' )
: ''
);
if ( $cgi->param('invoicing_list') ) {
$cgi->param('invoicing_list' => $cgi->param('invoicing_list'). ', POST')
if $cgi->param('invoicing_list_POST');
} else {
$cgi->param('invoicing_list' => 'POST' );
}
if ( $cgi->param('_password') ne $cgi->param('_password2') ) {
$error = $init_data->{msgcat}{passwords_dont_match}; #msgcat
$cgi->param('_password', '');
$cgi->param('_password2', '');
}
if ( $payby =~ /^(CARD|DCRD)$/ && $cgi->param('CARD_type') ) {
my $payinfo = $cgi->param('payinfo');
$payinfo =~ s/\D//g;
$payinfo =~ /^(\d{13,16})$/
or $error ||= $init_data->{msgcat}{invalid_card}; #. $self->payinfo;
$payinfo = $1;
validate($payinfo)
or $error ||= $init_data->{msgcat}{invalid_card}; #. $self->payinfo;
cardtype($payinfo) eq $cgi->param('CARD_type')
or $error ||= $init_data->{msgcat}{not_a}. $cgi->param('CARD_type');
}
unless ( $error ) {
my $rv = new_customer ( {
'session_id' => $session_id,
map { $_ => $cgi->param($_) }
qw( last first ss company
address1 address2 city county state zip country
daytime night fax
payby payinfo paycvv paydate payname invoicing_list
pkgpart username sec_phrase _password popnum refnum
),
grep { /^snarf_/ } $cgi->param
} );
$error = $rv->{'error'};
}
if ( $error ) {
$action = 'signup';
my $r = {
$cgi->Vars,
%{$init_data},
'error' => $error,
};
#warn join('\n', map "$_ => $r->{$_}", keys %$r )."\n";
$r;
} else {
$action = 'agent_main';
my $agent_info = agent_info( 'session_id' => $session_id );
$agent_info->{'message'} = 'Signup sucessful';
$agent_info;
}
}
sub list_customers {
agent_list_customers( 'session_id' => $session_id,
map { $_ => $cgi->param($_) }
grep defined($cgi->param($_)),
qw(prospect active susp cancel)
);
}
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 process_order_pkg {
my $results = order_pkg (
'agent_session_id' => $session_id,
map { $_ => $cgi->param($_) }
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.'
};
}
#--
sub do_template {
my $name = shift;
my $fill_in = shift;
#warn join(' / ', map { "$_=>".$fill_in->{$_} } keys %$fill_in). "\n";
$cgi->delete_all();
$fill_in->{'selfurl'} = $cgi->self_url;
$fill_in->{'cgi'} = \$cgi;
my $template = new Text::Template( TYPE => 'FILE',
SOURCE => "$template_dir/$name.html",
DELIMITERS => [ '<%=', '%>' ],
UNTAINT => 1, )
or die $Text::Template::ERROR;
print $cgi->header( '-expires' => 'now' ),
$template->fill_in( PACKAGE => 'FS::SelfService::_agentcgi',
HASH => $fill_in
);
}
package FS::SelfService::_agentcgi;
use FS::SelfService qw(regionselector expselect popselector);
--- NEW FILE: agent_main.html ---
<HTML><HEAD><TITLE>Reseller Main</TITLE></HEAD>
<BODY BGCOLOR="#eeeeee"><FONT SIZE=5>Reseller Main</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">
<%= $message
? "<FONT SIZE=\"+2\"><B>$message</B></FONT>"
: "Hello $agent!"
%><BR><BR>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#eeeeee">
<TR><TH BGCOLOR="#cccccc">Customer summary</TH></TR>
<TR><TD BGCOLOR="#dddddd">
<B><%= $num_prospect %></B>
<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>
<BR><FONT COLOR="#FF9900"><B><%= $num_susp %></B></FONT>
<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>
</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>
</BODY></HTML>
--- NEW FILE: list_customers.html ---
<HTML><HEAD><TITLE>Reseller Main</TITLE></HEAD>
<BODY BGCOLOR="#eeeeee"><FONT SIZE=5>Reseller Main</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">
<%=
if ( @customers ) {
$OUT .= '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#eeeeee">'.
'<TR><TH BGCOLOR="#cccccc" COLSPAN=3>Customers</TH><TD>';
my $col1 = "ffffff";
my $col2 = "dddddd";
my $col = $col1;
foreach my $customer ( @customers ) {
my $td = qq!<TD BGCOLOR="#$col">!;
my $a = qq!<A HREF="${url}view_customer;custnum=!.
$customer->{'custnum'}. '">';
$OUT .=
'<TR>'.
"$td<FONT COLOR=\"". $customer->{'statuscolor'}. '">'.
ucfirst($customer->{'status'}). "</TD>". "$td</TD>".
"$td$a". $customer->{'name'}. "</A></TD>".
'</TR>';
#"$td</TD>".
$col = $col eq $col1 ? $col2 : $col1;
}
$OUT .= '</TABLE>';
} else {
$OUT .= 'No customers.<BR><BR>';
}
%>
</TD></TR></TABLE>
<HR>
<FONT SIZE="-2">powered by <a href="http://www.sisd.com/freeside">freeside</a></FONT>
</BODY></HTML>
--- NEW FILE: view_customer.html ---
<HTML><HEAD><TITLE>View Customer</TITLE></HEAD>
<BODY BGCOLOR="#eeeeee"><FONT SIZE=5>View Customer</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">
<%= $message
? "<FONT SIZE=\"+2\"><B>$message</B></FONT><BR><BR>"
: ''
%>
<%= $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="">
<%=
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 TYPE="submit" VALUE="Purchase">
</FORM>
</TD></TR></TABLE>
<HR>
<FONT SIZE="-2">powered by <a href="http://www.sisd.com/freeside">freeside</a></FONT>
</BODY></HTML>
More information about the freeside-commits
mailing list