From: Christopher Burger Date: Wed, 1 May 2019 16:06:18 +0000 (-0400) Subject: RT# 83205 - fixed error with fields being sticky on error X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=a5496f56c0c9755e1aa268b9a979cd81e59243c3;hp=74200be4e8f20a86e103e447bb19c301abffdb4b RT# 83205 - fixed error with fields being sticky on error --- diff --git a/httemplate/edit/tower.html b/httemplate/edit/tower.html index dfebc0031..f2faa5a9a 100644 --- a/httemplate/edit/tower.html +++ b/httemplate/edit/tower.html @@ -50,16 +50,20 @@ my $m2_error_callback = sub { # reconstruct the list sectorname ip_addr height freq_mhz direction width tilt v_width db_high db_low sector_range up_rate_limit down_rate_limit ); - map { - my $k = $_; - new FS::tower_sector { - 'towernum' => $object->towernum, - 'sectornum' => scalar( $cgi->param($k) ), - map { $_ => scalar( $cgi->param($k.'_'.$_) ) } @fields, - }; - } grep length($cgi->param($_.'_sectorname')), - grep /^sectornum\d+$/, - ($cgi->param); + my @sectors; + foreach my $k ($cgi->param) { + if ($k =~ /^sectornum\d+$/) { + my $sectornum = $cgi->param($k); + my $sector = FS::tower_sector->new({ + 'sectornum' => $sectornum, + 'towernum' => $object->towernum, + map { $_ => scalar($cgi->param($k.'_'.$_)) } @fields, + }); + push @sectors, $sector if length($sector->sectorname) && $sector->sectorname ne '_default'; + } + } + + return @sectors; }; my $default_ip_addr_callback = sub {