[freeside-commits] branch rt73200 updated. b8da6cba66eb1c3c394b85cd53195d0e0a918d50

Mitch Jackson mitch at 420.am
Mon Oct 30 15:31:36 PDT 2017


The branch, rt73200 has been updated
       via  b8da6cba66eb1c3c394b85cd53195d0e0a918d50 (commit)
      from  3ef7da76ba001a29911b36cd5e48411cf4d7a0c6 (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 b8da6cba66eb1c3c394b85cd53195d0e0a918d50
Author: Mitch Jackson <mitch at freeside.biz>
Date:   Mon Oct 30 22:30:39 2017 +0000

    RT# 73200 Updated placeholder code for Credit Report

diff --git a/httemplate/search/cust_credit.html b/httemplate/search/cust_credit.html
index d927596..eb07c38 100755
--- a/httemplate/search/cust_credit.html
+++ b/httemplate/search/cust_credit.html
@@ -330,9 +330,6 @@ $count_query .= 'FROM cust_credit'.
                   $addl_from. FS::UI::Web::join_cust_main('cust_credit').
                   $where;
 
-# Temp override
-$count_query = 'SELECT 100,100,100,100';
-
 my @count_addl = ( $money_char.'%.2f total credited (gross)' );
 push @count_addl, $money_char.'%.2f unapplied' if $unapplied;
 
@@ -345,7 +342,6 @@ my $sql_query   = {
 };
 
 # Necessary because cust_credit_void.reason is not being populated
-
 my $addl_from_void = join(' ',
   $addl_from,
   FS::UI::Web::join_cust_main('cust_credit_void'),
@@ -364,7 +360,37 @@ my $sql_query_void = {
   'addl_from' => $addl_from_void,
 };
 
-$sql_query = [$sql_query, $sql_query_void]
-  if $show_voided_credits;
+if ($show_voided_credits) {
+
+  $sql_query = [$sql_query, $sql_query_void];
+
+  my $count_cust_credit;
+  my $count_cust_credit_void;
+  my $count_sum;
+
+  # Expected fields for count query are count, sum
+  # Get those totals here, and send a fake count query
+  my $count_row = qsearchs({
+    table => 'cust_credit',
+    select => 'count(*), sum(amount)',
+    extra_sql => $where,
+    addl_from => $addl_from . FS::UI::Web::join_cust_main('cust_credit'),
+  });
+  $count_cust_credit = $count_row->count || 0;
+  $count_sum = $count_row->sum || 0;
+
+  $count_row = qsearchs({
+    table => 'cust_credit_void',
+    select => 'count(*)',
+    extra_sql => $where_void,
+    addl_from => $addl_from_void,
+  });
+  $count_cust_credit_void = $count_row->count || 0;
+
+  my $count_combined = $count_cust_credit + $count_cust_credit_void;
+
+  # Fake count query providing needed values
+  $count_query = "SELECT $count_combined as count, $count_sum as sum";
+}
 
 </%init>

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

Summary of changes:
 httemplate/search/cust_credit.html |   38 ++++++++++++++++++++++++++++++------
 1 file changed, 32 insertions(+), 6 deletions(-)




More information about the freeside-commits mailing list