disable old no_censustract and with_geocode search options and move to cust_pkg searc...
authorMark Wells <mark@freeside.biz>
Fri, 25 Oct 2013 00:26:00 +0000 (17:26 -0700)
committerMark Wells <mark@freeside.biz>
Fri, 25 Oct 2013 00:26:00 +0000 (17:26 -0700)
FS/FS/cust_main/Search.pm
FS/FS/cust_pkg.pm
httemplate/search/report_cust_main.html
httemplate/search/report_cust_pkg.html

index 182527f..70d12c9 100644 (file)
@@ -668,22 +668,6 @@ sub search {
     unless $params->{'cancelled_pkgs'};
 
   ##
-  # parse without census tract checkbox
-  ##
-
-  push @where, "(ship_location.censustract = '' or ship_location.censustract is null)"
-    if $params->{'no_censustract'};
-
-  ##
-  # parse with hardcoded tax location checkbox
-  ##
-
-  my $tax_prefix = FS::Conf->new->exists('tax-ship_location') ? 'ship_' 
-                                                              : 'bill_';
-  push @where, "${tax_prefix}location.geocode is not null"
-    if $params->{'with_geocode'};
-
-  ##
   # "with email address(es)" checkbox
   ##
 
@@ -950,19 +934,6 @@ sub search {
 
   }
 
-  if ( $params->{'with_geocode'} ) {
-
-    unshift @extra_headers, 'Tax location override', 'Calculated tax location';
-    unshift @extra_fields, sub { my $c = shift; $c->get('geocode'); },
-                           sub { my $c = shift;
-                                 $c->set('geocode', '');
-                                 $c->geocode('cch'); #XXX only cch right now
-                               };
-    push @select, 'geocode';
-    push @select, 'zip' unless grep { $_ eq 'zip' } @select;
-    push @select, 'ship_zip' unless grep { $_ eq 'ship_zip' } @select;
-  }
-
   my $select = join(', ', @select);
 
   my $sql_query = {
@@ -976,7 +947,7 @@ sub search {
     'extra_headers' => \@extra_headers,
     'extra_fields'  => \@extra_fields,
   };
-  warn Data::Dumper::Dumper($sql_query);
+  #warn Data::Dumper::Dumper($sql_query);
   $sql_query;
 
 }
index face10a..771d3ec 100644 (file)
@@ -4287,21 +4287,29 @@ For FCC 477 reporting, mostly.
 
 =item location_cust
 
-Limit to packages whose service location is the same as the customer's 
+Limit to packages whose service locations are the same as the customer's 
 default service location.
 
 =item location_nocust
 
-Limit to packages whose service location is not the customer's default 
+Limit to packages whose service locations are not the customer's default 
 service location.
 
 =item location_census
 
-Limit to packages whose service location has a census tract.
+Limit to packages whose service locations have census tracts.
 
 =item location_nocensus
 
-Limit to packages whose service location doesn't have a census tract.
+Limit to packages whose service locations do not have a census tract.
+
+=item location_geocode
+
+Limit to packages whose locations have geocodes.
+
+=item location_geocode
+
+Limit to packages whose locations do not have geocodes.
 
 =back
 
@@ -4545,6 +4553,10 @@ sub search {
     my $op = $params->{location_census} ? "IS NOT NULL" : "IS NULL";
     push @where, "cust_location.censustract $op";
   }
+  if ( $params->{location_geocode} xor $params->{location_nogeocode} ) {
+    my $op = $params->{location_geocode} ? "IS NOT NULL" : "IS NULL";
+    push @where, "cust_location.geocode $op";
+  }
 
   ###
   # parse part_pkg
index ebff7fa..1ceb48e 100755 (executable)
     &>
 
     <TR>
-      <TD ALIGN="right" VALIGN="center"><% mt('Without census tract') |h %></TD>
-        <TD><INPUT TYPE="checkbox" NAME="no_censustract"></TD>
-    </TR>
-
-%   if ( $conf->exists('enable_taxproducts') ) {
-
-      <TR>
-        <TD ALIGN="right" VALIGN="center"><% mt('With hardcoded tax location') |h %></TD>
-          <TD><INPUT TYPE="checkbox" NAME="with_geocode"></TD>
-      </TR>
-
-%   }
-
-    <TR>
       <TD ALIGN="right" VALIGN="center"><% mt('With email address(es)') |h %></TD>
         <TD><INPUT TYPE="checkbox" NAME="with_email"></TD>
     </TR>
index b3f2004..e75a098 100755 (executable)
     <& /elements/tr-title.html, value => mt('Location search options') &>
 
 %   my @location_options = qw(cust nocust census nocensus);
+%   if ( $conf->exists('enable_taxproducts') ) {
+%     push @location_options, 'geocode', 'nogeocode';
+%   }
     <& /elements/tr-checkbox-multiple.html,
                 'label'   => 'Where package location:',
                 'field'   => 'loc',
                                'nocust'   => "is not the customer's default location",
                                'census'   => "has a census tract",
                                'nocensus' => "does not have a census tract",
+                               'nogeocode'=> 'has an implicit tax location',
+                               'geocode'  => 'has a hardcoded tax location',
                              },
                 'value'   => { map { $_ => 1 } @location_options },
     &>
@@ -274,4 +279,5 @@ my %checkbox = (
   'cancel'    => 1,
 );
 
+my $conf = FS::Conf->new;
 </%once>