& /elements/header.html, { title => 'Quick payment entry', etc => 'onload="preload()"' } &> <& /elements/error.html &> <% include('/elements/xmlhttp.html', 'url' => $p. 'misc/xmlhttp-cust_main-discount_terms.cgi', 'subs' => [qw( discount_terms )], ) %>
% #XXX I think this can go away completely, but need to test with $use_discount % ###not perl <% include('/elements/footer.html') %> <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Post payment batch'); my $conf = new FS::Conf; my $money_char = $conf->config('money_char') || '$'; my @header = ( 'Amount', 'Check #', 'Date override' ); my @fields = ( 'paid', 'payinfo', '_date' ); my @types = ( '', '', 'date', ); my @align = ( 'r', 'r', 'r' ); my @sizes = ( 8, 10, 8 ); my @colors = ( '', '', '' ); my %param = (); my @footer = ( '_TOTAL', '', '' ); my @footer_align = ( 'r', 'r', '' ); my @onchange = ( '', '', '' ); my $use_discounts = ''; # Not entirely sure this works anymore... if ( FS::Record->scalar_sql('SELECT COUNT(*) FROM part_pkg_discount') ) { #push @header, 'Discount'; push @header, ''; push @fields, 'discount_term'; push @types, 'immutable'; push @align, 'r'; push @sizes, '0'; push @colors, ''; push @footer, ''; push @footer_align, ''; push @onchange, ''; $use_discounts = 'Y'; } push @header, 'Allocate'; push @fields, 'enable_app'; push @types, 'checkbox'; push @align, 'c'; push @sizes, '0'; push @colors, ''; push @footer, ''; push @footer_align, ''; push @onchange, 'toggle_application_row'; push @header, 'No Auto Allocate'; push @fields, 'no_auto_apply'; push @types, 'checkbox'; push @align, 'c'; push @sizes, '0'; push @colors, ''; push @footer, ''; push @footer_align, ''; push @onchange, ''; #push @header, 'Error'; push @header, ''; push @fields, 'error'; push @types, 'immutable'; push @align, 'l'; push @sizes, '0'; push @colors, '#ff0000'; push @footer, ''; push @footer_align, ''; push @onchange, ''; $m->comp('/elements/handle_uri_query'); # set up for preloading my %rows; my %row_errors; if ( $cgi->param('error') ) { my $param = $cgi->Vars; my $enum = 0; #errors numbered separately 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++; 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; $enum++; } } foreach my $row (keys %rows) { $param->{"error$row"} = $row_errors{$row}; } } #warn Dumper {rows => \%rows, row_errors => \%row_errors }; %init>