[freeside-commits] branch FREESIDE_4_BRANCH updated. c79b6f23a5b99d2f3d091aceccf510e7397b4d57

Jonathan Prykop jonathan at 420.am
Tue Jun 16 13:47:00 PDT 2015


The branch, FREESIDE_4_BRANCH has been updated
       via  c79b6f23a5b99d2f3d091aceccf510e7397b4d57 (commit)
       via  cfe3371f55ba574e042497836f7a5e4f35c94e92 (commit)
      from  fb186784b7be72e157d6fd12fbe0b322fc6191ae (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c79b6f23a5b99d2f3d091aceccf510e7397b4d57
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Tue Jun 16 15:41:15 2015 -0500

    RT#29169: Show payment information in selfservice portal [slight text tweaks for consistency]

diff --git a/fs_selfservice/FS-SelfService/cgi/history.html b/fs_selfservice/FS-SelfService/cgi/history.html
index 00fdfa5..605bc1c 100644
--- a/fs_selfservice/FS-SelfService/cgi/history.html
+++ b/fs_selfservice/FS-SelfService/cgi/history.html
@@ -1,4 +1,4 @@
-<%= include('header', 'Billing History') %>
+<%= include('header', 'Payment History') %>
 
 <%=
 my $balance = 0;
diff --git a/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html b/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html
index 6a28d80..61926bd 100644
--- a/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html
+++ b/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html
@@ -67,7 +67,7 @@ push @menu,
   { title=>' ' };
 
 push @menu,
-  { title=>'View Payment History', url=>'history', size=>'+1' },
+  { title=>'View payment history', url=>'history', size=>'+1' },
 ;
 
 unless( $hide_usage ){

commit cfe3371f55ba574e042497836f7a5e4f35c94e92
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Thu Jun 11 23:15:50 2015 -0500

    RT#29169: Show payment information in selfservice portal

diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index 0ebd821..85a96c7 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -763,6 +763,7 @@ sub billing_history {
   @history = sort { $b->{'date'} <=> $a->{'date'} } @history;
 
   $return{'history'} = \@history;
+  $return{'money_char'} = $conf->config("money_char") || '$',
 
   return \%return;
 
diff --git a/fs_selfservice/FS-SelfService/cgi/history.html b/fs_selfservice/FS-SelfService/cgi/history.html
new file mode 100644
index 0000000..00fdfa5
--- /dev/null
+++ b/fs_selfservice/FS-SelfService/cgi/history.html
@@ -0,0 +1,39 @@
+<%= include('header', 'Billing History') %>
+
+<%=
+my $balance = 0;
+my $style      = 'text-align: left; margin: 0; padding: 0 1em 0 0;';
+my $moneystyle = 'text-align: right; margin: 0; padding: 0 1em 0 0;';
+my $col1 = "#ffffff";
+my $col2 = "#dddddd";
+my $col = $col1;
+foreach my $item (@history) {
+  $balance += $$item{'amount'};
+  $$item{'amount'} =~ s/^(-?)/$1$money_char/;
+  $out .= <<EOF;
+  <TR>
+    <TD style="$style background: $col;">$$item{'date_pretty'}</TD>
+    <TD style="$style background: $col;">$$item{'description'}</TD>
+    <TD style="$moneystyle background: $col;">$$item{'amount'}</TD>
+  </TR>
+EOF
+  $col = $col eq $col1 ? $col2 : $col1;
+}
+$balance = sprintf('%.2f',$balance);
+$balance =~ s/^(-?)/$1$money_char/;
+$out = <<EOF;
+<P>Balance: <B>$balance</B></P>
+<TABLE style="margin: 0;" CELLSPACING="0">
+  <TR>
+    <TH style="$style background: #ff9999;">Date</TH>
+    <TH style="$style background: #ff9999;">Description</TH>
+    <TH style="$moneystyle background: #ff9999;">Amount</TH>
+  </TR>
+$out
+</TABLE>
+EOF
+%>
+
+</TABLE>
+
+<%= include('footer') %>
diff --git a/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html b/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html
index 999c62d..6a28d80 100644
--- a/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html
+++ b/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html
@@ -66,6 +66,10 @@ if ( ($balance || 0) > 0 ) { #XXXFIXME "enable selfservice prepay features" flag
 push @menu,
   { title=>' ' };
 
+push @menu,
+  { title=>'View Payment History', url=>'history', size=>'+1' },
+;
+
 unless( $hide_usage ){
   push @menu,
     { title=>'View my usage', url=>'view_usage', size=>'+1', }
diff --git a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
index 0e60791..4c666cb 100755
--- a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
+++ b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
@@ -23,6 +23,7 @@ use FS::SelfService qw(
   mason_comp port_graph
   start_thirdparty finish_thirdparty
   reset_passwd check_reset_passwd process_reset_passwd
+  billing_history
 );
 
 $template_dir = '.';
@@ -83,6 +84,7 @@ my @actions = ( qw(
   customer_suspend_pkg
   process_suspend_pkg
   switch_cust
+  history
 ));
 
 my @nologin_actions = (qw(
@@ -353,6 +355,10 @@ sub invoices {
   list_invoices( 'session_id' => $session_id, );
 }
 
+sub history {
+  billing_history( 'session_id' => $session_id, );
+}
+
 sub tktcreate {
   my $customer_info = customer_info( 'session_id' => $session_id );
   return $customer_info if ( $customer_info->{'error'} );

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/ClientAPI/MyAccount.pm                       |    1 +
 fs_selfservice/FS-SelfService/cgi/history.html     |   39 ++++++++++++++++++++
 .../FS-SelfService/cgi/myaccount_menu.html         |    4 ++
 fs_selfservice/FS-SelfService/cgi/selfservice.cgi  |    6 +++
 4 files changed, 50 insertions(+)
 create mode 100644 fs_selfservice/FS-SelfService/cgi/history.html




More information about the freeside-commits mailing list