summaryrefslogtreecommitdiff
path: root/httemplate/edit/process/part_pkg.cgi
diff options
context:
space:
mode:
authorjeff <jeff>2007-10-04 02:06:53 +0000
committerjeff <jeff>2007-10-04 02:06:53 +0000
commit7834c31d4004876e5d9537ec4fa2d02fbd31e62a (patch)
tree4d4c51a7fdb0afcc01700ba08c31d065ae828927 /httemplate/edit/process/part_pkg.cgi
parentdb629e8d4e0c83b7cbe71205f7c9f1fa8fd8a23c (diff)
support part_pkg option input validation, check bytecounts and allow commas (closes 1863)
Diffstat (limited to 'httemplate/edit/process/part_pkg.cgi')
-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 7971f4e68..176cf64c0 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';
%