+ my $tower = $self->tower;
+ my %fields = (
+ height => 'Height',
+ freq_mhz => 'Frequency',
+ direction => 'Direction',
+ downtilt => 'Downtilt',
+ width => 'Horiz. width',
+ v_width => 'Vert. width',
+ db_high => 'High quality signal margin',
+ db_low => 'Low quality signal margin',
+ latitude => 'Latitude',
+ longitude => 'Longitude',
+ );
+ my @need;
+ foreach (keys %fields) {
+ if ($self->get($_) eq '' and $tower->get($_) eq '') {
+ push @need, $fields{$_};
+ }
+ }
+ @need;
+}
+
+=item queue_generate_coverage
+
+Starts a job to recalculate the coverage map.
+
+=cut
+
+# XXX move to an export
+
+sub queue_generate_coverage {
+ my $self = shift;
+ my $need_fields = join(',', $self->need_fields_for_coverage);
+ return "$need_fields required" if $need_fields;
+ $self->set('no_regen', 1); # avoid recursion
+ if ( length($self->image) > 0 ) {
+ foreach (qw(image west south east north)) {
+ $self->set($_, '');
+ }
+ my $error = $self->replace;
+ return $error if $error;
+ }
+ my $job = FS::queue->new({
+ job => 'FS::tower_sector::process_generate_coverage',
+ });
+ $job->insert('_JOB', { sectornum => $self->sectornum});
+}
+
+=back
+
+=head1 CLASS METHODS
+
+=over 4
+
+=item part_export
+
+Returns all sector exports. Eventually this may be refined to the level
+of enabling exports on specific sectors.
+
+=cut
+
+sub part_export {
+ my $info = $FS::part_export::exports{'tower_sector'} or return;
+ my @exporttypes = map { dbh->quote($_) } keys %$info or return;
+ qsearch({
+ 'table' => 'part_export',
+ 'extra_sql' => 'WHERE exporttype IN(' . join(',', @exporttypes) . ')'
+ });
+}
+
+=item part_export_svc_broadband
+
+Returns all svc_broadband exports.
+
+=cut
+
+sub part_export_svc_broadband {
+ my $info = $FS::part_export::exports{'svc_broadband'} or return;
+ my @exporttypes = map { dbh->quote($_) } keys %$info or return;
+ qsearch({
+ 'table' => 'part_export',
+ 'extra_sql' => 'WHERE exporttype IN(' . join(',', @exporttypes) . ')'
+ });