Index: /trunk/DNSDB.pm
===================================================================
--- /trunk/DNSDB.pm	(revision 714)
+++ /trunk/DNSDB.pm	(revision 715)
@@ -4200,5 +4200,4 @@
   my $perpage = ($args{nrecs} ? $args{nrecs} : $self->{perpage});
 
-
 ##fixme:  do we need a knob to twist to switch from unix epoch to postgres time string?
   my @bindvars;
@@ -4230,5 +4229,5 @@
 
   # Filtering on other fields
-  foreach (qw(type distance weight port ttl description)) {
+  foreach (qw(type distance weight port ttl description location)) {
     if ($args{$_}) {
       $sql .= " AND $_ ~* ?";
@@ -5184,13 +5183,16 @@
 # Get a list of zone names and IDs that records for a passed CIDR block are within.
 # Optionally restrict to a specific location/view
+# Optionally leave off the default_location field
 sub getZonesByCIDR {
   my $self = shift;
   my $dbh = $self->{dbh};
   my %args = @_;
-
-  my $sql = "SELECT rdns_id,revnet,default_location FROM revzones WHERE (revnet >>= ? OR revnet <<= ?)".
-        ($args{location} ? " AND default_location = ?" : '');
+  $args{return_location} = 1 if !defined($args{return_location});
+
+  my $sql = "SELECT rdns_id,revnet".($args{return_location} ? ',default_location' : '').
+	" FROM revzones WHERE (revnet >>= ? OR revnet <<= ?)".
+        (defined($args{location}) ? " AND default_location = ?" : '');
   my @svals = ($args{cidr}, $args{cidr});
-  push @svals, $args{location} if $args{location};
+  push @svals, $args{location} if defined $args{location};
 
   my $result = $dbh->selectall_arrayref($sql, { Slice => {} }, @svals );
