[freeside-commits] branch FREESIDE_3_BRANCH updated. 6776904eea418b12bec7f1aa0296e9384981d07a

Mark Wells mark at 420.am
Mon Aug 31 22:17:29 PDT 2015


The branch, FREESIDE_3_BRANCH has been updated
       via  6776904eea418b12bec7f1aa0296e9384981d07a (commit)
      from  91fe0dc3740da80dfdae9a291f4ff11bab11df0b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 6776904eea418b12bec7f1aa0296e9384981d07a
Author: Mark Wells <mark at freeside.biz>
Date:   Mon Aug 31 22:16:37 2015 -0700

    allow services with a tower but no sector to appear in search results, #33056

diff --git a/FS/FS/svc_Tower_Mixin.pm b/FS/FS/svc_Tower_Mixin.pm
index 3da07c1..dab096d 100644
--- a/FS/FS/svc_Tower_Mixin.pm
+++ b/FS/FS/svc_Tower_Mixin.pm
@@ -37,7 +37,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+)$/ ) {
diff --git a/httemplate/elements/select-tower_sector.html b/httemplate/elements/select-tower_sector.html
index a16d3bf..59b0163 100644
--- a/httemplate/elements/select-tower_sector.html
+++ b/httemplate/elements/select-tower_sector.html
@@ -12,7 +12,7 @@
     table       => 'tower',
     name_col    => 'towername',
     id          => 'towernum',
-    field       => 'dummy_towernum',
+    field       => 'towernum',
     onchange    => 'change_towernum(this.value);',
     element_etc => 'STYLE="vertical-align:top"',
 &>
@@ -63,5 +63,5 @@ foreach my $towernum (keys %sectors_of) {
   }
 }
 
-my $empty_label = $opt{'empty_label'} || 'Include services with no tower/sector';
+my $empty_label = $opt{'empty_label'} || 'Include services with no sector';
 </%init>

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/svc_Tower_Mixin.pm                     |    8 +++++++-
 httemplate/elements/select-tower_sector.html |    4 ++--
 2 files changed, 9 insertions(+), 3 deletions(-)




More information about the freeside-commits mailing list