[freeside-commits] branch master updated. d1f83ecbaefdab8fbb3a05e87448f3351d9051b4

Jonathan Prykop jonathan at 420.am
Fri Jul 3 17:46:53 PDT 2015


The branch, master has been updated
       via  d1f83ecbaefdab8fbb3a05e87448f3351d9051b4 (commit)
      from  32365ef65ca6a40b5262cf166543b1d84c6aa57d (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 d1f83ecbaefdab8fbb3a05e87448f3351d9051b4
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Fri Jul 3 19:46:00 2015 -0500

    RT#34078: Payment History Report / Statement [various fixes, integrated with selfservice]

diff --git a/FS/FS/ClientAPI/MasonComponent.pm b/FS/FS/ClientAPI/MasonComponent.pm
index 50597e2..3c3bf4c 100644
--- a/FS/FS/ClientAPI/MasonComponent.pm
+++ b/FS/FS/ClientAPI/MasonComponent.pm
@@ -14,6 +14,7 @@ $DEBUG = 0;
 $me = '[FS::ClientAPI::MasonComponent]';
 
 my %allowed_comps = map { $_=>1 } qw(
+  /elements/customer-statement.html
   /elements/select-did.html
   /misc/areacodes.cgi
   /misc/exchanges.cgi
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index f2c2b4a..46df3ff 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -4175,7 +4175,7 @@ sub payment_history {
         'amount'      => sprintf('%.2f', $_->setup + $_->recur ),
         'charged'     => sprintf('%.2f', $_->setup + $_->recur ),
         'date'        => $cust_bill->_date,
-        'date_pretty' =>  time2str('%m/%d/%Y', $cust_bill->_date ),
+        'date_pretty' => $self->time2str_local('short', $cust_bill->_date ),
       }
         foreach $cust_bill->cust_bill_pkg;
 
@@ -4189,7 +4189,7 @@ sub payment_history {
                      'amount'      => sprintf('%.2f', $_->charged ),
                      'charged'     => sprintf('%.2f', $_->charged ),
                      'date'        => $_->_date,
-                     'date_pretty' =>  time2str('%m/%d/%Y', $_->_date ),
+                     'date_pretty' => $self->time2str_local('short', $_->_date ),
                    }
       foreach $self->cust_bill;
 
@@ -4201,7 +4201,7 @@ sub payment_history {
                    'amount'      => sprintf('%.2f', 0 - $_->paid ),
                    'paid'        => sprintf('%.2f', $_->paid ),
                    'date'        => $_->_date,
-                   'date_pretty' =>  time2str('%m/%d/%Y', $_->_date ),
+                   'date_pretty' => $self->time2str_local('short', $_->_date ),
                  }
     foreach $self->cust_pay;
 
@@ -4211,7 +4211,7 @@ sub payment_history {
                    'amount'      => sprintf('%.2f', 0 -$_->amount ),
                    'credit'      => sprintf('%.2f', $_->amount ),
                    'date'        => $_->_date,
-                   'date_pretty' =>  time2str('%m/%d/%Y', $_->_date ),
+                   'date_pretty' => $self->time2str_local('short', $_->_date ),
                  }
     foreach $self->cust_credit;
 
@@ -4221,7 +4221,7 @@ sub payment_history {
                    'amount'      => $_->refund,
                    'refund'      => $_->refund,
                    'date'        => $_->_date,
-                   'date_pretty' =>  time2str('%m/%d/%Y', $_->_date ),
+                   'date_pretty' => $self->time2str_local('short', $_->_date ),
                  }
     foreach $self->cust_refund;
 
diff --git a/fs_selfservice/FS-SelfService/cgi/history.html b/fs_selfservice/FS-SelfService/cgi/history.html
index 605bc1c..0b6f9ce 100644
--- a/fs_selfservice/FS-SelfService/cgi/history.html
+++ b/fs_selfservice/FS-SelfService/cgi/history.html
@@ -1,39 +1,14 @@
 <%= include('header', 'Payment 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
+my $out = mason_comp(
+  'session_id' => $session_id,
+  'comp'       => '/elements/customer-statement.html',
+  'args'       => [
+    'history' => \@history,
+  ]
+);
+$out->{'output'} || $out->{'error'};
 %>
 
-</TABLE>
-
 <%= include('footer') %>
diff --git a/httemplate/view/cust_main/menu.html b/httemplate/view/cust_main/menu.html
index 6e66ea7..90a20ed 100644
--- a/httemplate/view/cust_main/menu.html
+++ b/httemplate/view/cust_main/menu.html
@@ -197,8 +197,9 @@ my @menu = (
       url         => sub {
                       my $cust_main = shift;
                       my $agentnum = $cust_main->agentnum;
-                      'misc/email-customers.html?table=cust_main;search_hash='.
-                      'agent_virt_agentnum='.$agentnum.";custnum=$custnum";
+                      'misc/email-customers.html?table=cust_main;'.
+                      'agent_virt_agentnum='.$agentnum.";custnum=$custnum;url=".
+                      uri_escape($cgi->self_url);
                      },
       condition   => sub { $invoicing_list_emailonly },
       acl         => 'Bulk send customer notices',
@@ -487,7 +488,7 @@ my @menu = (
       url         => sub {
                       my $cust_main = shift;
                       my $agentnum = $cust_main->agentnum;
-                      'misc/email-customer-statement.html?table=cust_main;search_hash='.
+                      'misc/email-customer-statement.html?table=cust_main;'.
                       'agent_virt_agentnum='.$agentnum.";custnum=$custnum;url=".
                       uri_escape($cgi->self_url);
                      },

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

Summary of changes:
 FS/FS/ClientAPI/MasonComponent.pm              |    1 +
 FS/FS/cust_main.pm                             |   10 +++---
 fs_selfservice/FS-SelfService/cgi/history.html |   41 +++++-------------------
 httemplate/view/cust_main/menu.html            |    7 ++--
 4 files changed, 18 insertions(+), 41 deletions(-)




More information about the freeside-commits mailing list