add latitude/longitude to prospects, customers and package locations, RT#15539
[freeside.git] / httemplate / view / svc_broadband.cgi
index 22cbb1f..de39f6a 100644 (file)
@@ -13,9 +13,17 @@ my %labels = map { $_ => ( ref($fields->{$_})
                           );
                  } keys %$fields;
 
                           );
                  } keys %$fields;
 
+#my %labels = ();
+
+$labels{'description'} = emt('Description');
 $labels{'router'} = emt('Router');
 $labels{'router'} = emt('Router');
+$labels{'speed_down'} = emt('Download Speed');
+$labels{'speed_up'} = emt('Upload Speed');
+$labels{'ip_addr'} = emt('IP Address');
 $labels{'usergroup'} = emt('RADIUS groups'); #?
 
 $labels{'usergroup'} = emt('RADIUS groups'); #?
 
+$labels{'coordinates'} = 'Latitude/Longitude';
+
 my @fields = (
   'description',
   { field => 'router', value => \&router },
 my @fields = (
   'description',
   { field => 'router', value => \&router },
@@ -24,8 +32,9 @@ my @fields = (
   { field => 'ip_addr', value => \&ip_addr },
   { field => 'sectornum', value => \&sectornum },
   'mac_addr',
   { field => 'ip_addr', value => \&ip_addr },
   { field => 'sectornum', value => \&sectornum },
   'mac_addr',
-  'latitude',
-  'longitude',
+  #'latitude',
+  #'longitude',
+  { field => 'coordinates', value => \&coordinates },
   'altitude',
   'vlan_profile',
   'authkey',
   'altitude',
   'vlan_profile',
   'authkey',
@@ -46,8 +55,9 @@ sub router {
 sub ip_addr {
   my $svc = shift;
   my $ip_addr = $svc->ip_addr;
 sub ip_addr {
   my $svc = shift;
   my $ip_addr = $svc->ip_addr;
-  my $out = $ip_addr . ' (' . 
-    include('/elements/popup_link-ping.html', ip => $ip_addr) . ')';
+  my $out = $ip_addr;
+  $out .= ' (' . include('/elements/popup_link-ping.html', ip => $ip_addr) . ')'
+    if $ip_addr;
   if ( my $addr_block = $svc->addr_block ) {
     $out .= '<br>Netmask: ' . $addr_block->NetAddr->mask .
             '<br>Gateway: ' . $addr_block->ip_gateway;
   if ( my $addr_block = $svc->addr_block ) {
     $out .= '<br>Netmask: ' . $addr_block->NetAddr->mask .
             '<br>Gateway: ' . $addr_block->ip_gateway;
@@ -72,4 +82,19 @@ sub sectornum {
   $link .  $tower_sector->description. ( $link ? '</A>' : '');
 }
 
   $link .  $tower_sector->description. ( $link ? '</A>' : '');
 }
 
+sub coordinates {
+  my $s = shift; #$svc_broadband
+  return '' unless $s->latitude && $s->longitude;
+
+  my $d = $s->description;
+  unless ($d) {
+    my $cust_pkg = $s->cust_svc->cust_pkg;
+    $d = $cust_pkg->cust_main->name_short if $cust_pkg;
+  }
+  
+  #'Latitude: '. $s->latitude. ', Longitude: '. $s->longitude. ' '.
+  $s->latitude. ', '. $s->longitude. ' '.
+    include('/elements/coord-links.html', $s->latitude, $s->longitude, $d);
+}
+
 </%init>
 </%init>