[freeside-commits] branch master updated. 97356847f631d26f42a8fe0ea7adac580e41549c

Mark Wells mark at 420.am
Mon Mar 25 16:36:28 PDT 2013


The branch, master has been updated
       via  97356847f631d26f42a8fe0ea7adac580e41549c (commit)
      from  dfc85a4245f2d15f258d840b98f0508c50228e40 (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 97356847f631d26f42a8fe0ea7adac580e41549c
Author: Mark Wells <mark at freeside.biz>
Date:   Mon Mar 25 16:35:52 2013 -0700

    ANY/ALL customer tag search option, #19166

diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm
index 2c7c046..f799b51 100644
--- a/FS/FS/cust_main/Search.pm
+++ b/FS/FS/cust_main/Search.pm
@@ -794,11 +794,19 @@ sub search {
     @tagnums = grep /^(\d+)$/, @tagnums;
 
     if ( @tagnums ) {
+      if ( $params->{'all_tags'} ) {
+        foreach ( @tagnums ) {
+          push @where, 'exists(select 1 from cust_tag where '.
+                       'cust_tag.custnum = cust_main.custnum and tagnum = '.
+                       $_ . ')';
+        }
+      } else { # matching any tag, not all
 	my $tags_where = "0 < (select count(1) from cust_tag where " 
 		. " cust_tag.custnum = cust_main.custnum and tagnum in ("
 		. join(',', @tagnums) . "))";
 
 	push @where, $tags_where;
+      }
     }
   }
 
diff --git a/httemplate/search/cust_main.html b/httemplate/search/cust_main.html
index 8b39ea9..af9e959 100755
--- a/httemplate/search/cust_main.html
+++ b/httemplate/search/cust_main.html
@@ -46,6 +46,7 @@ my @scalars = qw (
   custbatch usernum
   cancelled_pkgs
   cust_fields flattened_pkgs
+  all_tags
 );
 
 for my $param ( @scalars ) {
diff --git a/httemplate/search/report_cust_main.html b/httemplate/search/report_cust_main.html
index acc49ae..13f9396 100755
--- a/httemplate/search/report_cust_main.html
+++ b/httemplate/search/report_cust_main.html
@@ -96,11 +96,21 @@
       </TR>
 %   }
 
-    <& /elements/tr-select-cust_tag.html,
-                  'cgi'		 => $cgi,
-                  'is_report'    => 1,
-                  'multiple'     => 1,
-    &>
+      <TR>
+        <TD ALIGN="right">Tags</TD>
+        <TD>
+            <& /elements/select-cust_tag.html,
+                          'cgi'	        => $cgi,
+                          'is_report'   => 1,
+                          'multiple'    => 1,
+            &>
+          <DIV STYLE="display:inline-block; vertical-align:baseline">
+            <INPUT TYPE="radio" NAME="all_tags" VALUE="0" CHECKED> Any of these
+            <BR>
+            <INPUT TYPE="radio" NAME="all_tags" VALUE="1"> All of these
+          </DIV>
+        </TD>
+      </TR>
 
     <& /elements/tr-select-payby.html,
                   'payby_type'   => 'cust',

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

Summary of changes:
 FS/FS/cust_main/Search.pm               |    8 ++++++++
 httemplate/search/cust_main.html        |    1 +
 httemplate/search/report_cust_main.html |   20 +++++++++++++++-----
 3 files changed, 24 insertions(+), 5 deletions(-)




More information about the freeside-commits mailing list