X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Ftower.html;h=fefa31475a249819228f76d3e5499025c4afc511;hp=bbfc1a670b1db024d7436e3ccdcb7e17541d466e;hb=HEAD;hpb=df1ebf662a9fc3f89503036e0dbf6833c1b95f9e diff --git a/httemplate/edit/process/tower.html b/httemplate/edit/process/tower.html index bbfc1a670..fefa31475 100644 --- a/httemplate/edit/process/tower.html +++ b/httemplate/edit/process/tower.html @@ -2,6 +2,42 @@ table => 'tower', viewall_dir => 'browse', process_o2m => { 'table' => 'tower_sector', - 'fields' => [qw( sectorname ip_addr height freq_mhz direction width range )], + 'fields' => [qw( + sectorname ip_addr height freq_mhz direction width + downtilt v_width db_high db_low power line_loss + antenna_gain hardware_typenum + sector_range up_rate_limit down_rate_limit + )], }, + 'precheck_callback' => sub { + my ($cgi) = @_; + my @required_tower_fields; + my @required_sector_fields; + + foreach my $part_svc_broadband_export ( FS::tower_sector->part_export_svc_broadband ) { + if ($part_svc_broadband_export and $part_svc_broadband_export->can('tower_sector_required_fields')) { + my $required_fields = $part_svc_broadband_export->tower_sector_required_fields; + foreach (keys %$required_fields) { + my $fields = $required_fields->{$_}; + push @required_tower_fields, keys(%$fields) if $_ eq "tower"; + push @required_sector_fields, keys(%$fields) if $_ eq "sector"; + } + } + } + + foreach (@required_tower_fields){ + return "The tower $_ field is required" unless $cgi->param($_); + } + + foreach (@required_sector_fields){ + foreach my $k ($cgi->param) { + if ($k =~ /^sectornum\d+$/) { + if ( $cgi->param($k.'_sectorname') ) { + return "The sector(".$cgi->param($k.'_sectorname').") $_ field is required" unless $cgi->param($k.'_'.$_); + } + } + } + } + ''; + }, &>