[freeside-commits] freeside/fs_selfservice/FS-SelfService/cgi
view_usage.html, 1.2, 1.3 view_usage_details.html, NONE,
1.1 customer_change_pkg.html, NONE, 1.1 provision_list.html,
1.4, 1.5 change_pkg.html, NONE, 1.1 process_change_pkg.html,
NONE, 1.1 selfservice.cgi, 1.19, 1.20
Jeff Finucane,420,,
jeff at wavetail.420.am
Thu Jan 4 21:19:37 PST 2007
Update of /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi
In directory wavetail:/tmp/cvs-serv27044/fs_selfservice/FS-SelfService/cgi
Modified Files:
view_usage.html provision_list.html selfservice.cgi
Added Files:
view_usage_details.html customer_change_pkg.html
change_pkg.html process_change_pkg.html
Log Message:
more self-servicey stuff (change package, detailed usage)
Index: selfservice.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi/selfservice.cgi,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- selfservice.cgi 7 Dec 2006 02:40:31 -0000 1.19
+++ selfservice.cgi 5 Jan 2007 05:19:35 -0000 1.20
@@ -7,13 +7,14 @@
use CGI::Carp qw(fatalsToBrowser);
use Text::Template;
use HTML::Entities;
+use Date::Format;
use FS::SelfService qw( login customer_info invoice
payment_info process_payment
process_prepay
list_pkgs order_pkg signup_info order_recharge
part_svc_info provision_acct provision_external
- unprovision_svc
- list_svcs myaccount_passwd
+ unprovision_svc change_pkg
+ list_svcs list_svc_usage myaccount_passwd
);
$template_dir = '.';
@@ -65,7 +66,7 @@
#order|pw_list XXX ???
$cgi->param('action') =~
- /^(myaccount|view_invoice|make_payment|payment_results|recharge_prepay|recharge_results|logout|change_bill|change_ship|customer_order_pkg|process_order_pkg|process_order_recharge|provision|provision_svc|process_svc_acct|process_svc_external|delete_svc|view_usage||change_password|process_change_password)$/
+ /^(myaccount|view_invoice|make_payment|payment_results|recharge_prepay|recharge_results|logout|change_bill|change_ship|customer_order_pkg|process_order_pkg|customer_change_pkg|process_change_pkg|process_order_recharge|provision|provision_svc|process_svc_acct|process_svc_external|delete_svc|view_usage|view_usage_details|change_password|process_change_password)$/
or die "unknown action ". $cgi->param('action');
my $action = $1;
@@ -123,6 +124,24 @@
};
}
+sub customer_change_pkg {
+ my $init_data = signup_info( 'customer_session_id' => $session_id );
+ return $init_data if ( $init_data->{'error'} );
+
+ my $customer_info = customer_info( 'session_id' => $session_id );
+ return $customer_info if ( $customer_info->{'error'} );
+
+ return {
+ ( map { $_ => $init_data->{$_} }
+ qw( part_pkg security_phrase svc_acct_pop ),
+ ),
+ ( map { $_ => $cgi->param($_) }
+ qw( pkgnum pkg )
+ ),
+ %$customer_info,
+ };
+}
+
sub process_order_pkg {
my $results = '';
@@ -160,6 +179,30 @@
}
+sub process_change_pkg {
+
+ my $results = '';
+
+ $results ||= change_pkg (
+ 'session_id' => $session_id,
+ map { $_ => $cgi->param($_) }
+ qw( pkgpart pkgnum )
+ );
+
+
+ if ( $results->{'error'} ) {
+ $action = 'customer_change_pkg';
+ return {
+ $cgi->Vars,
+ %{customer_change_pkg()},
+ 'error' => '<FONT COLOR="#FF0000">'. $results->{'error'}. '</FONT>',
+ };
+ } else {
+ return $results;
+ }
+
+}
+
sub process_order_recharge {
my $results = '';
@@ -356,6 +399,15 @@
);
}
+sub view_usage_details {
+ list_svc_usage(
+ 'session_id' => $session_id,
+ 'svcnum' => $cgi->param('svcnum'),
+ 'beginning' => $cgi->param('beginning') || '',
+ 'ending' => $cgi->param('ending') || '',
+ );
+}
+
sub change_password {
list_svcs(
'session_id' => $session_id,
Index: view_usage.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi/view_usage.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- view_usage.html 7 Dec 2006 02:40:31 -0000 1.2
+++ view_usage.html 5 Jan 2007 05:19:34 -0000 1.3
@@ -19,8 +19,10 @@
<TH ALIGN="right">Total remaining</TH>
</TR>
<%= foreach my $svc ( @svcs ) {
+ my $link = "${url}view_usage_details;".
+ "svcnum=$svc->{'svcnum'};beginning=0;ending=0";
$OUT .= '<TR><TD>';
- $OUT .= $svc->{'label'}. ': '. $svc->{'value'};
+ $OUT .= qq!<A HREF="$link">!. $svc->{'label'}. ': '. $svc->{'value'}.'</A>';
$OUT .= '</TD><TD ALIGN="right">';
$OUT .= $svc->{'seconds'};
$OUT .= '</TD><TD ALIGN="right">';
--- NEW FILE: process_change_pkg.html ---
<HTML><HEAD><TITLE>MyAccount</TITLE></HEAD>
<BODY BGCOLOR="#eeeeee"><FONT SIZE=5>MyAccount</FONT><BR><BR>
<%= $url = "$selfurl?session=$session_id;action="; ''; %>
<%= include('myaccount_menu') %>
<TD VALIGN="top">
<FONT SIZE=4>Package change successful.</FONT>
</TD></TR></TABLE>
<HR>
<FONT SIZE="-2">powered by <a href="http://www.sisd.com/freeside">freeside</a></FONT>
</BODY></HTML>
--- NEW FILE: view_usage_details.html ---
<HTML><HEAD><TITLE>MyAccount</TITLE></HEAD>
<BODY BGCOLOR="#eeeeee"><FONT SIZE=5>MyAccount</FONT><BR><BR>
<%= $url = "$selfurl?session=$session_id;action="; ''; %>
<%= include('myaccount_menu') %>
<TD VALIGN="top">
<FONT SIZE=4>Service usage details</FONT><BR><BR>
<%= if ( $error ) {
$OUT .= qq!<FONT SIZE="+1" COLOR="#ff0000">$error</FONT><BR><BR>!;
} ''; %>
<TABLE WIDTH="100%">
<TR>
<TD WIDTH="50%">
<%= if ($previous < $beginning) {
$OUT .= qq!<A HREF="${url}view_usage_details;svcnum=$svcnum;beginning=!;
$OUT .= qq!$previous;ending=$beginning">Previous period</A>!;
}else{
'';
} %>
</TD>
<TD WIDTH="50%" ALIGN="right">
<%= if ($next > $ending) {
$OUT .= qq!<A HREF="${url}view_usage_details;svcnum=$svcnum;beginning=!;
$OUT .= qq!$ending;ending=$next">Next period</A>!;
}else{
'';
}%>
</TD>
</TR>
</TABLE>
<TABLE BGCOLOR="#cccccc">
<TR>
<TH ALIGN="left">Account</TH>
<TH ALIGN="right">Start Time</TH>
<TH ALIGN="right">Duration</TH>
</TR>
<%= my $total = 0;
foreach my $usage ( @usage ) {
$OUT .= '<TR><TD>';
$OUT .= $usage->{'username'};
$OUT .= '</TD><TD ALIGN="right">';
$OUT .= Date::Format::time2str('%T%P %a %b %o %Y', $usage->{'acctstarttime'});
$OUT .= '</TD><TD ALIGN="right">';
my $duration = $usage->{'acctstoptime'} - $usage->{'acctstarttime'};
$total += $duration;
my $h = int($duration/3600);
my $m = sprintf("%02d", int(($duration % 3600) / 60));
my $s = sprintf("%02d", $duration % 60);
$OUT .= "$h:$m:$s";
$OUT .= '</TD></TR>';
}
my $h = int($total/3600);
my $m = sprintf("%02d", int(($total % 3600) / 60));
my $s = sprintf("%02d", $total % 60);
$OUT .= qq!<TR><TD></TD><TD></TD><TD ALIGN="right">========</TD></TR>!;
$OUT .= qq!<TR><TD></TD><TD></TD><TD ALIGN="right">$h:$m:$s</TD></TR>!; %>
</TABLE>
<BR>
</TD></TR></TABLE>
<HR>
<FONT SIZE="-2">powered by <a href="http://www.sisd.com/freeside">freeside</a></FONT>
</BODY></HTML>
--- NEW FILE: change_pkg.html ---
<SCRIPT TYPE="text/javascript">
function enable_change_pkg () {
if ( document.ChangePkgForm.pkgpart.selectedIndex > 0 ) {
document.ChangePkgForm.submit.disabled = false;
} else {
document.ChangePkgForm.submit.disabled = true;
}
}
</SCRIPT>
<FONT SIZE=4>Purchase replacement package for "<%= $pkg; %>"</FONT><BR><BR>
<%= if ( $error ) {
$OUT .= qq!<FONT SIZE="+1" COLOR="#ff0000">$error</FONT><BR><BR>!;
} ''; %>
<FORM NAME="ChangePkgForm" ACTION="<%= $selfurl %>" METHOD=POST>
<INPUT TYPE="hidden" NAME="session" VALUE="<%= $session_id %>">
<INPUT TYPE="hidden" NAME="action" VALUE="process_change_pkg">
<INPUT TYPE="hidden" NAME="pkgnum" VALUE="<%= $pkgnum %>">
<INPUT TYPE="hidden" NAME="pkg" VALUE="<%= $pkg %>">
<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0>
<TR>
<TD COLSPAN=2><SELECT NAME="pkgpart" onChange="enable_change_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>
</TABLE>
<INPUT NAME="submit" TYPE="submit" VALUE="Purchase" disabled>
</FORM>
--- NEW FILE: customer_change_pkg.html ---
<HTML><HEAD><TITLE>MyAccount</TITLE></HEAD>
<BODY BGCOLOR="#eeeeee"><FONT SIZE=5>MyAccount</FONT><BR><BR>
<%= $url = "$selfurl?session=$session_id;action="; ''; %>
<%= include('myaccount_menu') %>
<TD VALIGN="top">
<%= include('change_pkg') %>
</TD></TR></TABLE>
<HR>
<FONT SIZE="-2">powered by <a href="http://www.sisd.com/freeside">freeside</a></FONT>
</BODY></HTML>
Index: provision_list.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi/provision_list.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- provision_list.html 9 Aug 2006 10:47:18 -0000 1.4
+++ provision_list.html 5 Jan 2007 05:19:35 -0000 1.5
@@ -16,9 +16,11 @@
) {
$OUT .= #'<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#ffffff">'.
- '<TR><TH BGCOLOR="#6666ff" COLSPAN=3>'.
- $pkg->{'pkg'}.
- '</TH></TR>';
+ '<TR><TH BGCOLOR="#6666ff" COLSPAN=2>'.
+ $pkg->{'pkg'}. '</TH><TH BGCOLOR="#6666ff" >' .
+ qq!(<A style="font-size: smaller;color: #000000" HREF="! .
+ qq!${url}customer_change_pkg;pkgnum=$pkg->{'pkgnum'};pkg=$pkg->{'pkg'}">! .
+ 'change</A>)</TH></TR>';
my $col1 = "ffffff";
my $col2 = "dddddd";
More information about the freeside-commits
mailing list