add "with postal invoicing" to customer search, RT#14148
authorIvan Kohler <ivan@freeside.biz>
Tue, 26 Mar 2013 06:45:45 +0000 (23:45 -0700)
committerIvan Kohler <ivan@freeside.biz>
Tue, 26 Mar 2013 06:45:45 +0000 (23:45 -0700)
FS/FS/cust_main/Search.pm
httemplate/search/cust_main.html
httemplate/search/report_cust_main.html

index f799b51..d8f620f 100644 (file)
@@ -646,6 +646,16 @@ sub search {
     if $params->{'with_email'};
 
   ##
+  # "with postal mail invoices" checkbox
+  ##
+
+  push @where,
+    "EXISTS ( SELECT 1 FROM cust_main_invoice
+                WHERE cust_main_invoice.custnum = cust_main.custnum
+                  AND dest = 'POST' )"
+    if $params->{'POST'};
+
+  ##
   # "without postal mail invoices" checkbox
   ##
 
index af9e959..24348ff 100755 (executable)
@@ -42,7 +42,7 @@ my %search_hash = ();
 #scalars
 my @scalars = qw (
   agentnum status address zip paydate_year paydate_month invoice_terms
-  no_censustract with_geocode with_email no_POST
+  no_censustract with_geocode with_email POST no_POST
   custbatch usernum
   cancelled_pkgs
   cust_fields flattened_pkgs
index 13f9396..bac4346 100755 (executable)
     </TR>
 
     <TR>
+      <TD ALIGN="right" VALIGN="center"><% mt('With postal mail invoices') |h %></TD>
+        <TD><INPUT TYPE="checkbox" NAME="POST" ID="POST" onClick="POST_changed();"></TD>
+    </TR>
+
+    <TR>
       <TD ALIGN="right" VALIGN="center"><% mt('Without postal mail invoices') |h %></TD>
-        <TD><INPUT TYPE="checkbox" NAME="no_POST"></TD>
+        <TD><INPUT TYPE="checkbox" NAME="no_POST" ID="no_POST" onClick="no_POST_changed();"></TD>
     </TR>
 
+    <SCRIPT TYPE="text/javascript">
+      function POST_changed() {
+        if ( document.getElementById('POST').checked == true ) {
+          document.getElementById('no_POST').checked = false;
+        }
+      }
+      function no_POST_changed() {
+        if ( document.getElementById('no_POST').checked == true ) {
+          document.getElementById('POST').checked = false;
+        }
+      }
+    </SCRIPT>
+
     <TR>
       <TH CLASS="background" COLSPAN=2>&nbsp;</TH>
     </TR>