X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fsvc_Tower_Mixin.pm;h=dab096ddc2f4b80faf5eae299d278aa25ace4b11;hb=5cda22da9d0771878b5256895e1655d75f3ea1f6;hp=850805357808716a333c6cac91aa5d7bdb1e2c27;hpb=efa799391aeba085b65145428cab1cf1074d3f6d;p=freeside.git diff --git a/FS/FS/svc_Tower_Mixin.pm b/FS/FS/svc_Tower_Mixin.pm index 850805357..dab096ddc 100644 --- a/FS/FS/svc_Tower_Mixin.pm +++ b/FS/FS/svc_Tower_Mixin.pm @@ -30,14 +30,20 @@ sub tower_sector_sql { my( $class, $params ) = @_; return () unless keys %$params; - my @where; + my @where = (); for my $field (qw(towernum sectornum)) { my $value = $params->{$field} or next; if ( ref $value and grep { $_ } @$value ) { 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+)$/ ) {