From a5496f56c0c9755e1aa268b9a979cd81e59243c3 Mon Sep 17 00:00:00 2001 From: Christopher Burger Date: Wed, 1 May 2019 12:06:18 -0400 Subject: [PATCH 1/1] RT# 83205 - fixed error with fields being sticky on error --- httemplate/edit/tower.html | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) 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 { -- 2.11.0