[freeside-commits] branch FREESIDE_2_3_BRANCH updated. 64b4f3b1b0c76ab96b39a936068f6652ba5666b9

Mark Wells mark at 420.am
Mon Dec 31 14:12:38 PST 2012


The branch, FREESIDE_2_3_BRANCH has been updated
       via  64b4f3b1b0c76ab96b39a936068f6652ba5666b9 (commit)
      from  82b8dfd99fc64460a6bc17a97d7aba9adf3a1286 (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 64b4f3b1b0c76ab96b39a936068f6652ba5666b9
Author: Mark Wells <mark at freeside.biz>
Date:   Mon Dec 31 14:11:34 2012 -0800

    filter by customer class on all financial reports, #20573

diff --git a/FS/FS/Report/Table.pm b/FS/FS/Report/Table.pm
index 6969406..2e202e5 100644
--- a/FS/FS/Report/Table.pm
+++ b/FS/FS/Report/Table.pm
@@ -56,6 +56,13 @@ sub signups {
     push @where, "refnum = ".$opt{'refnum'};
   }
 
+  if ( $opt{'cust_classnum'} ) {
+    my $classnums = $opt{'cust_classnum'};
+    $classnums = [ $classnums ] if !ref($classnums);
+    @$classnums = grep /^\d+$/, @$classnums;
+    push @where, 'cust_main.classnum in('. join(',',@$classnums) .')';
+  }
+
   $self->scalar_sql(
     "SELECT COUNT(*) FROM cust_main $join WHERE ".join(' AND ', @where)
   );
@@ -439,8 +446,16 @@ sub cust_bill_pkg_setup {
     $self->in_time_period_and_agent($speriod, $eperiod, $agentnum),
   );
 
+  # yuck, false laziness
   push @where, "cust_main.refnum = ". $opt{'refnum'} if $opt{'refnum'};
 
+  if ( $opt{'cust_classnum'} ) {
+    my $classnums = $opt{'cust_classnum'};
+    $classnums = [ $classnums ] if !ref($classnums);
+    @$classnums = grep /^\d+$/, @$classnums;
+    push @where, 'cust_main.classnum in('. join(',',@$classnums) .')';
+  }
+
   my $total_sql = "SELECT COALESCE(SUM(cust_bill_pkg.setup),0)
   FROM cust_bill_pkg
   $cust_bill_pkg_join
@@ -463,6 +478,13 @@ sub cust_bill_pkg_recur {
 
   push @where, 'cust_main.refnum = '. $opt{'refnum'} if $opt{'refnum'};
 
+  if ( $opt{'cust_classnum'} ) {
+    my $classnums = $opt{'cust_classnum'};
+    $classnums = [ $classnums ] if !ref($classnums);
+    @$classnums = grep /^\d+$/, @$classnums;
+    push @where, 'cust_main.classnum in('. join(',',@$classnums) .')';
+  }
+
   # subtract all usage from the line item regardless of date
   my $item_usage;
   if ( $opt{'project'} ) {
@@ -518,6 +540,13 @@ sub cust_bill_pkg_detail {
 
   push @where, 'cust_main.refnum = '. $opt{'refnum'} if $opt{'refnum'};
 
+  if ( $opt{'cust_classnum'} ) {
+    my $classnums = $opt{'cust_classnum'};
+    $classnums = [ $classnums ] if !ref($classnums);
+    @$classnums = grep /^\d+$/, @$classnums;
+    push @where, 'cust_main.classnum in('. join(',',@$classnums) .')';
+  }
+
   $agentnum ||= $opt{'agentnum'};
 
   push @where,
@@ -657,6 +686,14 @@ sub for_opts {
     if ( $opt{'refnum'} =~ /^(\d+)$/ ) {
       $sql .= " and refnum = $1 ";
     }
+    if ( $opt{'cust_classnum'} ) {
+      my $classnums = $opt{'cust_classnum'};
+      $classnums = [ $classnums ] if !ref($classnums);
+      @$classnums = grep /^\d+$/, @$classnums;
+      $sql .= ' and cust_main.classnum in('. join(',',@$classnums) .')'
+        if @$classnums;
+    }
+
     $sql;
 }
 
diff --git a/FS/FS/Report/Table/Monthly.pm b/FS/FS/Report/Table/Monthly.pm
index ee4dc5f..b8e52ae 100644
--- a/FS/FS/Report/Table/Monthly.pm
+++ b/FS/FS/Report/Table/Monthly.pm
@@ -25,6 +25,7 @@ FS::Report::Table::Monthly - Tables of report data, indexed monthly
     #opt
     'agentnum'    => 54
     'refnum'      => 54
+    'cust_classnum' => [ 1,2,4 ],
     'params'      => [ [ 'paramsfor', 'item_one' ], [ 'item', 'two' ] ], # ...
     'remove_empty' => 1, #collapse empty rows, default 0
     'item_labels' => [ ], #useful with remove_empty
@@ -69,6 +70,9 @@ corresponding to this arrayref.
 
 =item refnum: Limit to customers with this advertising source.
 
+=item cust_classnum: Limit to customers with this classnum; can be an 
+arrayref.
+
 =item remove_empty: Set this to a true value to hide rows that contain 
 only zeroes.  The C<indices> array in the returned data will list the item
 indices that are actually present in the output so that you know what they
@@ -139,6 +143,8 @@ sub data {
 
   my $agentnum = $self->{'agentnum'};
   my $refnum = $self->{'refnum'};
+  my $cust_classnum = $self->{'cust_classnum'} || [];
+  $cust_classnum = [ $cust_classnum ] if !ref($cust_classnum);
 
   if ( $projecting ) {
 
@@ -183,6 +189,7 @@ sub data {
       my @param = $self->{'params'} ? @{ $self->{'params'}[$col] }: ();
       push @param, 'project', $projecting;
       push @param, 'refnum' => $refnum if $refnum;
+      push @param, 'cust_classnum' => $cust_classnum if @$cust_classnum;
 
       if ( $self->{'cross_params'} ) {
         my @xdata;
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm
index e8fb61d..e805244 100644
--- a/FS/FS/cust_bill.pm
+++ b/FS/FS/cust_bill.pm
@@ -5669,6 +5669,15 @@ sub search_sql_where {
     push @search, "cust_bill.custnum = $1";
   }
 
+  #customer classnum
+  if ( $param->{'cust_classnum'} ) {
+    my $classnums = $param->{'cust_classnum'};
+    $classnums = [ $classnums ] if !ref($classnums);
+    $classnums = [ grep /^\d+$/, @$classnums ];
+    push @search, 'cust_main.classnum in ('.join(',',@$classnums).')'
+      if @$classnums;
+  }
+
   #_date
   if ( $param->{_date} ) {
     my($beginning, $ending) = @{$param->{_date}};
diff --git a/httemplate/graph/cust_bill_pkg.cgi b/httemplate/graph/cust_bill_pkg.cgi
index c334ae9..91bedf3 100644
--- a/httemplate/graph/cust_bill_pkg.cgi
+++ b/httemplate/graph/cust_bill_pkg.cgi
@@ -13,6 +13,7 @@
                 'bottom_total' => 1,
                 'bottom_link'  => $bottom_link,
                 'agentnum'     => $agentnum,
+                'cust_classnum'=> \@cust_classnums,
              )
 %>
 <%init>
@@ -68,6 +69,9 @@ $title .= $sel_part_referral->referral.' '
 $title .= 'Sales Report (Gross)';
 $title .= ', average per customer package'  if $average_per_cust_pkg;
 
+my @cust_classnums = grep /^\d+$/, $cgi->param('cust_classnum');
+$bottom_link .= "cust_classnum=$_;" foreach @cust_classnums;
+
 #classnum (here)
 # 0: all classes
 # not specified: empty class
@@ -188,6 +192,7 @@ foreach my $agent ( $all_agent || $sel_agent || qsearch('agent', { 'disabled' =>
         push @links, "$link;".
                      ($all_agent ? '' : "agentnum=$row_agentnum;").
                      ($all_part_referral ? '' : "refnum=$row_refnum;").
+                     (join('',map {"cust_classnum=$_;"} @cust_classnums)).
                      ($all_class ? '' : "classnum=$row_classnum;").
                      "distribute=$distribute;".
                      "use_override=$use_override;charges=$component;";
@@ -209,6 +214,7 @@ foreach my $agent ( $all_agent || $sel_agent || qsearch('agent', { 'disabled' =>
     my $component = join('', @components);
 
     my @row_params = (  'agentnum'              => $row_agentnum,
+                        'cust_classnum'         => \@cust_classnums,
                         'use_override'          => $use_override,
                         'average_per_cust_pkg'  => $average_per_cust_pkg,
                         'distribute'            => $distribute,
@@ -231,6 +237,8 @@ foreach my $agent ( $all_agent || $sel_agent || qsearch('agent', { 'disabled' =>
       $row_link .= ";refnum=".$sel_part_referral->refnum;
     }
 
+    $row_link .= ";cust_classnum=$_" foreach @cust_classnums;
+
     push @items, 'cust_bill_pkg';
     push @labels, mt('[_1] - Subtotal', $agent->agent);
     push @params, \@row_params;
diff --git a/httemplate/graph/elements/monthly.html b/httemplate/graph/elements/monthly.html
index 75396e3..e7de548 100644
--- a/httemplate/graph/elements/monthly.html
+++ b/httemplate/graph/elements/monthly.html
@@ -36,6 +36,7 @@ Example:
 
     #optional
     'agentnum'        => $agentnum,
+    'cust_classnum'   => \@classnums,
     'nototal'         => 1,
     'graph_type'      => 'LinesPoints',
     'remove_empty'    => 1,
@@ -119,6 +120,7 @@ my %reportopts = (
       'end_year'     => $opt{'end_year'},
       'projection'   => $opt{'projection'},
       'agentnum'     => $opt{'agentnum'},
+      'cust_classnum'=> $opt{'cust_classnum'},
       'remove_empty' => $opt{'remove_empty'},
       'doublemonths' => $opt{'doublemonths'},
 );
diff --git a/httemplate/graph/money_time.cgi b/httemplate/graph/money_time.cgi
index 166735f..9071fc7 100644
--- a/httemplate/graph/money_time.cgi
+++ b/httemplate/graph/money_time.cgi
@@ -8,6 +8,7 @@
                 'links'        => \%link,
                 'agentnum'     => $agentnum,
                 'refnum'       => $refnum,
+                'cust_classnum'=> \@classnums,
                 'nototal'      => scalar($cgi->param('12mo')),
              )
 %>
@@ -25,6 +26,11 @@ if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
 }
 my $agentname = $agent ? $agent->agent.' ' : '';
 
+my @classnums;
+if ( $cgi->param('cust_classnum') ) {
+  @classnums = grep /^\d+$/, $cgi->param('cust_classnum');
+}
+
 my( $refnum, $part_referral ) = ('', '');
 if ( $cgi->param('refnum') =~ /^(\d+)$/ ) {
   $refnum = $1;
@@ -93,6 +99,7 @@ $color{$_.'_12mo'} = $color{$_}
   foreach keys %color;
 
 my $ar = "agentnum=$agentnum;refnum=$refnum";
+$ar .= ";cust_classnum=$_" foreach @classnums;
 
 my %link = (
   'invoiced'   => "${p}search/cust_bill.html?$ar;",
diff --git a/httemplate/graph/money_time_daily.cgi b/httemplate/graph/money_time_daily.cgi
index 4d16ff8..0fdbd89 100644
--- a/httemplate/graph/money_time_daily.cgi
+++ b/httemplate/graph/money_time_daily.cgi
@@ -7,6 +7,7 @@
                 'colors'       => \%color,
                 'links'        => \%link,
                 'agentnum'     => $agentnum,
+                'cust_classnum'=> \@classnums,
                 'nototal'      => scalar($cgi->param('12mo')),
                 'daily'        => 1,
                 'start_day'    => $smday,
@@ -32,6 +33,11 @@ if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
 
 my $agentname = $agent ? $agent->agent.' ' : '';
 
+my @classnums;
+if ( $cgi->param('cust_classnum') ) {
+  @classnums = grep /^\d+$/, $cgi->param('cust_classnum');
+}
+
 my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
 my ($ssec,$smin,$shour,$smday,$smon,$syear,$swday,$syday,$sisdst) 
     = localtime($beginning);
diff --git a/httemplate/graph/report_cust_bill_pkg.html b/httemplate/graph/report_cust_bill_pkg.html
index 31792e8..251e7d3 100644
--- a/httemplate/graph/report_cust_bill_pkg.html
+++ b/httemplate/graph/report_cust_bill_pkg.html
@@ -34,6 +34,12 @@ function enable_agent_totals(obj) {
   'onchange'      => 'enable_agent_totals',
 &>
 
+<& /elements/tr-select-cust_class.html,
+  'field'         => 'cust_classnum',
+  'label'         => 'Customer class',
+  'multiple'      => 1,
+&>
+
 <& /elements/tr-select-part_referral.html,
   'field'         => 'refnum',
   'label'         => 'Advertising source ',
diff --git a/httemplate/graph/report_money_time.html b/httemplate/graph/report_money_time.html
index 97876c9..315d31b 100644
--- a/httemplate/graph/report_money_time.html
+++ b/httemplate/graph/report_money_time.html
@@ -24,6 +24,11 @@
           )
 %>
 
+<& /elements/tr-select-cust_class.html,
+    'field'    => 'cust_classnum', # to avoid ambiguity in FS::Report::Table
+    'multiple' => 1
+&>
+
 <% include('/elements/tr-select-part_referral.html',
              'label'         => 'Advertising source ',
              'disable_empty' => 0,
diff --git a/httemplate/graph/report_money_time_daily.html b/httemplate/graph/report_money_time_daily.html
index 8328199..a436d08 100644
--- a/httemplate/graph/report_money_time_daily.html
+++ b/httemplate/graph/report_money_time_daily.html
@@ -17,6 +17,11 @@
           )
 %>
 
+<& /elements/tr-select-cust_class.html,
+    'field'    => 'cust_classnum',
+    'multiple' => 1,
+&>
+
 </TABLE>
 
 <BR><INPUT TYPE="submit" VALUE="Display">
diff --git a/httemplate/search/cust_bill.html b/httemplate/search/cust_bill.html
index 406486a..3c0530e 100755
--- a/httemplate/search/cust_bill.html
+++ b/httemplate/search/cust_bill.html
@@ -97,6 +97,10 @@ if ( $cgi->param('invnum') =~ /^\s*(FS-)?(\d+)\s*$/ ) {
     $search{'refnum'} = $1;
   }
 
+  if ( $cgi->param('cust_classnum') ) {
+    $search{'cust_classnum'} = [ $cgi->param('cust_classnum') ];
+  }
+
   if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
     $search{'custnum'} = $1;
   }
diff --git a/httemplate/search/cust_bill_pay.html b/httemplate/search/cust_bill_pay.html
index 22e9a67..79de749 100644
--- a/httemplate/search/cust_bill_pay.html
+++ b/httemplate/search/cust_bill_pay.html
@@ -99,6 +99,13 @@ if ( $cgi->param('refnum') && $cgi->param('refnum') =~ /^(\d+)$/ ) {
   $title = $part_referral->referral. " $title";
 }
 
+if ( $cgi->param('cust_classnum') ) {
+  my @classnums = grep /^\d+$/, $cgi->param('cust_classnum');
+  push @search, 'cust_main.classnum IN('.join(',', at classnums).')'
+    if @classnums;
+}
+
+
 my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
 push @search, "cust_bill._date >= $beginning ",
               "cust_bill._date <= $ending";
diff --git a/httemplate/search/cust_bill_pkg.cgi b/httemplate/search/cust_bill_pkg.cgi
index d2c6443..df040ff 100644
--- a/httemplate/search/cust_bill_pkg.cgi
+++ b/httemplate/search/cust_bill_pkg.cgi
@@ -234,6 +234,13 @@ if ( $cgi->param('refnum') =~ /^(\d+)$/ ) {
   push @where, "cust_main.refnum = $1";
 }
 
+# cust_classnum
+if ( $cgi->param('cust_classnum') ) {
+  my @classnums = grep /^\d+$/, $cgi->param('cust_classnum');
+  push @where, 'cust_main.classnum IN('.join(',', at classnums).')'
+    if @classnums;
+}
+
 # custnum
 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
   push @where, "cust_main.custnum = $1";
diff --git a/httemplate/search/cust_bill_pkg_referral.html b/httemplate/search/cust_bill_pkg_referral.html
index 77b4860..1289ff7 100644
--- a/httemplate/search/cust_bill_pkg_referral.html
+++ b/httemplate/search/cust_bill_pkg_referral.html
@@ -156,6 +156,11 @@ if ( @refnum ) {
   push @where, 'cust_main.refnum IN ('.join(',', @refnum).')';
 }
 
+my @cust_classnums = grep /^\d+$/, $cgi->param('cust_classnum');
+if ( @cust_classnums ) {
+  push @where, 'cust_main.classnum IN ('.join(',', @cust_classnums).')';
+}
+
 if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
   push @where, "cust_main.agentnum = $1";
 }
diff --git a/httemplate/search/cust_credit.html b/httemplate/search/cust_credit.html
index 38f0349..f5d8fa1 100755
--- a/httemplate/search/cust_credit.html
+++ b/httemplate/search/cust_credit.html
@@ -103,6 +103,12 @@ if ( $cgi->param('refnum') && $cgi->param('refnum') =~ /^(\d+)$/ ) {
   $title = $part_referral->referral. " $title";
 }
 
+if ( $cgi->param('cust_classnum') ) {
+  my @classnums = grep /^\d+$/, $cgi->param('cust_classnum');
+  push @search, 'cust_main.classnum IN('.join(',', at classnums).')'
+    if @classnums;
+}
+
 if ( $unapplied ) {
   push @search, FS::cust_credit->unapplied_sql . ' > 0';
 }
diff --git a/httemplate/search/cust_credit_refund.html b/httemplate/search/cust_credit_refund.html
index 361c8ad..75138e9 100644
--- a/httemplate/search/cust_credit_refund.html
+++ b/httemplate/search/cust_credit_refund.html
@@ -85,6 +85,13 @@ if ( $cgi->param('refnum') && $cgi->param('refnum') =~ /^(\d+)$/ ) {
   $title = $part_referral->referral. " $title";
 }
 
+if ( $cgi->param('cust_classnum') ) {
+  my @classnums = grep /^\d+$/, $cgi->param('cust_classnum');
+  push @search, 'cust_main.classnum IN('.join(',', at classnums).')'
+    if @classnums;
+}
+
+
 my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
 push @search, "cust_credit._date >= $beginning ",
               "cust_credit._date <= $ending";
diff --git a/httemplate/search/customer_accounting_summary.html b/httemplate/search/customer_accounting_summary.html
index 0e9e24f..12c8962 100644
--- a/httemplate/search/customer_accounting_summary.html
+++ b/httemplate/search/customer_accounting_summary.html
@@ -142,8 +142,7 @@ $title .=  $sel_part_referral->referral.' '
 
 $title .= 'Customer Accounting Summary Report';
 
-my @custs = ();
- at custs = qsearch('cust_main', {} );
+my @cust_classnums = grep /^\d+$/, $cgi->param('cust_classnum');
 
 my @items  = ('netsales', 'cashflow');
 my @params = ( [], [] );
@@ -167,6 +166,18 @@ my @custnames = ();
 my $status = $cgi->param('status');
 die "invalid status" unless $status =~ /^\w+|$/;
 
+my %search_hash;
+foreach (qw(agentnum refnum status)) {
+  if ( defined $cgi->param($_) ) {
+    $search_hash{$_} = $cgi->param($_);
+  }
+}
+$search_hash{'classnum'} = [ $cgi->param('cust_classnum') ] 
+  if $cgi->param('cust_classnum');
+
+my $query = FS::cust_main::Search->search(\%search_hash);
+my @custs = qsearch($query);
+
 foreach my $cust_main ( @custs ) {
   # XXX should do this in the qsearch
   next unless ($status eq '' || $status eq $cust_main->status); 
diff --git a/httemplate/search/elements/cust_pay_or_refund.html b/httemplate/search/elements/cust_pay_or_refund.html
index dc3cb2a..da887a3 100755
--- a/httemplate/search/elements/cust_pay_or_refund.html
+++ b/httemplate/search/elements/cust_pay_or_refund.html
@@ -239,6 +239,12 @@ if ( $cgi->param('magic') ) {
       $title = $part_referral->referral. " $title";
     }
 
+    if ( $cgi->param('cust_classnum') ) {
+      my @classnums = grep /^\d+$/, $cgi->param('cust_classnum');
+      push @search, 'cust_main.classnum IN('.join(',', at classnums).')'
+        if @classnums;
+    }
+
     if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
       push @search, "custnum = $1";
     }
diff --git a/httemplate/search/prepaid_income.html b/httemplate/search/prepaid_income.html
index ebac5a2..03d121d 100644
--- a/httemplate/search/prepaid_income.html
+++ b/httemplate/search/prepaid_income.html
@@ -129,6 +129,13 @@ if ( $cgi->param('status') =~ /^([a-z]+)$/ ) {
   push @where, FS::cust_main->cust_status_sql . " = '$status'";
 }
 
+if ( $cgi->param('cust_classnum') ) {
+  my @classnums = grep /^\d+$/, $cgi->param('cust_classnum');
+  $link .= ";cust_classnum=$_" foreach @classnums;
+  push @where, 'cust_main.classnum IN('.join(',', at classnums).')'
+    if @classnums;
+}
+
 my %total = ();
 my %total_legacy = ();
 foreach my $agentnum (@agentnums) {
diff --git a/httemplate/search/report_cust_bill_pkg.html b/httemplate/search/report_cust_bill_pkg.html
index 4f6ee78..f121ef4 100644
--- a/httemplate/search/report_cust_bill_pkg.html
+++ b/httemplate/search/report_cust_bill_pkg.html
@@ -15,14 +15,13 @@
      label => emt('Customer status'),
 &>
 
-<!-- customer
 <& /elements/tr-select-cust_class.html,
-     'label'        => emt('Class'),
+     'label'        => emt('Customer class'),
+     'field'        => 'cust_classnum',
      'multiple'     => 1,
      'pre_options'  => [ '' => emt('(none)') ],
      'all_selected' => 1,
 &>
--->
 
 <& /elements/tr-input-beginning_ending.html &>
 
diff --git a/httemplate/search/report_cust_bill_pkg_referral.html b/httemplate/search/report_cust_bill_pkg_referral.html
index b4716d4..47478aa 100644
--- a/httemplate/search/report_cust_bill_pkg_referral.html
+++ b/httemplate/search/report_cust_bill_pkg_referral.html
@@ -23,6 +23,11 @@
   'disable_empty' => 1,
 &>
 
+<& /elements/tr-select-cust_class.html,
+  'field'         => 'cust_classnum',
+  'multiple'      => 1,
+&>
+
 <& /elements/tr-select-pkg_class.html,
   'pre_options' => [ '' => 'all', '0' => '(empty class)' ],
   'disable_empty' => 1,
diff --git a/httemplate/search/report_customer_accounting_summary.html b/httemplate/search/report_customer_accounting_summary.html
index 537abff..8206f34 100755
--- a/httemplate/search/report_customer_accounting_summary.html
+++ b/httemplate/search/report_customer_accounting_summary.html
@@ -25,6 +25,12 @@
 		'label' => 'Customer Status'
     ) %>
 
+    <& /elements/tr-select-cust_class.html,
+                'label' => 'Customer Class',
+                'field' => 'cust_classnum',
+                'multiple' => 1,
+    &>
+
     <& /elements/tr-checkbox.html,
         'label' => 'Separate setup fees',
         'field' => 'setuprecur',
diff --git a/httemplate/search/report_prepaid_income.html b/httemplate/search/report_prepaid_income.html
index 4743e2d..dfb2ea2 100644
--- a/httemplate/search/report_prepaid_income.html
+++ b/httemplate/search/report_prepaid_income.html
@@ -33,6 +33,8 @@
   
   <& /elements/tr-select-cust_main-status.html,
       label => mt('Customer Status') &>
+  <& /elements/tr-select-cust_class.html,
+      label => mt('Customer Class'), field => 'cust_classnum', multiple => 1 &>
   <& /elements/tr-select.html,
       label => 'Invoice Status',
       field => 'mode',
diff --git a/httemplate/search/unearned_detail.html b/httemplate/search/unearned_detail.html
index 02d514c..f61de05 100644
--- a/httemplate/search/unearned_detail.html
+++ b/httemplate/search/unearned_detail.html
@@ -118,6 +118,12 @@ if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
   push @where, "cust_main.agentnum = $1";
 }
 
+if ( $cgi->param('cust_classnum') ) {
+  my @classnums = grep /^\d+$/, $cgi->param('cust_classnum');
+  push @where, 'cust_main.classnum IN('.join(',', at classnums).')'
+    if @classnums;
+}
+
 # no pkgclass, no taxclass, no tax location...
 
 # unearned revenue mode
@@ -235,7 +241,8 @@ my $query = {
 my $ilink = [ "${p}view/cust_bill.cgi?", 'invnum' ];
 my $clink = [ "${p}view/cust_main.cgi?", 'custnum' ];
 
-my $money_char;
+my $conf = new FS::Conf;
+my $money_char = $conf->config('money_char') || '$';
 
 sub money_sub {
   $conf ||= new FS::Conf;

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

Summary of changes:
 FS/FS/Report/Table.pm                              |   37 ++++++++++++++++++++
 FS/FS/Report/Table/Monthly.pm                      |    7 ++++
 FS/FS/cust_bill.pm                                 |    9 +++++
 httemplate/graph/cust_bill_pkg.cgi                 |    8 ++++
 httemplate/graph/elements/monthly.html             |    2 +
 httemplate/graph/money_time.cgi                    |    7 ++++
 httemplate/graph/money_time_daily.cgi              |    6 +++
 httemplate/graph/report_cust_bill_pkg.html         |    6 +++
 httemplate/graph/report_money_time.html            |    5 +++
 httemplate/graph/report_money_time_daily.html      |    5 +++
 httemplate/search/cust_bill.html                   |    4 ++
 httemplate/search/cust_bill_pay.html               |    7 ++++
 httemplate/search/cust_bill_pkg.cgi                |    7 ++++
 httemplate/search/cust_bill_pkg_referral.html      |    5 +++
 httemplate/search/cust_credit.html                 |    6 +++
 httemplate/search/cust_credit_refund.html          |    7 ++++
 httemplate/search/customer_accounting_summary.html |   15 +++++++-
 httemplate/search/elements/cust_pay_or_refund.html |    6 +++
 httemplate/search/prepaid_income.html              |    7 ++++
 httemplate/search/report_cust_bill_pkg.html        |    5 +--
 .../search/report_cust_bill_pkg_referral.html      |    5 +++
 .../search/report_customer_accounting_summary.html |    6 +++
 httemplate/search/report_prepaid_income.html       |    2 +
 httemplate/search/unearned_detail.html             |    9 ++++-
 24 files changed, 177 insertions(+), 6 deletions(-)




More information about the freeside-commits mailing list