freeside/fs_selfservice/FS-SelfService/cgi myaccount_menu.html,NONE,1.1 logout.html,NONE,1.1 provision.html,NONE,1.1 provision_svc_acct.html,NONE,1.1 process_svc_acct.html,NONE,1.1 delete_svc.html,NONE,1.1 myaccount.html,1.4,1.5 view_invoice.html,1.2,1.3 payment_results.html,1.1,1.2 make_payment.html,1.10,1.11 selfservice.cgi,1.7,1.8 agent.cgi,1.4,1.5

ivan ivan at pouncequick.420.am
Thu Jul 15 15:40:06 PDT 2004


Update of /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi
In directory pouncequick:/tmp/cvs-serv27096/fs_selfservice/FS-SelfService/cgi

Modified Files:
	myaccount.html view_invoice.html payment_results.html 
	make_payment.html selfservice.cgi agent.cgi 
Added Files:
	myaccount_menu.html logout.html provision.html 
	provision_svc_acct.html process_svc_acct.html delete_svc.html 
Log Message:
big update for customer self-service: add provisioning/unprovisioning of purchased services, like fs_selfadmin

Index: make_payment.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi/make_payment.html,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- make_payment.html	30 Jun 2004 14:33:35 -0000	1.10
+++ make_payment.html	15 Jul 2004 22:40:00 -0000	1.11
@@ -1,10 +1,9 @@
 <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><TD VALIGN="top" HEIGHT=384 BGCOLOR="#dddddd">
-<A HREF="<%= $url %>myaccount">MyAccount</A><BR>
-<!-- <A HREF="<%= $url %>other">SomethingElse</A><BR> -->
-</TD><TD VALIGN="top">
+<TABLE BORDER=0 CELLPADDING=4><TR>
+<%= include('myaccount_menu') %>
+<TD VALIGN="top">
 <FONT SIZE=4>Make a payment</FONT><BR><BR>
 <FORM NAME="OneTrueForm" METHOD="POST" ACTION="<%=$selfurl%>" onSubmit="document.OneTrueForm.process.disabled=true">
 <INPUT TYPE="hidden" NAME="session" VALUE="<%=$session_id%>">

--- NEW FILE: provision_svc_acct.html ---
<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">
<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="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>

</TD></TR></TABLE>
<HR>
<FONT SIZE="-2">powered by <a href="http://www.sisd.com/freeside">freeside</a></FONT>
</BODY></HTML>


--- NEW FILE: logout.html ---
<HTML><HEAD><TITLE>MyAccount</TITLE></HEAD>
<BODY BGCOLOR="#eeeeee"><FONT SIZE=5>MyAccount</FONT><BR><BR>
You have been logged out.
</BODY></HTML>


--- NEW FILE: delete_svc.html ---
<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">

<%= 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>


--- NEW FILE: myaccount_menu.html ---
<%= $url = "$selfurl?session=$session_id;action="; ''; %>
<TD VALIGN="top" HEIGHT=384 BGCOLOR="#dddddd">

<A HREF="<%= $url %>myaccount">Overview</A><BR><BR>
<!--A HREF="<%= $url %>change_bill"-->Change&nbsp;payment&nbsp;info</A>&nbsp;*<BR><BR>
<!--A HREF="<%= $url %>change_ship"-->Change&nbsp;service&nbsp;address</A>&nbsp;*<BR><BR>
<A HREF="<%= $url %>provision">Setup&nbsp;my&nbsp;services</A><BR><BR>
<!--A HREF="<%= $url %>order"-->Purchase&nbsp;additional&nbsp;package</A>&nbsp;*<BR><BR>
<!--<A HREF="<%= $url %>pw_list">Change&nbsp;password(s)</A>&nbsp;*<BR><BR>-->
<A HREF="passwd.html">Change&nbsp;password(s)</A><BR><BR>
<A HREF="<%= $url %>logout">Logout</A><BR><BR>
*&nbsp;coming&nbsp;soon
</TD>

--- NEW FILE: process_svc_acct.html ---
<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">

<FONT SIZE=4><%= $svc %> setup sucessfully.</FONT>

</TD></TR></TABLE>
<HR>
<FONT SIZE="-2">powered by <a href="http://www.sisd.com/freeside">freeside</a></FONT>
</BODY></HTML>


Index: myaccount.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi/myaccount.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- myaccount.html	18 May 2003 11:44:37 -0000	1.4
+++ myaccount.html	15 Jul 2004 22:40:00 -0000	1.5
@@ -1,10 +1,9 @@
 <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><TD VALIGN="top" HEIGHT=384 BGCOLOR="#dddddd">
-<A HREF="<%= $url %>myaccount">MyAccount</A><BR>
-<!-- <A HREF="<%= $url %>other">SomethingElse</A><BR> -->
-</TD><TD VALIGN="top">
+<TABLE BORDER=0 CELLPADDING=4><TR>
+<%= include('myaccount_menu') %>
+<TD VALIGN="top">
 
 Hello <%= $name %>!<BR><BR>
 <%= $small_custview %>
@@ -15,7 +14,7 @@
 <%=
   if ( @open_invoices ) {
     $OUT .= '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#eeeeee">'.
-            '<TR><TH BGCOLOR="#ff3333" COLSPAN=5>Open Invoices</TH><TD>';
+            '<TR><TH BGCOLOR="#ff6666" COLSPAN=5>Open Invoices</TH></TR>';
     my $link = qq!<A HREF="<%= $url %>myaccount!;
     my $col1 = "ffffff";
     my $col2 = "dddddd";

Index: agent.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi/agent.cgi,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- agent.cgi	9 Jul 2004 11:45:59 -0000	1.4
+++ agent.cgi	15 Jul 2004 22:40:00 -0000	1.5
@@ -221,6 +221,10 @@
 
   my $results = '';
 
+  unless ( length($cgi->param('_password')) ) {
+    my $init_data = signup_info( 'session_id' => $session_id );
+    $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} };

Index: selfservice.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi/selfservice.cgi,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- selfservice.cgi	20 May 2003 05:43:47 -0000	1.7
+++ selfservice.cgi	15 Jul 2004 22:40:00 -0000	1.8
@@ -6,8 +6,11 @@
 use CGI;
 use CGI::Carp qw(fatalsToBrowser);
 use Text::Template;
-use FS::SelfService qw( login customer_info invoice payment_info
-                        process_payment );
+use FS::SelfService qw( login customer_info invoice
+                        payment_info process_payment 
+                        list_pkgs
+                        part_svc_info provision_acct unprovision_svc
+                      );
 
 $template_dir = '.';
 
@@ -54,8 +57,9 @@
 
 $session_id = $cgi->param('session');
 
+#order|pw_list XXX ???
 $cgi->param('action') =~
-    /^(myaccount|view_invoice|make_payment|payment_results)$/
+    /^(myaccount|view_invoice|make_payment|payment_results|logout|change_bill|change_ship|provision|provision_svc|process_svc_acct|delete_svc)$/
   or die "unknown action ". $cgi->param('action');
 my $action = $1;
 
@@ -167,6 +171,63 @@
 
 }
 
+sub logout {
+  FS::SelfService::logout( 'session_id' => $session_id );
+}
+
+sub provision {
+  list_pkgs( 'session_id' => $session_id );
+}
+
+sub provision_svc {
+
+  my $result = part_svc_info(
+    'session_id' => $session_id,
+    map { $_ => $cgi->param($_) } qw( pkgnum svcpart ),
+  );
+  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";
+
+  $result;
+}
+
+sub process_svc_acct {
+
+  my $result = provision_acct (
+    'session_id' => $session_id,
+    map { $_ => $cgi->param($_) } qw(
+      pkgnum svcpart username _password _password2 sec_phrase popnum )
+  );
+
+  if ( exists $result->{'error'} && $result->{'error'} ) { 
+    warn "$result $result->{'error'}"; 
+    $action = 'provision_svc_acct';
+    return {
+      $cgi->Vars,
+      %{ part_svc_info( 'session_id' => $session_id,
+                        map { $_ => $cgi->param($_) } qw( pkgnum svcpart )
+                      )
+      },
+      'error' => $result->{'error'},
+    };
+  } else {
+    warn "$result $result->{'error'}"; 
+    return $result;
+  }
+
+}
+
+sub delete_svc {
+  unprovision_svc(
+    'session_id' => $session_id,
+    'svcnum'     => $cgi->param('svcnum'),
+  );
+}
+
 #--
 
 sub do_template {
@@ -175,6 +236,7 @@
 
   $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",
@@ -183,6 +245,28 @@
     or die $Text::Template::ERROR;
 
   print $cgi->header( '-expires' => 'now' ),
-        $template->fill_in( HASH => $fill_in );
+        $template->fill_in( PACKAGE => 'FS::SelfService::_selfservicecgi',
+                            HASH    => $fill_in
+                          );
+}
+
+#*FS::SelfService::_selfservicecgi::include = \&Text::Template::fill_in_file;
+
+package FS::SelfService::_selfservicecgi;
+
+#use FS::SelfService qw(regionselector expselect popselector);
+use FS::SelfService qw(popselector);
+
+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();
+
 }
 

--- NEW FILE: provision.html ---
<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">
<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&nbsp;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>';

} %>

</TD></TR></TABLE>
<HR>
<FONT SIZE="-2">powered by <a href="http://www.sisd.com/freeside">freeside</a></FONT>
</BODY></HTML>

Index: payment_results.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi/payment_results.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- payment_results.html	20 May 2003 05:43:47 -0000	1.1
+++ payment_results.html	15 Jul 2004 22:40:00 -0000	1.2
@@ -1,10 +1,9 @@
 <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><TD VALIGN="top" HEIGHT=384 BGCOLOR="#dddddd">
-<A HREF="<%= $url %>myaccount">MyAccount</A><BR>
-<!-- <A HREF="<%= $url %>other">SomethingElse</A><BR> -->
-</TD><TD VALIGN="top">
+<TABLE BORDER=0 CELLPADDING=4><TR>
+<%= include('myaccount_menu') %>
+<TD VALIGN="top">
 <FONT SIZE=4>Payment results</FONT><BR><BR>
 <%= if ( $error ) {
   $OUT .= qq!<FONT SIZE="+1" COLOR="#ff0000">Error processing your payment: $error</FONT>!;

Index: view_invoice.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi/view_invoice.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- view_invoice.html	13 May 2003 03:22:35 -0000	1.2
+++ view_invoice.html	15 Jul 2004 22:40:00 -0000	1.3
@@ -1,12 +1,9 @@
 <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><TD VALIGN="top" HEIGHT=384 BGCOLOR="#dddddd">
-<A HREF="<%= $url %>myaccount">MyAccount</A><BR>
-<!-- <A HREF="<%= $url %>other">SomethingElse</A><BR> -->
-</TD><TD VALIGN="top">
-
-<A HREF="<%= $url %>myaccount"><-- back to MyAccount</A><BR><BR>
+<TABLE BORDER=0 CELLPADDING=4><TR>
+<%= include('myaccount_menu') %>
+<TD VALIGN="top">
 
 <FONT SIZE="-1"><PRE>
 <%= $invoice_text %>




More information about the freeside-commits mailing list