[freeside-commits] branch master updated. ba95860daaf6c4de2f90ef28057516bc7d44c8a0

Mark Wells mark at 420.am
Tue Jul 7 14:49:17 PDT 2015


The branch, master has been updated
       via  ba95860daaf6c4de2f90ef28057516bc7d44c8a0 (commit)
      from  4a03b0b62cef514f9217e7be61cf7a16218ea387 (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 ba95860daaf6c4de2f90ef28057516bc7d44c8a0
Author: Mark Wells <mark at freeside.biz>
Date:   Tue Jul 7 14:48:14 2015 -0700

    add a tab to grouped search containing all rows, #25944

diff --git a/httemplate/search/elements/cust_pay_or_refund.html b/httemplate/search/elements/cust_pay_or_refund.html
index ce513ab..5808e5f 100755
--- a/httemplate/search/elements/cust_pay_or_refund.html
+++ b/httemplate/search/elements/cust_pay_or_refund.html
@@ -57,13 +57,14 @@ Examples:
 
                 'group_column'   => 'payby',
                 'group_label'    => 'payby_name',
-                'subtotal'       => { 'paid' => 'sum(paid)' },
+                'subtotal'       => { $opt{name_verb} => "sum($amount_field)" },
                 'subtotal_row'   => [ 'Subtotal',
-                                      sub { sprintf($money, $_[0]->paid) },
+                                      sub { sprintf($money, $_[0]->$amount_field) },
                                     ],
                 'total_row'      => [ '<B>Total</B>',
-                                      sub { sprintf("<B>$money</B>", $_[0]->paid) },
+                                      sub { sprintf("<B>$money</B>", $_[0]->$amount_field) },
                                     ],
+                'show_combined'  => 1,
 &>
 <%init>
 
@@ -181,7 +182,7 @@ push @fields, 'payby_payinfo_pretty',
               sub { sprintf($money, shift->$amount_field() ) },
 ;
 push @link_onclicks, $sub_receipt, '';
-push @sort_fields, '', $amount_field;
+push @sort_fields, 'paysort', $amount_field;
 
 if ( $unapplied ) {
   push @header, emt('Unapplied');
@@ -243,6 +244,7 @@ if ( $cgi->param('magic') ) {
   my @search = ();
   my @select = (
     "$table.*",
+    "( $table.payby || ' ' || coalesce($table.paymask, $table.payinfo) ) AS paysort",
     FS::UI::Web::cust_sql_fields(),
     'cust_main.custnum AS cust_main_custnum',
   );
diff --git a/httemplate/search/elements/grouped-search/core b/httemplate/search/elements/grouped-search/core
index fe47fb7..ffa8cee 100644
--- a/httemplate/search/elements/grouped-search/core
+++ b/httemplate/search/elements/grouped-search/core
@@ -130,6 +130,15 @@ for my $i (0 .. scalar(@groups) - 1) {
   push @queries, $detail_query;
 }
 
+if ( $opt{show_combined} ) {
+  # set up group 0 as a combined view
+  unshift @groups, $totals;
+  unshift @group_labels, 'All ' . PL($opt{name_singular}) .
+                         ' (' . $totals->num_rows . ')';
+  unshift @group_footers, []; # the total footer will suffice
+  unshift @queries, $base_query->clone;
+}
+
 my @total_footer;
 if ($opt{'total_row'}) {
   for( my $col = 0;
diff --git a/httemplate/search/elements/grouped-search/html b/httemplate/search/elements/grouped-search/html
index aff17ce..df1471a 100644
--- a/httemplate/search/elements/grouped-search/html
+++ b/httemplate/search/elements/grouped-search/html
@@ -71,6 +71,23 @@ for (my $i = 0; $i < $group_info->{num}; $i++) {
   push @menubar, $group_info->{group_labels}[$i], ";group=$i";
 }
 
+# not enabled yet; if we need this at some point, enable it on a per-report
+# basis and then disable it for search/cust_pay.html, because it's redundant
+# to see "Check   Check #130108", "Credit card   Card #401...", etc.
+
+## if this is the combined view, add a column for the group key
+#if ( $curr_group == 0 and $opt{'show_combined'} ) {
+#  unshift @{$opt{'header'}}, '';
+#  unshift @{$opt{'fields'}}, $opt{group_label};
+#  unshift @{$opt{'sort_fields'}}, $opt{group_column} if $opt{'sort_fields'};
+#  $opt{'align'} = 'c'.$opt{'align'};
+#  foreach (qw(header2 links link_onclicks color size style cell_style xls_format)) {
+#    if ( $opt{$_} ) {
+#      unshift @{$opt{$_}}, '';
+#    }
+#  }
+#}
+
 </%init>
 
 <& /elements/header.html, $opt{title} &>
@@ -93,6 +110,7 @@ for (my $i = 0; $i < $group_info->{num}; $i++) {
 <A HREF="<% $cgi->self_url %>"><% emt('as Excel spreadsheet') %></A><BR>
 % $cgi->param('type', 'html-print');
 <A HREF="<% $cgi->self_url %>"><% emt('as printable copy') %></A><BR>
+% $cgi->delete('type');
 </P>
 
 <% $pager %>
diff --git a/httemplate/search/elements/grouped-search/html-print b/httemplate/search/elements/grouped-search/html-print
index c4c3b1e..6d9521b 100644
--- a/httemplate/search/elements/grouped-search/html-print
+++ b/httemplate/search/elements/grouped-search/html-print
@@ -5,7 +5,9 @@ The "printable" view (all groups on one page).
 <%init>
 my %opt = @_;
 
-my $group_info = $m->comp('core', %opt);
+my $group_info = $m->comp('core', %opt,
+  'show_combined' => 0
+);
 my $ncols = scalar(@{ $opt{header} });
 
 my $total_footer = $group_info->{total_footer} || [];

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

Summary of changes:
 httemplate/search/elements/cust_pay_or_refund.html   |   10 ++++++----
 httemplate/search/elements/grouped-search/core       |    9 +++++++++
 httemplate/search/elements/grouped-search/html       |   18 ++++++++++++++++++
 httemplate/search/elements/grouped-search/html-print |    4 +++-
 4 files changed, 36 insertions(+), 5 deletions(-)




More information about the freeside-commits mailing list