summaryrefslogtreecommitdiff
path: root/httemplate/elements/select-tower_sector.html
diff options
context:
space:
mode:
authormark <mark>2012-02-10 01:58:08 +0000
committermark <mark>2012-02-10 01:58:08 +0000
commitc81adbf7bbaa537b650f39bb76ce0b7b8c069450 (patch)
treecf717f829697f1827b555922734e50d5e5c3ccb8 /httemplate/elements/select-tower_sector.html
parent8e4c66cfb8aaf0aee2d1142636e53d0e17d11d4f (diff)
allow towers without sectors, #16398 continued
Diffstat (limited to 'httemplate/elements/select-tower_sector.html')
-rw-r--r--httemplate/elements/select-tower_sector.html16
1 files changed, 16 insertions, 0 deletions
diff --git a/httemplate/elements/select-tower_sector.html b/httemplate/elements/select-tower_sector.html
index c783c4b57..a16d3bfa0 100644
--- a/httemplate/elements/select-tower_sector.html
+++ b/httemplate/elements/select-tower_sector.html
@@ -40,12 +40,28 @@ change_towernum('');
my %opt = @_;
my %sectors_of;
+my %default_of;
if ( $opt{'multiple'} ) {
foreach my $sector ( qsearch('tower_sector',{}) ) {
$sectors_of{$sector->towernum} ||= {};
$sectors_of{$sector->towernum}->{$sector->sectornum} = $sector->sectorname;
$sectors_of{''}->{$sector->sectornum} = $sector->description;
+ $default_of{$sector->towernum} = $sector->sectornum
+ if $sector->sectorname eq '_default';
}
}
+foreach my $towernum (keys %sectors_of) {
+ # hide default sectors for towers that have real sectors defined
+ my $sectornum = $default_of{$towernum};
+ if ( keys %{ $sectors_of{$towernum} } > 1 ) {
+ delete $sectors_of{$towernum}->{$sectornum};
+ delete $sectors_of{''}->{$sectornum};
+ }
+ else {
+ # show default sectorname as '(all)'
+ $sectors_of{$towernum}->{$sectornum} = '(all)'
+ }
+}
+
my $empty_label = $opt{'empty_label'} || 'Include services with no tower/sector';
</%init>