diff options
| author | Christopher Burger <burgerc@freeside.biz> | 2019-05-03 13:11:37 -0400 |
|---|---|---|
| committer | Christopher Burger <burgerc@freeside.biz> | 2019-05-03 15:37:09 -0400 |
| commit | a17567f9953e53da23a42a70e4cb981b1c7cf6f5 (patch) | |
| tree | 159ef66a2cd6eec1e2b09f4324021a6e38846d84 /httemplate | |
| parent | 635874f1ea13ab971d2f8b95bfd0ca25eed0aaef (diff) | |
RT# 83259 - adding/editing tower sector will no check for required fields prior to exporting if able to export
Diffstat (limited to 'httemplate')
| -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 ba7309c99..3bf6cdb2a 100644 --- a/httemplate/edit/process/tower.html +++ b/httemplate/edit/process/tower.html @@ -8,4 +8,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.'_'.$_); + } + } + } + } + ''; + }, &> |
