diff options
Diffstat (limited to 'httemplate/edit')
-rw-r--r-- | httemplate/edit/deploy_zone-fixed.html | 95 | ||||
-rw-r--r-- | httemplate/edit/deploy_zone-mobile.html | 90 | ||||
-rw-r--r-- | httemplate/edit/elements/edit.html | 2 | ||||
-rwxr-xr-x | httemplate/edit/part_pkg.cgi | 36 | ||||
-rw-r--r-- | httemplate/edit/process/bulk-part_pkg-fcc.html | 43 | ||||
-rw-r--r-- | httemplate/edit/process/deploy_zone-fixed.html | 9 | ||||
-rw-r--r-- | httemplate/edit/process/deploy_zone-mobile.html | 9 | ||||
-rwxr-xr-x | httemplate/edit/process/part_pkg.cgi | 8 |
8 files changed, 278 insertions, 14 deletions
diff --git a/httemplate/edit/deploy_zone-fixed.html b/httemplate/edit/deploy_zone-fixed.html new file mode 100644 index 000000000..1a79500ff --- /dev/null +++ b/httemplate/edit/deploy_zone-fixed.html @@ -0,0 +1,95 @@ +<& elements/edit.html, + 'name_singular' => 'deployment zone', + 'table' => 'deploy_zone', + 'post_url' => popurl(1).'process/deploy_zone-fixed.html', + 'labels' => { + 'description' => 'Description', + 'agentnum' => 'Agent', + 'dbaname' => 'Business name (if different from agent)', + 'technology' => 'Technology', + 'adv_speed_up' => 'Upstream', + 'adv_speed_down' => 'Downstream', + 'cir_speed_up' => 'Upstream', + 'cir_speed_down' => 'Downstream', + 'is_consumer' => 'Consumer/mass market', + 'is_business' => 'Business/government', + 'blocknum' => '', + 'active_date' => 'Active since', + }, + 'fields' => [ + { field => 'zonetype', + type => 'hidden', + value => 'B' + }, + { field => 'is_broadband', + type => 'hidden', + value => 'Y', + }, + 'description', + { field => 'active_date', + type => 'fixed-date', + value => time, + }, + { field => 'agentnum', + type => 'select-agent', + disable_empty => 1, + viewall_right => 'Edit FCC report configuration for all agents', + }, + 'dbaname', + { field => 'technology', + type => 'select', + options => [ map { @$_ } values(%$media_types) ], + labels => $technology_labels, + }, + { field => 'is_consumer', type => 'checkbox', value=>'Y' }, + { field => 'is_business', type => 'checkbox', value=>'Y' }, + { type => 'tablebreak-tr-title', + value => 'Advertised maximum speed (Mbps)' }, + 'adv_speed_down', + 'adv_speed_up', + { type => 'tablebreak-tr-title', + value => 'Contractually guaranteed speed (Mbps)' }, + 'cir_speed_down', + 'cir_speed_up', + + { type => 'tablebreak-tr-title', value => 'Census blocks'}, + { field => 'blocknum', + type => 'deploy_zone_block', + o2m_table => 'deploy_zone_block', + m2_label => ' ', + m2_error_callback => $m2_error_callback, + }, + ], + +&> +<%init> +my $curuser = $FS::CurrentUser::CurrentUser; +die "access denied" + unless $curuser->access_right([ + 'Edit FCC report configuration', + 'Edit FCC report configuration for all agents', + ]); + +my $technology_labels = FS::part_pkg_fcc_option->technology_labels; +my $media_types = FS::part_pkg_fcc_option->media_types; +delete $media_types->{'Mobile Wireless'}; # cause this is the fixed zone page + +my $m2_error_callback = sub { + my ($cgi, $deploy_zone) = @_; + my @blocknums = grep { + /^blocknum\d+/ and length($cgi->param($_.'_censusblock')) + } $cgi->param; + + sort { $a->censusblock <=> $b->censusblock } + map { + my $k = $_; + FS::deploy_zone_block->new({ + blocknum => scalar($cgi->param($k)), + zonenum => $deploy_zone->zonenum, + censusblock => scalar($cgi->param($k.'_censusblock')), + censusyear => scalar($cgi->param($k.'_censusyear')), + }) + } @blocknums; +}; + +</%init> diff --git a/httemplate/edit/deploy_zone-mobile.html b/httemplate/edit/deploy_zone-mobile.html new file mode 100644 index 000000000..8e985b1c9 --- /dev/null +++ b/httemplate/edit/deploy_zone-mobile.html @@ -0,0 +1,90 @@ +<& elements/edit.html, + 'name_singular' => 'deployment zone', + 'table' => 'deploy_zone', + 'post_url' => popurl(1).'process/deploy_zone-mobile.html', + 'labels' => { + 'description' => 'Description', + 'agentnum' => 'Agent', + 'dbaname' => 'Business name (if different from agent)', + 'technology' => 'Technology', + 'spectrum' => 'Spectrum', + 'is_broadband', => 'Broadband Internet', + 'adv_speed_up' => 'Upstream', + 'adv_speed_down' => 'Downstream', + 'is_voice', => 'Voice', + 'vertexnum' => '', + 'active_date' => 'Active since', + }, + 'fields' => [ + { field => 'zonetype', + type => 'hidden', + value => 'P' + }, + 'description', + { field => 'active_date', + type => 'fixed-date', + value => time, + }, + { field => 'agentnum', + type => 'select-agent', + disable_empty => 1, + viewall_right => 'Edit FCC report configuration for all agents', + }, + 'dbaname', + { field => 'technology', + type => 'select', + options => $media_types->{'Mobile Wireless'}, + labels => $technology_labels, + }, + { field => 'spectrum', + type => 'select', + options => [ keys %$spectrum_labels ], + labels => $spectrum_labels, + }, + { field => 'is_broadband', type => 'checkbox', value=>'Y' }, + { field => 'is_voice', type => 'checkbox', value=>'Y' }, + { type => 'tablebreak-tr-title', + value => 'Advertised minimum speed (Mbps)' }, + 'adv_speed_down', + 'adv_speed_up', + { type => 'tablebreak-tr-title', value => 'Footprint'}, + { field => 'vertexnum', + type => 'deploy_zone_vertex', + o2m_table => 'deploy_zone_vertex', + m2_label => ' ', + m2_error_callback => $m2_error_callback, + }, + ], + +&> +<%init> +my $curuser = $FS::CurrentUser::CurrentUser; +die "access denied" + unless $curuser->access_right([ + 'Edit FCC report configuration', + 'Edit FCC report configuration for all agents', + ]); + +my $technology_labels = FS::part_pkg_fcc_option->technology_labels; +my $spectrum_labels = FS::part_pkg_fcc_option->spectrum_labels; +my $media_types = FS::part_pkg_fcc_option->media_types; + +my $m2_error_callback = sub { + my ($cgi, $deploy_zone) = @_; + my @vertexnums = sort { $a <=> $b } grep { + /^vertexnum\d+/ and length($cgi->param($_.'_latitude')) + } $cgi->param; + + map { + my $k = $_; + my $s = 0; + FS::deploy_zone_vertex->new({ + vertexnum => scalar($cgi->param($k)), + zonenum => $deploy_zone->zonenum, + latitude => scalar($cgi->param($k.'_latitude')), + longitude => scalar($cgi->param($k.'_longitude')), + }) + } @vertexnums; +}; + +</%init> diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html index cd97be959..3c9f8b2ab 100644 --- a/httemplate/edit/elements/edit.html +++ b/httemplate/edit/elements/edit.html @@ -307,6 +307,8 @@ Example: % 'disable_empty' => $f->{'disable_empty'}, % #select-reason % 'reason_class' => $f->{'reason_class'}, +% #select-agent +% 'viewall_right' => $f->{'viewall_right'}, % % #selectlayers % 'layer_fields' => $f->{'layer_fields'}, diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index d1b60ec20..a007a9255 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -219,20 +219,26 @@ }, { field=>'pay_weight', type=>'text', size=>6 }, { field=>'credit_weight', type=>'text', size=>6 }, - - ( $conf->exists('cust_pkg-show_fcc_voice_grade_equivalent') - ? ( - { type => 'tablebreak-tr-title', - value => 'FCC Form 477 information', - }, - { field=>'fcc_voip_class', - type=>'select-voip_class', - }, - { field=>'fcc_ds0s', type=>'text', size=>6 }, - ) - : () - ), - + ($fcc_opts ? ( + { type => 'tablebreak-tr-title', + value => 'FCC Form 477 information', + }, + { field => 'fcc_options_string', + type => 'input-fcc_options', + curr_value_callback => sub { + my ($cgi, $part_pkg, $fref) = @_; + if ( $cgi->param('fcc_options_string') ) { + # error redirect + return $cgi->param('fcc_options_string'); + } + my %hash; + %hash = $part_pkg->fcc_options + if ($part_pkg->pkgpart); + return encode_json(\%hash); + }, + }, + ) : () + ), { type => 'columnend' }, { 'type' => $report_option ? 'tablebreak-tr-title' @@ -369,6 +375,8 @@ my $agent_clone_extra_sql = my $conf = new FS::Conf; my $taxproducts = $conf->exists('enable_taxproducts'); +my $fcc_opts = $conf->exists('part_pkg-show_fcc_options'); + my @locales = grep { ! /^en_/i } $conf->config('available-locales'); #should filter from the default locale lang instead of en_ my %locale_labels = map { ( $_ => 'Package -- '. FS::Locales->description($_) ) diff --git a/httemplate/edit/process/bulk-part_pkg-fcc.html b/httemplate/edit/process/bulk-part_pkg-fcc.html new file mode 100644 index 000000000..4a0fb2a22 --- /dev/null +++ b/httemplate/edit/process/bulk-part_pkg-fcc.html @@ -0,0 +1,43 @@ +% if ( keys %error ) { +% foreach my $pkgpart (keys %error) { +% # stuff all the errors back into $cgi +% $cgi->param("error$pkgpart", $error{$pkgpart}); +% } +% my $session = int(rand(4294967296)); #XXX +% my $pref = new FS::access_user_pref({ +% 'usernum' => $FS::CurrentUser::CurrentUser->usernum, +% 'prefname' => "redirect$session", +% 'prefvalue' => $cgi->query_string, +% 'expiration' => time + 3600, #1h? 1m? +% }); +% my $pref_error = $pref->insert; +% if ( $pref_error ) { +% die "FATAL: couldn't even set redirect cookie: $pref_error". +% " attempting to set redirect$session to ". $cgi->query_string."\n"; +% } +<% $cgi->redirect($fsurl.'browse/part_pkg-fcc.html?redirect='.$session) %> +% } else { +<% $cgi->redirect($fsurl.'browse/part_pkg-fcc.html?classnum='.$classnum) %> +% } +<%init> +my $curuser = $FS::CurrentUser::CurrentUser; +my $edit_acl = $curuser->access_right('Edit FCC report configuration'); +my $global_edit_acl = $curuser->access_right('Edit FCC report configuration for all agents'); +die "access denied" unless $edit_acl or $global_edit_acl; + +# non-atomic; report errors but allow successful changes to go through +# not that I even know how you'd get an error doing this + +my %error; +foreach my $param ($cgi->param) { + $param =~ /^pkgpart(\d+)$/ or next; + my $pkgpart = $1; + my $part_pkg = FS::part_pkg->by_key($pkgpart); + my $hashref = decode_json( $cgi->param($param) ); + my $error = $part_pkg->set_fcc_options($hashref); + $error{$pkgpart} = $error if $error; +} + +my $classnum = $cgi->param('classnum'); + +</%init> diff --git a/httemplate/edit/process/deploy_zone-fixed.html b/httemplate/edit/process/deploy_zone-fixed.html new file mode 100644 index 000000000..c14c81c58 --- /dev/null +++ b/httemplate/edit/process/deploy_zone-fixed.html @@ -0,0 +1,9 @@ +<& elements/process.html, + error_redirect => popurl(2).'deploy_zone-fixed.html?', + table => 'deploy_zone', + viewall_dir => 'browse', + process_o2m => + { 'table' => 'deploy_zone_block', + 'fields' => [qw( censusblock censusyear )] + }, +&> diff --git a/httemplate/edit/process/deploy_zone-mobile.html b/httemplate/edit/process/deploy_zone-mobile.html new file mode 100644 index 000000000..c913c5cd6 --- /dev/null +++ b/httemplate/edit/process/deploy_zone-mobile.html @@ -0,0 +1,9 @@ +<& elements/process.html, + error_redirect => popurl(2).'deploy_zone-mobile.html?', + table => 'deploy_zone', + viewall_dir => 'browse', + process_o2m => + { 'table' => 'deploy_zone_vertex', + 'fields' => [qw( latitude longitude )] + }, +&> diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi index 9eb10d276..8e8be853d 100755 --- a/httemplate/edit/process/part_pkg.cgi +++ b/httemplate/edit/process/part_pkg.cgi @@ -114,6 +114,14 @@ my $args_callback = sub { push @args, 'options' => \%options; ### + # fcc options + ### + my $fcc_options_string = $cgi->param('fcc_options_string'); + if ($fcc_options_string) { + push @args, 'fcc_options' => decode_json($fcc_options_string); + } + + ### #pkg_svc ### |