2 name_singular => 'tower',
4 viewall_dir => 'browse',
5 html_init => include('/elements/mapselect.html'),
6 fields => [ 'towername',
7 { field=>'disabled', type=>'checkbox', value=>'Y', },
8 { field=>'color', type=>'pickcolor' },
9 { field => 'default_ip_addr',
10 curr_value_callback => $default_ip_addr_callback },
16 # { field => 'sectornum',
17 # type => 'tower_sector',
18 # o2m_table => 'tower_sector',
19 # m2_label => 'Sector',
20 # m2_error_callback => $m2_error_callback,
22 { type => 'tower_sectors',
24 # does its own o2m-thing
27 labels => { 'towernum' => 'Tower',
28 'towername' => 'Name',
29 'sectornum' => 'Sector',
30 'disabled' => 'Disabled',
31 'default_ip_addr' => 'Tower IP address',
32 'latitude' => 'Latitude',
33 'longitude' => 'Longitude',
34 'altitude' => 'Altitude (feet)',
35 'height' => 'Tower height (feet)',
36 'veg_height' => 'Vegetation height (feet)',
42 my $m2_error_callback = sub { # reconstruct the list
43 my ($cgi, $object) = @_;
46 sectorname ip_addr height freq_mhz direction width tilt v_width db_high db_low sector_range
51 new FS::tower_sector {
52 'towernum' => $object->towernum,
53 'sectornum' => scalar( $cgi->param($k) ),
54 map { $_ => scalar( $cgi->param($k.'_'.$_) ) } @fields,
56 } grep length($cgi->param($_.'_sectorname')),
57 grep /^sectornum\d+$/,
61 my $default_ip_addr_callback = sub {
62 my ($cgi, $object) = @_;
63 my $sector = $object ? $object->default_sector : '';
64 $sector ? $sector->ip_addr : '';