add reporting on (and resolution of) stuck pending transactions, RT#4837 (RT#3572)
[freeside.git] / httemplate / view / cust_main / payment_history.html
index bc01d68..335ce24 100644 (file)
 
 %# batched payment links
 
-% if ( $conf->exists('batch-enable')
+% if ( ( $conf->exists('batch-enable') || $conf->config('batch-enable_payby') )
 %      && $curuser->access_right('View customer batched payments')
-%    ) { 
-  View batched payments:
+%    )
+% { 
+    View batched payments:
 %   foreach my $status (qw( Queued In-transit Complete All )) {
       <A HREF="<% $p %>search/cust_pay_batch.cgi?status=<% $status{$status} %>;custnum=<% $custnum %>"><% $status %></A> 
       <% $status ne 'All' ? '|' : '' %>
 %   }
-  <BR>
+    <BR>
 % } 
 
+%# pending payment links
+
+% if ( $curuser->access_right('View customer pending payments')
+%      && scalar($cust_main->cust_pay_pending)
+%    )
+% {
+    <A HREF="<% $p %>search/cust_pay_pending.html?magic=_date;statusNOT=done;custnum=<% $custnum %>">View pending payments</A><BR>
+% }
+
 %# and now the table
 
 <% include("/elements/table-grid.html") %>
 <TR>
   <TH CLASS="grid" BGCOLOR="#cccccc">Date</TH>
   <TH CLASS="grid" BGCOLOR="#cccccc">Description</TH>
-  <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1>Charge</FONT></TH>
+  <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1>Invoice</FONT></TH>
   <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1>Payment</FONT></TH>
   <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1>In-house<BR>Credit</FONT></TH>
   <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1>Refund</FONT></TH>
 
 %#display payment history
 
+%my $money_char = $conf->config('money_char') || '$';
+%
 %sub balance_forward_row {
-%  my( $b, $date ) = @_;
-%  my $conf = new FS::Conf;
-%  my $money_char = $conf->config('money_char') || '$';
+%  my( $b, $date, $money_char ) = @_;
 %  ( my $balance_forward = $money_char. $b ) =~ s/^\$\-/-&nbsp;\$/;
 
    <TR ID="balance_forward_row">
      <TD CLASS="grid" BGCOLOR="#dddddd"></TD>
      <TD CLASS="grid" BGCOLOR="#dddddd"></TD>
      <TD CLASS="grid" BGCOLOR="#dddddd"></TD>
-     <TD CLASS="grid" BGCOLOR="#dddddd"><I><% $balance_forward %></I></TD>
+     <TD CLASS="grid" BGCOLOR="#dddddd" ALIGN="right"><I><% $balance_forward %></I></TD>
 
    </TR>
 %}
 %
 %my $balance = 0;
 %my %target = ();
-%my $money_char = $conf->config('money_char') || '$';
 %
 %my $years =  $conf->config('payment_history-years') || 2;
 %my $older_than = time - $years * 31556736; #60*60*24*365.24
 %    $display = '';
 %
 %    if ( $hidden && ! $seen++ ) {
-%      balance_forward_row($balance, $item->{'date'});
+%      balance_forward_row($balance, $item->{'date'}, $money_char);
 %    }
 %
 %  }
 % } 
 
 %if ( scalar(@history) && $hidden && ! $seen++ ) {
-%  balance_forward_row($balance, $lastdate);
+%  balance_forward_row($balance, $lastdate, $money_char);
 %}
 
 </TABLE>
@@ -344,11 +353,19 @@ my %status = (
 #get payment history
 my @history = ();
 
+my %opt =
+  ( map { $_ => scalar($conf->config($_)) }
+        qw( card_refund-days )
+  ),
+  ( map { $_ => $conf->exists($_) } 
+        qw( deletepayments deleterefunds )
+  );
+
 #invoices
 foreach my $cust_bill ($cust_main->cust_bill) {
   push @history, {
     'date'   => $cust_bill->_date,
-    'desc'   => include('payment_history/invoice.html', $cust_bill),
+    'desc'   => include('payment_history/invoice.html', $cust_bill, %opt ),
     'charge' => $cust_bill->charged,
   };
 }
@@ -357,7 +374,7 @@ foreach my $cust_bill ($cust_main->cust_bill) {
 foreach my $cust_pay ($cust_main->cust_pay) {
   push @history, {
     'date'    => $cust_pay->_date,
-    'desc'    => include('payment_history/payment.html', $cust_pay),
+    'desc'    => include('payment_history/payment.html', $cust_pay, %opt ),
     'payment' => $cust_pay->paid,
     #'target'  => $target, #XXX
   };