[freeside-commits] freeside/fs_selfservice/FS-SelfService/cgi header.html, NONE, 1.1 view_cdr_details.html, NONE, 1.1 view_usage.html, 1.4, 1.5 selfservice.cgi, 1.32, 1.33

Ivan,,, ivan at wavetail.420.am
Mon May 18 02:55:32 PDT 2009


Update of /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi
In directory wavetail.420.am:/tmp/cvs-serv24826/fs_selfservice/FS-SelfService/cgi

Modified Files:
	view_usage.html selfservice.cgi 
Added Files:
	header.html view_cdr_details.html 
Log Message:
basic CDR viewing from self-service, RT#4018

Index: selfservice.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi/selfservice.cgi,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- selfservice.cgi	10 Mar 2009 16:14:07 -0000	1.32
+++ selfservice.cgi	18 May 2009 09:55:29 -0000	1.33
@@ -15,7 +15,8 @@
                         list_pkgs order_pkg signup_info order_recharge
                         part_svc_info provision_acct provision_external
                         unprovision_svc change_pkg domainselector
-                        list_svcs list_svc_usage list_support_usage
+                        list_svcs
+                        list_svc_usage list_cdr_usage list_support_usage
                         myaccount_passwd
                       );
 
@@ -72,7 +73,7 @@
 
 #order|pw_list XXX ???
 $cgi->param('action') =~
-    /^(myaccount|view_invoice|make_payment|make_ach_payment|make_thirdparty_payment|payment_results|ach_payment_results|recharge_prepay|recharge_results|logout|change_bill|change_ship|change_pay|process_change_bill|process_change_ship|process_change_pay|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|view_support_details|change_password|process_change_password)$/
+    /^(myaccount|view_invoice|make_payment|make_ach_payment|make_thirdparty_payment|payment_results|ach_payment_results|recharge_prepay|recharge_results|logout|change_bill|change_ship|change_pay|process_change_bill|process_change_ship|process_change_pay|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|view_cdr_details|view_support_details|change_password|process_change_password)$/
   or die "unknown action ". $cgi->param('action');
 my $action = $1;
 
@@ -564,7 +565,7 @@
 sub view_usage {
   list_svcs(
     'session_id'  => $session_id,
-    'svcdb'       => 'svc_acct',
+    'svcdb'       => [ 'svc_acct', 'svc_phone' ],
     'ncancelled'  => 1,
   );
 }
@@ -578,6 +579,15 @@
   );
 }
 
+sub view_cdr_details {
+  list_cdr_usage(
+    'session_id'  => $session_id,
+    'svcnum'      => $cgi->param('svcnum'),
+    'beginning'   => $cgi->param('beginning') || '',
+    'ending'      => $cgi->param('ending') || '',
+  );
+}
+
 sub view_support_details {
   list_support_usage(
     '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.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- view_usage.html	1 Feb 2009 12:28:45 -0000	1.4
+++ view_usage.html	18 May 2009 09:55:29 -0000	1.5
@@ -1,24 +1,30 @@
-<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</FONT><BR><BR>
+<%= $url = "$selfurl?session=$session_id;action=";
+    @svc_acct  = grep { $_->{svcdb} eq 'svc_acct'  } @svcs;
+    @svc_phone = grep { $_->{svcdb} eq 'svc_phone' } @svcs;
+    '';
+%>
+<%= include('header') %>
 
 <%= if ( $error ) {
   $OUT .= qq!<FONT SIZE="+1" COLOR="#ff0000">$error</FONT><BR><BR>!;
 } ''; %>
 
-<TABLE BGCOLOR="#cccccc">
-  <TR>
-    <TH ALIGN="left">Account</TH>
-    <TH ALIGN="right">Time remaining</TH>
-    <TH ALIGN="right">Upload remaining</TH>
-    <TH ALIGN="right">Download remaining</TH>
-    <TH ALIGN="right">Total remaining</TH>
-  </TR>
-<%= foreach my $svc ( @svcs ) {
+<%= if ( @svc_acct ) {
+      $OUT.= '<FONT SIZE="4">Account usage</FONT><BR><BR>
+              <TABLE BGCOLOR="#cccccc">
+                <TR>
+                  <TH ALIGN="left">Account</TH>
+                  <TH ALIGN="right">Time remaining</TH>
+                  <TH ALIGN="right">Upload remaining</TH>
+                  <TH ALIGN="right">Download remaining</TH>
+                  <TH ALIGN="right">Total remaining</TH>
+                </TR>';
+    } else {
+      $OUT .= '';
+    }
+%>
+
+<%= foreach my $svc ( @svc_acct ) {
       my $link = "${url}view_usage_details;".
         "svcnum=$svc->{'svcnum'};beginning=0;ending=0";
   $OUT .= '<TR><TD>';
@@ -48,11 +54,33 @@
       $OUT .= $svc->{'recharge_totalbytes'} if $svc->{'recharge_totalbytes'};
     $OUT .= '</TD></TR>';
     }
-  } %>
+  }
+%>
 
-</TABLE>
-<BR>
+<%= scalar(@svc_acct) ? '</TABLE><BR><BR>' : '' %>
 
-</TD></TR></TABLE>
+<%= if ( @svc_phone ) {
+      $OUT.= '<FONT SIZE="4">Call usage</FONT><BR><BR>
+              <TABLE BGCOLOR="#cccccc">
+                <TR>
+                  <TH ALIGN="left">Number</TH>'; #"Account" ?
+                                                 #what else?
+      $OUT .= '</TR>';
+    } else {
+      $OUT .= '';
+    }
+%>
 
+<%= foreach my $svc_phone ( @svc_phone ) {
+      my $link = "${url}view_cdr_details;".
+        "svcnum=$svc_phone->{'svcnum'};beginning=0;ending=0";
+  $OUT .= '<TR><TD>';
+    $OUT .= qq!<A HREF="$link">!. $svc_phone->{'label'}. ': '. $svc_phone->{'value'}.'</A>';
+  $OUT .= '</TD></TR>';
+  }
+%>
+
+<%= scalar(@svc_phone) ? '</TABLE><BR><BR>' : '' %>
+
+</TD></TR></TABLE>
 <%= include('footer') %>

--- NEW FILE: view_cdr_details.html ---
<%= $url = "$selfurl?session=$session_id;action="; ''; %>
<%= include('header') %>

<FONT SIZE=4>Call usage for
<%= Date::Format::time2str('%b&nbsp;%o&nbsp;%Y', $beginning) %> -
<%= Date::Format::time2str('%b&nbsp;%o&nbsp;%Y', $ending) %>
</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_cdr_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_cdr_details;svcnum=$svcnum;beginning=!;
    $OUT .= qq!$ending;ending=$next">Next period</A>!;
    }else{
      '';
    }%>
    </TD>
  </TR>
</TABLE>
<TABLE BGCOLOR="#cccccc">
  <TR>
<%= foreach my $header (@header) {
      $OUT .= qq(<TH ALIGN="right">$header</TH>);
    }
%>
  </TR>
<%= my $total = 0;
    my $utotal = 0;
    my $dtotal = 0;
    foreach my $usage ( @usage ) {
      $OUT .= '<TR>';
      $OUT .= qq(<TD>$_</TD>) foreach @{$usage};
      $OUT .= '</TR>';
    }
%>

</TABLE>
<BR>

</TD></TR></TABLE>
<%= include('footer') %>

--- NEW FILE: header.html ---
<HTML>
  <HEAD>
    <TITLE>MyAccount</TITLE>
  </HEAD>
  <BODY BGCOLOR="#eeeeee">
    <FONT SIZE=5>MyAccount</FONT>
    <BR><BR>
    <%= include('myaccount_menu') %>
    <TD VALIGN="top">



More information about the freeside-commits mailing list