summaryrefslogtreecommitdiff
path: root/httemplate/misc/process/elements
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2014-11-25 19:39:23 -0800
committerMark Wells <mark@freeside.biz>2014-11-25 19:39:23 -0800
commit3cda3a85eb0daa5b8b9f4d30cd0896da6ccf4a9b (patch)
treee1d8a4f8b8572396fd2d4fe7a82327f1c9768c0f /httemplate/misc/process/elements
parent77be6115a8972c8e7917fc9f80e30a6ba571a552 (diff)
option to credit unused time on suspension as part of suspend reason, #31702
Diffstat (limited to 'httemplate/misc/process/elements')
-rw-r--r--httemplate/misc/process/elements/reason17
1 files changed, 17 insertions, 0 deletions
diff --git a/httemplate/misc/process/elements/reason b/httemplate/misc/process/elements/reason
new file mode 100644
index 000000000..ae92a7528
--- /dev/null
+++ b/httemplate/misc/process/elements/reason
@@ -0,0 +1,17 @@
+<%init>
+#untaint reasonnum, and set up new reason if appropriate
+my $reasonnum = $cgi->param('reasonnum');
+$reasonnum =~ /^(-?\d+)$/ or die "Illegal reasonnum";
+$reasonnum = $1;
+
+my $error;
+if ($reasonnum == -1) {
+ my $new_reason = FS::reason->new({
+ map { $_ => scalar( $cgi->param("reasonnum_new_$_") ) }
+ qw( reason_type reason unsuspend_pkgpart unsuspend_hold unused_credit )
+ }); # not sanitizing them here, but check() will do it
+ $error = $new_reason->insert;
+ $reasonnum = $new_reason->reasonnum;
+}
+return ($reasonnum, $error);
+</%init>