X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Ftower.html;h=fefa31475a249819228f76d3e5499025c4afc511;hp=d14ac56f8a161f96d9efc8b4478a2081c98f3c58;hb=3f2a7b01b59902faed5767d81e2959e131bdbdfd;hpb=4b05b20576ddb14577d59c87c8257c6804449410 diff --git a/httemplate/edit/process/tower.html b/httemplate/edit/process/tower.html index d14ac56f8..fefa31475 100644 --- a/httemplate/edit/process/tower.html +++ b/httemplate/edit/process/tower.html @@ -4,8 +4,40 @@ process_o2m => { 'table' => 'tower_sector', 'fields' => [qw( sectorname ip_addr height freq_mhz direction width - downtilt v_width margin - sector_range + 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.'_'.$_); + } + } + } + } + ''; + }, &>