summaryrefslogtreecommitdiff
path: root/httemplate/edit
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2014-11-29 16:35:31 -0800
committerMark Wells <mark@freeside.biz>2014-11-29 16:36:42 -0800
commit6514e701a6d9f966f12cc5038a605ebc76ed003d (patch)
treec7544a66b40f51415e88cfc5e8fa539d33513fcd /httemplate/edit
parentac038da87ce36f915baa38d75c028efe618d4f85 (diff)
fix editing of events that have reasons, from #31702
Diffstat (limited to 'httemplate/edit')
-rw-r--r--httemplate/edit/process/part_event.html15
1 files changed, 10 insertions, 5 deletions
diff --git a/httemplate/edit/process/part_event.html b/httemplate/edit/process/part_event.html
index 481439d53..bac69241c 100644
--- a/httemplate/edit/process/part_event.html
+++ b/httemplate/edit/process/part_event.html
@@ -62,12 +62,17 @@
my $value = join(',', $cgi->param( "$prefix$option" ) );
if ( $option eq 'reasonnum' && $value == -1 ) {
- $value = {
- 'typenum' => scalar( $cgi->param( "new$prefix${option}T" ) ),
- 'reason' => scalar( $cgi->param( "new$prefix${option}" ) ),
- };
+ my $reason_prefix = $object->action . '_' . $option . '_new_';
+ my $new_reason = FS::reason->new;
+ foreach ( qw( reason_type reason unsuspend pkgpart
+ unsuspend_hold unused_credit ) ) {
+ $new_reason->set($_, $cgi->param("$reason_prefix$_"));
+ }
+ warn Dumper $new_reason;
+ my $error = $new_reason->insert;
+ die "error creating reason: $error" if $error;
+ $value = $new_reason->reasonnum;
}
-
( $option => $value );
}
@{ $object->option_fields_listref };