[freeside-commits] branch master updated. 4adeee8e1912405d691b7b24f016760fde151adf

Ivan ivan at 420.am
Thu Oct 10 23:50:59 PDT 2013


The branch, master has been updated
       via  4adeee8e1912405d691b7b24f016760fde151adf (commit)
      from  0b86d4cbe544bafe19f1707762667eabe5065714 (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 4adeee8e1912405d691b7b24f016760fde151adf
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Thu Oct 10 23:50:58 2013 -0700

    add customer class to advanced invoice report, RT#22851

diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm
index a61adde..66d98c2 100644
--- a/FS/FS/cust_bill.pm
+++ b/FS/FS/cust_bill.pm
@@ -3379,13 +3379,25 @@ sub search_sql_where {
     push @search, "cust_bill.custnum = $1";
   }
 
-  #customer classnum
+  #customer classnum (false laziness w/ cust_main/Search.pm)
   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;
+
+    my @classnum = ref( $param->{'cust_classnum'} )
+                     ? @{ $param->{'cust_classnum'} }
+                     :  ( $param->{'cust_classnum'} );
+
+    @classnum = grep /^(\d*)$/, @classnum;
+
+    if ( @classnum ) {
+      push @search, '( '. join(' OR ', map {
+                                             $_ ? "cust_main.classnum = $_"
+                                                : "cust_main.classnum IS NULL"
+                                           }
+                                           @classnum
+                              ).
+                    ' )';
+    }
+
   }
 
   #_date

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

Summary of changes:
 FS/FS/cust_bill.pm |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)




More information about the freeside-commits mailing list