X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=FS%2FFS%2Ftower_sector.pm;h=e2dad1b76a36f0e227c44c439f52aff56c65cfe3;hb=d6197d0cce537b7bbdd0f47db1351031e2c79bfa;hp=8b4c2221a5947239e953f0cef37a27ea7317c6ed;hpb=2c5024a05daea660bdd4bbb52212a41aed1664dc;p=freeside.git diff --git a/FS/FS/tower_sector.pm b/FS/FS/tower_sector.pm index 8b4c2221a..e2dad1b76 100644 --- a/FS/FS/tower_sector.pm +++ b/FS/FS/tower_sector.pm @@ -1,7 +1,9 @@ package FS::tower_sector; use base qw( FS::Record ); +use FS::Record qw(dbh qsearch); use Class::Load qw(load_class); +use File::Path qw(make_path); use Data::Dumper; use strict; @@ -87,6 +89,18 @@ The coverage map, as a PNG. The coordinate boundaries of the coverage map. +=item title + +The sector title. + +=item up_rate_limit + +Up rate limit for sector. + +=item down_rate_limit + +down rate limit for sector. + =back =head1 METHODS @@ -140,7 +154,7 @@ sub check { $self->ut_numbern('sectornum') || $self->ut_number('towernum', 'tower', 'towernum') || $self->ut_text('sectorname') - || $self->ut_textn('ip_addr') + || $self->ut_ip46n('ip_addr') || $self->ut_floatn('height') || $self->ut_numbern('freq_mhz') || $self->ut_numbern('direction') @@ -149,6 +163,8 @@ sub check { || $self->ut_numbern('downtilt') || $self->ut_floatn('sector_range') || $self->ut_numbern('margin') + || $self->ut_numbern('up_rate_limit') + || $self->ut_numbern('down_rate_limit') || $self->ut_anything('image') || $self->ut_sfloatn('west') || $self->ut_sfloatn('east') @@ -236,6 +252,27 @@ sub queue_generate_coverage { =back +=head1 CLASS METHODS + +=over 4 + +=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) . ')' + }); +} + +=back + =head1 SUBROUTINES =over 4 @@ -253,13 +290,17 @@ PARAMS must include 'sectornum'. sub process_generate_coverage { my $job = shift; my $param = shift; - warn Dumper($param); - $job->update_statustext('0,generating map'); + $job->update_statustext('0,generating map') if $job; my $sectornum = $param->{sectornum}; - my $sector = FS::tower_sector->by_key($sectornum); + my $sector = FS::tower_sector->by_key($sectornum) + or die "sector $sectornum does not exist"; my $tower = $sector->tower; load_class('Map::Splat'); + # since this is still experimental, put it somewhere we can find later + my $workdir = "$FS::UID::cache_dir/cache.$FS::UID::datasrc/" . + "generate_coverage/sector$sectornum-". time; + make_path($workdir); my $splat = Map::Splat->new( lon => $tower->longitude, lat => $tower->latitude, @@ -271,6 +312,7 @@ sub process_generate_coverage { v_width => $sector->v_width, max_loss => $sector->margin, min_loss => $sector->margin - 80, + dir => $workdir, ); $splat->calculate; @@ -285,6 +327,17 @@ sub process_generate_coverage { die $error if $error; } +sub _upgrade_data { + + require FS::Misc::FixIPFormat; + FS::Misc::FixIPFormat::fix_bad_addresses_in_table( + 'tower_sector', 'sectornum', 'ip_addr', + ); + + ''; + +} + =head1 BUGS =head1 SEE ALSO @@ -294,4 +347,3 @@ L, L, schema.html from the base documentation. =cut 1; -