more flexible package suspend/unsuspend fees, #26828
[freeside.git] / httemplate / misc / process / elements / reason
1 <%init>
2 #untaint reasonnum, and set up new reason if appropriate
3 my $reasonnum = $cgi->param('reasonnum');
4 $reasonnum =~ /^(-?\d+)$/ or die "Illegal reasonnum";
5 $reasonnum = $1;
6
7 my $error;
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;
16 }
17 return ($reasonnum, $error);
18 </%init>