[freeside-commits] freeside/fs_selfservice/FS-SelfService/cgi
myaccount_menu.html, 1.4, 1.5 selfservice.cgi, 1.16,
1.17 customer_order_pkg.html, NONE, 1.1 process_order_pkg.html,
NONE, 1.1
Jeff Finucane,420,,
jeff at wavetail.420.am
Sun Nov 26 23:11:55 PST 2006
Update of /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi
In directory wavetail:/tmp/cvs-serv23561/fs_selfservice/FS-SelfService/cgi
Modified Files:
myaccount_menu.html selfservice.cgi
Added Files:
customer_order_pkg.html process_order_pkg.html
Log Message:
order package from self-service
--- NEW FILE: process_order_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 order successful.</FONT>
</TD></TR></TABLE>
<HR>
<FONT SIZE="-2">powered by <a href="http://www.sisd.com/freeside">freeside</a></FONT>
</BODY></HTML>
Index: selfservice.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi/selfservice.cgi,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- selfservice.cgi 5 Nov 2006 18:06:33 -0000 1.16
+++ selfservice.cgi 27 Nov 2006 07:11:53 -0000 1.17
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -T
#!/usr/bin/perl -Tw
use strict;
@@ -11,7 +10,7 @@
use FS::SelfService qw( login customer_info invoice
payment_info process_payment
process_prepay
- list_pkgs
+ list_pkgs order_pkg signup_info
part_svc_info provision_acct provision_external
unprovision_svc
list_svcs myaccount_passwd
@@ -66,7 +65,7 @@
#order|pw_list XXX ???
$cgi->param('action') =~
- /^(myaccount|view_invoice|make_payment|payment_results|recharge_prepay|recharge_results|logout|change_bill|change_ship|provision|provision_svc|process_svc_acct|process_svc_external|delete_svc|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|provision|provision_svc|process_svc_acct|process_svc_external|delete_svc|change_password|process_change_password)$/
or die "unknown action ". $cgi->param('action');
my $action = $1;
@@ -76,7 +75,9 @@
my $result = eval "&$action();";
die $@ if $@;
-if ( $result->{error} eq "Can't resume session" ) { #ick
+if ( $result->{error} eq "Can't resume session"
+ || $result->{error} eq "Expired session" ) { #ick
+
do_template('login',{});
exit;
}
@@ -107,6 +108,58 @@
}
+sub customer_order_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 ),
+ ),
+ %$customer_info,
+ };
+}
+
+sub process_order_pkg {
+
+ my $results = '';
+
+ unless ( length($cgi->param('_password')) ) {
+ my $init_data = signup_info( 'customer_session_id' => $session_id );
+ $results = { 'error' => $init_data->{msgcat}{empty_password} };
+ $results = { 'error' => $init_data->{error} } if($init_data->{error});
+ }
+ if ( $cgi->param('_password') ne $cgi->param('_password2') ) {
+ my $init_data = signup_info( 'customer_session_id' => $session_id );
+ $results = { 'error' => $init_data->{msgcat}{passwords_dont_match} };
+ $results = { 'error' => $init_data->{error} } if($init_data->{error});
+ $cgi->param('_password', '');
+ $cgi->param('_password2', '');
+ }
+
+ $results ||= order_pkg (
+ 'session_id' => $session_id,
+ map { $_ => $cgi->param($_) }
+ qw( custnum pkgpart username _password _password2 sec_phrase popnum )
+ );
+
+
+ if ( $results->{'error'} ) {
+ $action = 'customer_order_pkg';
+ return {
+ $cgi->Vars,
+ %{customer_order_pkg()},
+ 'error' => '<FONT COLOR="#FF0000">'. $results->{'error'}. '</FONT>',
+ };
+ } else {
+ return $results;
+ }
+
+}
+
sub make_payment {
payment_info( 'session_id' => $session_id );
}
Index: myaccount_menu.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- myaccount_menu.html 9 Aug 2006 21:46:32 -0000 1.4
+++ myaccount_menu.html 27 Nov 2006 07:11:53 -0000 1.5
@@ -12,7 +12,8 @@
{ title=>' ' },
{ title=>'Purchase', size=>'+1', },
-# { title=>'Purchase additional package*', url=>'order', 'indent'=>2 },
+ { title=>'Purchase additional package*',
+ url=>'customer_order_pkg', 'indent'=>2 },
);
if ( 1 ) { #XXXFIXME "enable selfservice prepay features" flag or something, eventually per-pkg or something really fancy
--- NEW FILE: customer_order_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('order_pkg') %>
</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