X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fmisc%2Fbatch-cust_pay.html;h=fb3ec04f35b29ed9c4e5bd54afb464f63cec32a8;hb=1115b9089e9d9ecf104bc61bb22e84f5233aa44b;hp=45459f14d7aa5b2b48d3ecd29f69cb30c1b3326c;hpb=05364e1a107233d35792a76bf6d23d00dd5611cf;p=freeside.git diff --git a/httemplate/misc/batch-cust_pay.html b/httemplate/misc/batch-cust_pay.html index 45459f14d..fb3ec04f3 100644 --- a/httemplate/misc/batch-cust_pay.html +++ b/httemplate/misc/batch-cust_pay.html @@ -5,6 +5,15 @@ <& /elements/error.html &> + -%} +% #XXX I think this can go away completely, but need to test with $use_discount +% ###not perl <% include('/elements/footer.html') %> @@ -425,29 +474,31 @@ push @onchange, ''; $m->comp('/elements/handle_uri_query'); # set up for preloading -my @rows; -my @row_errors; +my %rows; +my %row_errors; if ( $cgi->param('error') ) { my $param = $cgi->Vars; my $enum = 0; #errors numbered separately - for( my $row = 0; exists($param->{"custnum$row"}); $row++ ) { - $rows[$row] = []; - $row_errors[$row] = $param->{"error$enum"}; + my @invrows = grep /^invnum\d+\.\d+$/, keys %$param; #pare down possibilities + foreach my $row ( sort { $a <=> $b } map /^custnum(\d+)$/, keys %$param ) { +# for( my $row = 0; exists($param->{"custnum$row"}); $row++ ) { + $rows{$row} = []; + $row_errors{$row} = $param->{"error$enum"}; $enum++; - for( my $app = 0; exists($param->{"invnum$row.$app"}); $app++ ) { + foreach my $app ( map /^invnum$row\.(\d+)$/, @invrows ) { next if !$param->{"invnum$row.$app"}; my %this_app = map { $_ => ($param->{$_.$row.'.'.$app} || '') } qw( invnum amount ); $this_app{'error'} = $param->{"error$enum"} || ''; $param->{"error$enum"} = ''; # don't pass this error through - $rows[$row][$app] = \%this_app; + $rows{$row}[$app] = \%this_app; $enum++; } } - for( my $row = 0; $row < @row_errors; $row++ ) { - $param->{"error$row"} = $row_errors[$row]; + foreach my $row (keys %rows) { + $param->{"error$row"} = $row_errors{$row}; } } -#warn Dumper {rows => \@rows, row_errors => \@row_errors }; +#warn Dumper {rows => \%rows, row_errors => \%row_errors };