2 #untaint reasonnum, and set up new reason if appropriate
3 my $reasonnum = $cgi->param('reasonnum');
4 $reasonnum =~ /^(-?\d+)$/ or die "Illegal reasonnum";
8 if ($reasonnum == -1) {
9 my $new_reason = FS::reason->new({
10 map { $_ => scalar( $cgi->param("reasonnum_new_$_") ) }
11 qw( reason_type reason unsuspend_pkgpart unsuspend_hold unused_credit
12 feepart fee_on_unsuspend fee_hold )
13 }); # not sanitizing them here, but check() will do it
14 $error = $new_reason->insert;
15 $reasonnum = $new_reason->reasonnum;
17 return ($reasonnum, $error);