[freeside-commits] freeside/httemplate/elements select-tower_sector.html, 1.1.2.5, 1.1.2.6
Mark Wells
mark at wavetail.420.am
Thu Feb 9 17:58:21 PST 2012
Update of /home/cvs/cvsroot/freeside/httemplate/elements
In directory wavetail.420.am:/tmp/cvs-serv21127/httemplate/elements
Modified Files:
Tag: FREESIDE_2_3_BRANCH
select-tower_sector.html
Log Message:
allow towers without sectors, #16398 continued
Index: select-tower_sector.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/select-tower_sector.html,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -w -d -r1.1.2.5 -r1.1.2.6
--- select-tower_sector.html 25 Jan 2012 20:36:33 -0000 1.1.2.5
+++ select-tower_sector.html 10 Feb 2012 01:58:19 -0000 1.1.2.6
@@ -40,12 +40,28 @@
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>
More information about the freeside-commits
mailing list