summaryrefslogtreecommitdiff
path: root/httemplate/edit/process
diff options
context:
space:
mode:
authorjeff <jeff>2007-10-04 02:07:30 +0000
committerjeff <jeff>2007-10-04 02:07:30 +0000
commit093fbb43eb8cfa3f94c8416ac9d2b7b078d8ee18 (patch)
treeb4bc331bb1a0d3b13d357efe849bf7dd027c49e4 /httemplate/edit/process
parent614af30dfb1d4b24d42ca2e3eed66784038ec398 (diff)
support part_pkg option input validation, check bytecounts and allow commas (closes 1863)
Diffstat (limited to 'httemplate/edit/process')
-rwxr-xr-xhttemplate/edit/process/part_pkg.cgi16
1 files changed, 13 insertions, 3 deletions
diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi
index 5fc59c14d..fd7b17567 100755
--- a/httemplate/edit/process/part_pkg.cgi
+++ b/httemplate/edit/process/part_pkg.cgi
@@ -10,12 +10,19 @@
%my $href = $plans{$cgi->param('plan')}->{'fields'};
%
%#fixup plandata
+%my $error;
%my $plandata = $cgi->param('plandata');
%my @plandata = split(',', $plandata);
%$cgi->param('plandata',
% join('', map { my $parser = sub { shift };
% $parser = $href->{$_}{parse} if exists($href->{$_}{parse});
-% "$_=". join(', ', &$parser($cgi->param($_))). "\n"
+% my $value = join(', ', &$parser($cgi->param($_)));
+% my $check = $href->{$_}{check};
+% if ( $check && ! &$check($value) ) {
+% $value = join(', ', $cgi->param($_));
+% $error ||= "Illegal ". ($href->{$_}{name}||$_). ": $value";
+% }
+% "$_=$value\n";
% } @plandata )
%);
%
@@ -39,9 +46,12 @@
% map { $_->svcpart }
% qsearch('part_svc', {} );
%
-%my $error;
%my $custnum = '';
-%if ( $cgi->param('taxclass') eq '(select)' ) {
+%if ( $error ) {
+%
+% # fall through
+%
+%} elsif ( $cgi->param('taxclass') eq '(select)' ) {
%
% $error = 'Must select a tax class';
%