summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2015-08-31 22:16:37 -0700
committerMark Wells <mark@freeside.biz>2015-08-31 22:17:07 -0700
commit6163b943f45e083a87cc03344eb775a9edd553ce (patch)
tree1d638c8afaaa7465f6c95e5116b898bedb8dc661 /FS
parent653b350d0f8cc69e66e265537a3775f512fd5dda (diff)
allow services with a tower but no sector to appear in search results, #33056
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/svc_Tower_Mixin.pm8
1 files changed, 7 insertions, 1 deletions
diff --git a/FS/FS/svc_Tower_Mixin.pm b/FS/FS/svc_Tower_Mixin.pm
index 2555b9e50..d6776791c 100644
--- a/FS/FS/svc_Tower_Mixin.pm
+++ b/FS/FS/svc_Tower_Mixin.pm
@@ -27,7 +27,13 @@ sub tower_sector_sql {
my $in = join(',', map { /^(\d+)$/ ? $1 : () } @$value);
my @orwhere;
push @orwhere, "tower_sector.$field IN ($in)" if $in;
- push @orwhere, "tower_sector.$field IS NULL" if grep /^none$/, @$value;
+ if ( grep /^none$/, @$value ) {
+ # then allow this field to be null
+ push @orwhere, "tower_sector.$field IS NULL";
+ # and if this field is the sector, also allow the default sector
+ # on the tower
+ push @orwhere, "sectorname = '_default'" if $field eq 'sectornum';
+ }
push @where, '( '.join(' OR ', @orwhere).' )';
}
elsif ( $value =~ /^(\d+)$/ ) {