diff options
author | Mark Wells <mark@freeside.biz> | 2014-11-29 16:36:19 -0800 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2014-11-29 16:36:25 -0800 |
commit | ffda3975d8eefa8d08ae9e468dba33448e207ae6 (patch) | |
tree | aff371664c60cab543c3351fbf973d95216debca /httemplate | |
parent | ea16cbe4a50fa79872a4f08225863f39b7d28c06 (diff) |
fix editing of events that have reasons, from #31702
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/edit/process/part_event.html | 15 | ||||
-rwxr-xr-x | httemplate/elements/tr-select-reason.html | 1 |
2 files changed, 11 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 }; diff --git a/httemplate/elements/tr-select-reason.html b/httemplate/elements/tr-select-reason.html index c5b3d6f6c..0df7c058a 100755 --- a/httemplate/elements/tr-select-reason.html +++ b/httemplate/elements/tr-select-reason.html @@ -159,6 +159,7 @@ if ( $opt{'cgi'} ) { } my $id = $opt{'id'} || $name; +$id =~ s/\./_/g; # for edit/part_event my $add_access_right; if ($class eq 'C') { |