[freeside-commits] freeside/httemplate/edit/process part_pkg.cgi, 1.20, 1.21

Jeff Finucane,420,, jeff at wavetail.420.am
Wed Oct 3 19:07:32 PDT 2007


Update of /home/cvs/cvsroot/freeside/httemplate/edit/process
In directory wavetail:/tmp/cvs-serv13542/httemplate/edit/process

Modified Files:
	part_pkg.cgi 
Log Message:
support part_pkg option input validation, check bytecounts and allow commas (closes 1863)

Index: part_pkg.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/process/part_pkg.cgi,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- part_pkg.cgi	12 Apr 2007 03:16:43 -0000	1.20
+++ part_pkg.cgi	4 Oct 2007 02:07:30 -0000	1.21
@@ -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';
 %



More information about the freeside-commits mailing list