diff options
author | Christopher Burger <burgerc@freeside.biz> | 2019-05-03 13:11:37 -0400 |
---|---|---|
committer | Christopher Burger <burgerc@freeside.biz> | 2019-05-03 13:11:37 -0400 |
commit | f6ee9a26cb655615c239b13c334b3accb92c6d0f (patch) | |
tree | 0b372758a63f5d7991f5919b04011dc3b2ff923c /httemplate/edit/process | |
parent | 5cb528685e2222dfd1740a5c3b5134d00ab254ae (diff) |
RT# 83259 - adding/editing tower sector will no check for required fields prior to exporting if able to export
Diffstat (limited to 'httemplate/edit/process')
-rw-r--r-- | httemplate/edit/process/tower.html | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/httemplate/edit/process/tower.html b/httemplate/edit/process/tower.html index 8f62c4bec..fefa31475 100644 --- a/httemplate/edit/process/tower.html +++ b/httemplate/edit/process/tower.html @@ -9,4 +9,35 @@ 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.'_'.$_); + } + } + } + } + ''; + }, &> |