add advertising source to advanced customer report, RT#18354
authorIvan Kohler <ivan@freeside.biz>
Thu, 28 Jun 2012 22:22:15 +0000 (15:22 -0700)
committerIvan Kohler <ivan@freeside.biz>
Thu, 28 Jun 2012 22:22:15 +0000 (15:22 -0700)
FS/FS/cust_main/Search.pm
httemplate/search/cust_main.html
httemplate/search/report_cust_main.html

index 3a8acb2..b528a68 100644 (file)
@@ -577,8 +577,17 @@ sub search {
   ###
   # refnum
   ###
-  if ( $params->{'refnum'} =~ /^(\d+)$/ ) {
-    push @where, "refnum = $1";
+  if ( $params->{'refnum'}  ) {
+
+    my @refnum = ref( $params->{'refnum'} )
+                   ? @{ $params->{'refnum'} }
+                   :  ( $params->{'refnum'} );
+
+    @refnum = grep /^(\d*)$/, @refnum;
+
+    push @where, '( '. join(' OR ', map "cust_main.refnum = $_", @refnum ). ' )'
+      if @refnum;
+
   }
 
   ##
index cc71672..e164b98 100755 (executable)
@@ -45,7 +45,6 @@ my @scalars = qw (
   no_censustract with_geocode custbatch usernum
   cancelled_pkgs
   cust_fields flattened_pkgs
-  refnum
 );
 
 for my $param ( @scalars ) {
@@ -54,7 +53,7 @@ for my $param ( @scalars ) {
 }
 
 #lists
-for my $param (qw( classnum payby tagnum )) {
+for my $param (qw( classnum refnum payby tagnum )) {
   $search_hash{$param} = [ $cgi->param($param) ];
 }
 
index 04e04ee..39cf695 100755 (executable)
                   'all_selected' => 1,
     &>
 
+    <& /elements/tr-select-part_referral.html,
+                  'label'        => emt('Advertising Source'),
+                  'multiple'     => 1,
+                  'all_selected' => 1,
+    &>
+
     <TR>
       <TD ALIGN="right" VALIGN="center"><% mt('Address') |h %></TD>
       <TD><INPUT TYPE="text" NAME="address" SIZE=54></TD>
     &>
 
     <TR>
-      <TD ALIGN="right" VALIGN="center"><% mt('Include cancelled packages') |h %></TD>
-        <TD><INPUT TYPE="checkbox" NAME="cancelled_pkgs"></TD>
-    </TR>
-
-    <TR>
       <TD ALIGN="right" VALIGN="center"><% mt('Without census tract') |h %></TD>
         <TD><INPUT TYPE="checkbox" NAME="no_censustract"></TD>
     </TR>
       <TD ALIGN="right" VALIGN="center"><% mt('Add package columns') |h %></TD>
         <TD><INPUT TYPE="checkbox" NAME="flattened_pkgs"></TD>
     </TR>
+
+    <TR>
+      <TD ALIGN="right" VALIGN="center"><% mt('Include cancelled packages') |h %></TD>
+        <TD><INPUT TYPE="checkbox" NAME="cancelled_pkgs"></TD>
+    </TR>
+
   </TABLE>
 
 <BR>