[freeside-commits] branch FREESIDE_3_BRANCH updated. c92138414abde6af459af5ae28b1f566da4d0360

Ivan ivan at 420.am
Thu Oct 10 23:51:00 PDT 2013


The branch, FREESIDE_3_BRANCH has been updated
       via  c92138414abde6af459af5ae28b1f566da4d0360 (commit)
      from  e528e7a30878430d357ac382c691b5d61580b0d1 (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 c92138414abde6af459af5ae28b1f566da4d0360
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Thu Oct 10 23:50:59 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