[freeside-commits] freeside/httemplate/browse tower.html,1.1,1.2
Mark Wells
mark at wavetail.420.am
Tue Jan 17 18:48:06 PST 2012
Update of /home/cvs/cvsroot/freeside/httemplate/browse
In directory wavetail.420.am:/tmp/cvs-serv11201/httemplate/browse
Modified Files:
tower.html
Log Message:
search services by tower/sector, #15950
Index: tower.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/tower.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -d -r1.1 -r1.2
--- tower.html 10 Dec 2011 00:36:47 -0000 1.1
+++ tower.html 18 Jan 2012 02:48:02 -0000 1.2
@@ -9,12 +9,10 @@
'disableable' => 1,
'disabled_statuspos' => 1,
'header' => [ 'Name', 'Sectors', ],
- 'fields' => [ 'towername',
+ 'fields' => [ $tower_sub,
$sector_sub,
],
- 'links' => [ $link,
- '',
- ],
+ 'links' => [ ],
)
%>
<%init>
@@ -22,22 +20,66 @@
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
-my $link = [ "${p}edit/tower.html?", 'towernum' ];
+my $num_svc_links = sub {
+ my ($query_string, $sectors) = @_;
+ my $num_svc_broadband = FS::svc_broadband->count("sectornum IN($sectors)");
+ my $num_svc_acct = FS::svc_acct->count("sectornum IN($sectors)");
-my $sector_sub = sub {
+ {
+ 'data' => $num_svc_broadband ?
+ '<B>'.$num_svc_broadband.'</B>'.
+ ' broadband'
+ : '',
+ 'link' => $p.'search/svc_broadband.cgi?'.$query_string,
+ 'size' => '-1',
+ 'align'=> 'right',
+ 'colspan'=> 2,
+ },
+
+ {
+ 'data' => $num_svc_acct ?
+ '<B>'.$num_svc_acct.'</B>'.
+ ' login'
+ : '',
+ 'link' => $p.'search/svc_acct.cgi?magic=advanced;'.$query_string,
+ 'size' => '-1',
+ 'align'=> 'right',
+ 'colspan'=> 2,
+ },
+};
+
+my $tower_sub = sub {
my $tower = shift;
+ my $sectors = join(',', map { $_->sectornum } $tower->tower_sector);
+ [ #rows
+ [
+ { 'data' => $tower->towername, },
+ { 'data' => ' (edit) ', size => '-1',
+ 'link' => $p.'edit/tower.html?' . $tower->towernum },
+ ],
+ # turn these into rows
+ map { [ $_ ] }
+ &{$num_svc_links}( 'towernum='.$tower->towernum, $sectors )
+ ] #rows
+};
- [ map {
+my $sector_sub = sub {
+ my $tower = shift;
+ [ #rows
+ map {
+ my $sector = $_;
+ my $sectornum = $sector->sectornum;
[
- { 'data' => $_->sectorname,
- 'link' => ( $_->ip_addr ? 'http://'. $_->ip_addr : '' ),
+ {
+ 'data' => $sector->sectorname,
+ 'link' => ( $sector->ip_addr ? 'http://'. $sector->ip_addr : '' ),
},
- ],
- }
- $tower->tower_sector
- ];
+ &{$num_svc_links}( 'sectornum='.$sectornum, $sectornum )
+ ]
+ } $tower->tower_sector
+ ] #rows
};
More information about the freeside-commits
mailing list